Jump to content

chicken

Members
  • Content Count

    907
  • Joined

  • Last visited

  • Days Won

    85

Reputation Activity

  1. Like
    chicken got a reaction from yyrkoon in More C versus C++   
    Here's some more C++ magic which seems applicable to embedded programming.
    I think he optimized for speed instead of space (using tons of mov instead of a loop to initialize sprite bitmaps). But a lot of impressive optimization by the compiler.
    On the downside, I didn't understand half the constructs he was using. I guess I need to relearn C++ 
    via embedded.fm podcast
  2. Like
    chicken got a reaction from devdibyo in MSP430F5529: How to translate the output voltage of MSP430F5529 and apply it to SIM900A ?   
    no need to start another thread
  3. Like
    chicken got a reaction from Fmilburn in Basic MSP430 GPIO Macros   
    In my project, I use a few basic macros for GPIO. The goal is, that I can easily redefine pin assignment in a central location without compromising performance or code size.
     
    The macros (gpiomacros.h):
    // MSP430 gpio macros #define GPIO_SEL(port) P ## port ## SEL #define GPIO_DIR(port) P ## port ## DIR #define GPIO_OUT(port) P ## port ## OUT #define GPIO_IN(port) P ## port ## IN #define GPIO_IS_INPUT(port,pin) { GPIO_SEL(port) &= ~(pin); GPIO_DIR(port) &= ~(pin); } #define GPIO_IS_OUTPUT(port,pin) { GPIO_SEL(port) &= ~(pin); GPIO_DIR(port) |= (pin); } #define GPIO_IS_PERIPHERAL_IN(port,pin) { GPIO_SEL(port) |= (pin); GPIO_DIR(port) &= ~(pin); } #define GPIO_IS_PERIPHERAL_OUT(port,pin) { GPIO_SEL(port) |= (pin); GPIO_DIR(port) |= (pin); } #define GPIO_SET(port,pin) { GPIO_OUT(port) |= (pin); } #define GPIO_CLEAR(port,pin) { GPIO_OUT(port) &= ~(pin); } #define GPIO_READ(port,pin)  ( GPIO_IN(port) & (pin) ) In a central configuration file (e.g. hardware.h) I assign pins like this:
    // Pin assignment #define LED1_PIN BIT1 #define LED1_PORT 6 #define LED2_PIN BIT0 #define LED2_PORT 1 And then in the code I interact with GPIO like this:
    // Setup LEDs GPIO_IS_OUTPUT(LED1_PORT, LED1_PIN); GPIO_IS_OUTPUT(LED2_PORT, LED2_PIN); // Turn off LEDs GPIO_CLEAR(LED1_PORT, LED1_PIN); GPIO_CLEAR(LED2_PORT, LED2_PIN); The macros are resolved in two steps:
    1. Higher level "functions" define the commands. E.g. GPIO_SET(), GPIO_IS_OUTPUT(), ..
    2. Lower level macros used within those functions translate port, pin to a register. E.g. GPIO_IN(), GPIO_SEL(), ..
     
    The end result is code like you would write when directly working with the GPIO registers. E.g. P2OUT &= ~BIT0; Note that this translation is done by the C pre-processor before the code is compiled.
     
    This all works fine and dandy, with the exception of port J. Port J doesn't have a SEL register, which breaks the 1st half of the GPIO_IS_OUTPUT and GPIO_IS_INPUT macros. I currently work around this by adding special GPIO_IS_OUTPUT/INPUT_J macros, but then the main code needs to include some logic to invoke the proper macro.
    #if (LED2_PORT == J) GPIO_IS_OUTPUT_J(LED2_PORT, LED2_PIN); #else GPIO_IS_OUTPUT(LED2_PORT, LED2_PIN); #endif Any ideas, how I could include a condition inside macros, that checks whether the port is J, and if so excludes the GPIO_SEL command?
     
    And yes, I could probably use C++ templates with identical results and an easy workaround for port J, but I'd like to avoid migrating my plain old C project.
     
    Edit: Added a few missing parentheses, thanks to Rickta59 for spotting that
  4. Like
    chicken reacted to Fmilburn in How to use internal rtc for msp430f5529   
    I modified the code in the link above a bit and wrote a new example to demonstrate retrieval of the date and time as well as a few other features. It was not extensively tested.  To use, post all of the files into a folder called RTC_F5529 where Energia can reach it.  It is posted here:  https://github.com/fmilburn3/RTC_F5529
     
    Real credit for the work belongs to the original author.
  5. Like
    chicken got a reaction from yyrkoon in Make (digital) book bundle starting at $1   
    I don't know how good those books by Make are, but if you're looking for some beginner books for Arduino and Raspberry Pi and don't mind that you only get a digital copy (PDF, ePUB or MOBI), this might be of interest:
     
    Humble Book Bundles: Arduino & Raspberry Pi
    https://www.humblebundle.com/books/make-arduino-and-raspberry-pi
     
    $1 bundle:
    Make: magazine, Volume 38: Everything you need to know about DIY consumer electronics
    Make: Basic Arduino Projects
    Making Things See: 3D vision with Kinect, Processing, Arduino, and MakerBot
    Make: Getting Started with the Internet of Things
    Make: Getting Started with Netduino
     
    $8 bundle adds:
    Make a Mind-Controlled Arduino Robot
    Make: A Raspberry Pi-Controlled Robot
    Make: AVR Programming
    Make: FPGAs
    Make: Bluetooth
     
    $15 bundle adds:
    Make: Getting Started with Arduino, 3rd Edition
    Make: Getting Started with Raspberry Pi, 3rd Edition
    Make: Getting Started with Sensors: Measure the World with Electronics, Arduino, and Raspberry Pi
    Make: Raspberry Pi and AVR Projects
    Make: Arduino Bots and Gadgets
    Make: Sensors
    Make: Getting Started with the Photon: Making Things with the Affordable, Compact, Hackable WiFi Module
     
  6. Like
    chicken got a reaction from dubnet in Make (digital) book bundle starting at $1   
    I don't know how good those books by Make are, but if you're looking for some beginner books for Arduino and Raspberry Pi and don't mind that you only get a digital copy (PDF, ePUB or MOBI), this might be of interest:
     
    Humble Book Bundles: Arduino & Raspberry Pi
    https://www.humblebundle.com/books/make-arduino-and-raspberry-pi
     
    $1 bundle:
    Make: magazine, Volume 38: Everything you need to know about DIY consumer electronics
    Make: Basic Arduino Projects
    Making Things See: 3D vision with Kinect, Processing, Arduino, and MakerBot
    Make: Getting Started with the Internet of Things
    Make: Getting Started with Netduino
     
    $8 bundle adds:
    Make a Mind-Controlled Arduino Robot
    Make: A Raspberry Pi-Controlled Robot
    Make: AVR Programming
    Make: FPGAs
    Make: Bluetooth
     
    $15 bundle adds:
    Make: Getting Started with Arduino, 3rd Edition
    Make: Getting Started with Raspberry Pi, 3rd Edition
    Make: Getting Started with Sensors: Measure the World with Electronics, Arduino, and Raspberry Pi
    Make: Raspberry Pi and AVR Projects
    Make: Arduino Bots and Gadgets
    Make: Sensors
    Make: Getting Started with the Photon: Making Things with the Affordable, Compact, Hackable WiFi Module
     
  7. Like
    chicken got a reaction from Fmilburn in Make (digital) book bundle starting at $1   
    I don't know how good those books by Make are, but if you're looking for some beginner books for Arduino and Raspberry Pi and don't mind that you only get a digital copy (PDF, ePUB or MOBI), this might be of interest:
     
    Humble Book Bundles: Arduino & Raspberry Pi
    https://www.humblebundle.com/books/make-arduino-and-raspberry-pi
     
    $1 bundle:
    Make: magazine, Volume 38: Everything you need to know about DIY consumer electronics
    Make: Basic Arduino Projects
    Making Things See: 3D vision with Kinect, Processing, Arduino, and MakerBot
    Make: Getting Started with the Internet of Things
    Make: Getting Started with Netduino
     
    $8 bundle adds:
    Make a Mind-Controlled Arduino Robot
    Make: A Raspberry Pi-Controlled Robot
    Make: AVR Programming
    Make: FPGAs
    Make: Bluetooth
     
    $15 bundle adds:
    Make: Getting Started with Arduino, 3rd Edition
    Make: Getting Started with Raspberry Pi, 3rd Edition
    Make: Getting Started with Sensors: Measure the World with Electronics, Arduino, and Raspberry Pi
    Make: Raspberry Pi and AVR Projects
    Make: Arduino Bots and Gadgets
    Make: Sensors
    Make: Getting Started with the Photon: Making Things with the Affordable, Compact, Hackable WiFi Module
     
  8. Like
    chicken reacted to maelli01 in micropower microvoltmeter with MSP430FR4133 and MCP3422 ADC   
    Weekend-project:
    Autoranging microvoltmeter based on the MSP430FR4133 launchpad.
    ADC used: MIcrochip MCP3422, an 18bit, 3.75 sample/second Sigma Delta with 2 differential inputs. I2C interface
    This nice little chip contains a programmable amplifier (x2,x4,x8) and a not-too-bad internal reference of 2.048V.
    Max input range is +/-2.048V, resolution (8x amplified) is 2uV.
     
    Hand-etched a single layer PCB which goes on top of Launchpad.
     
     

    Type K cable in hot water: 2.93mV, 73Kelvin temp difference to ambient
     
     

    compare with my Fluke 289, 0.06% (datasheet says 0.05% typical, 0.35% max)
    Not too shabby for a chip that costs 3 bucks.
     
     

    Current consumption: on average <40uA, the whole setup would run 5000hours from a CR2032
    The ADC does 1 sample/second and sleeps the rest of the time, the MSP430 does what it likes the most: sleep in LPM3
     
     
    Code is not a big deal, quick hack based on the FR4133 examples, for the LCD and for the I2C interface 
    //microvolt meter with MCP3422 and MSP430FR413 //****************************************************************************** #include <msp430.h> #define LCDMEMW ((int*)LCDMEM) #define pos1 4 // Digit A1 - L4 #define pos2 6 // Digit A2 - L6 #define pos3 8 // Digit A3 - L8 #define pos4 10 // Digit A4 - L10 #define pos5 2 // Digit A5 - L2 #define pos6 18 // Digit A6 - L18 const char digit[10] ={ 0xFC, // "0" 0x60, // "1" 0xDB, // "2" 0xF3, // "3" 0x67, // "4" 0xB7, // "5" 0xBF, // "6" 0xE0, // "7" 0xFF, // "8" 0xF7 // "9" }; volatile long voltage; unsigned long dvoltage; unsigned char TXByteCtr; unsigned char TXData; unsigned char newgain,gain; void Clear_LCD(){ int i; for(i=5;i;i--) LCDMEMW[i]=0; LCDMEMW[9]=0; } int main( void ) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1OUT = 0x00;P2OUT = 0x00;P3OUT = 0x00;P4OUT = 0x00; P5OUT = 0x00;P6OUT = 0x00;P7OUT = 0x00;P8OUT = 0x00; P1DIR = 0xFF;P2DIR = 0xFF;P3DIR = 0xFF;P4DIR = 0xFF; P5DIR = 0xFF;P6DIR = 0xFF;P7DIR = 0xFF;P8DIR = 0xFF; P5SEL0 |= BIT2 | BIT3; // I2C pins // Configure XT1 oscillator P4SEL0 |= BIT1 | BIT2; // P4.2~P4.1: crystal pins do { CSCTL7 &= ~(XT1OFFG | DCOFFG); // Clear XT1 and DCO fault flag SFRIFG1 &= ~OFIFG; } while (SFRIFG1 & OFIFG); // Test oscillator fault flag // Disable the GPIO power-on default high-impedance mode // to activate previously configured port settings PM5CTL0 &= ~LOCKLPM5; CSCTL4 = SELMS__DCOCLKDIV + SELA__XT1CLK; // MCLK=SMCLK=DCO; ACLK=XT1 // Configure RTC RTCCTL |= RTCSS__XT1CLK | RTCIE; // Initialize RTC to use XT1 and enable RTC interrupt RTCMOD = 16384; // Set RTC modulo to 16384 to trigger interrupt twice a second // Configure LCD pins SYSCFG2 |= LCDPCTL; // R13/R23/R33/LCDCAP0/LCDCAP1 pins selected LCDPCTL0 = 0xFFFF; LCDPCTL1 = 0x07FF; LCDPCTL2 = 0x00F0; // L0~L26 & L36~L39 pins selected LCDCTL0 = LCDSSEL_0 | LCDDIV_7; // flcd ref freq is xtclk // LCD Operation - Mode 3, internal 3.08v, charge pump 256Hz LCDVCTL = LCDCPEN | LCDREFEN | VLCD_5 | (LCDCPFSEL0 | LCDCPFSEL1 | LCDCPFSEL2 | LCDCPFSEL3); LCDMEMCTL |= LCDCLRM; // Clear LCD memory LCDCSSEL0 = 0x000F; // Configure COMs and SEGs LCDCSSEL1 = 0x0000; // L0, L1, L2, L3: COM pins LCDCSSEL2 = 0x0000; LCDM0 = 0x21; // L0 = COM0, L1 = COM1 LCDM1 = 0x84; // L2 = COM2, L3 = COM3 LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected (LCD4MUX also includes LCDSON) Clear_LCD(); // Configure USCI_B0 for I2C mode UCB0CTLW0 |= UCSWRST; // Software reset enabled UCB0CTLW0 |= UCMODE_3 | UCMST | UCSYNC; // I2C mode, Master mode, sync UCB0CTLW1 |= UCASTP_2; // Automatic stop generated // after UCB0TBCNT is reached UCB0BRW = 0x0008; // baudrate = SMCLK / 8 UCB0I2CSA = 0x0068; // Slave address UCB0CTL1 &= ~UCSWRST; UCB0IE |= UCRXIE | UCNACKIE | UCBCNTIE | UCTXIE0; while(1){ // P1OUT |= BIT0; TXByteCtr = 1; // Load TX byte counter TXData = 0x8C+gain; while (UCB0CTLW0 & UCTXSTP); // Ensure stop condition got sent UCB0CTLW0 |= UCTR | UCTXSTT; // I2C TX, start condition // P1OUT &= ~BIT0; __bis_SR_register(LPM3_bits | GIE); // timer will wake me up // P1OUT |= BIT0; UCB0TBCNT = 0x0003; // 3 bytes to be received voltage=0; UCB0CTLW0 &= ~UCTR; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTXSTT; // I2C start condition __bis_SR_register(LPM3_bits | GIE); // I2C irq will wake me up voltage<<=8; // shift to left corner to do the sign correctly voltage/=32; // calibration is done here: 2048 in an ideal world if ((voltage<400000)&&(voltage>(-400000))){ // autoranging, downshift if (newgain<3) newgain++; } if ((voltage>1000000)||(voltage<-1000000)){ // autoranging, upshift if (newgain) newgain--; } voltage>>=gain; gain=newgain; if ((voltage<500000)&&(voltage>-500000)){ voltage*=10; //low range LCDMEM[11]&=~1; //adjust decimal point LCDMEM[9]|=1; } else{ //high range LCDMEM[9]&=~1; //adjust decimal point LCDMEM[11]|=1; } voltage*=25; voltage/=128; if (voltage<0) {dvoltage=-voltage; LCDMEM[5]|=4 ;} //negative else {dvoltage= voltage; LCDMEM[5]&=~4;} //positive LCDMEM[pos1] = digit[(dvoltage / 100000)%10]; LCDMEM[pos2] = digit[(dvoltage / 10000)%10]; LCDMEM[pos3] = digit[(dvoltage / 1000)%10]; LCDMEM[pos4] = digit[(dvoltage / 100)%10]; LCDMEM[pos5] = digit[(dvoltage / 10)%10]; LCDMEM[pos6] = digit[dvoltage % 10]; // P1OUT &= ~BIT0; __bis_SR_register(LPM3_bits | GIE); // timer will wake me up } } #pragma vector = RTC_VECTOR __interrupt void RTC_ISR(void){ switch(__even_in_range(RTCIV, RTCIV_RTCIF)){ case RTCIV_NONE: break; // No interrupt case RTCIV_RTCIF: // RTC Overflow __bic_SR_register_on_exit(LPM3_bits); break; default: break; } } #pragma vector = USCI_B0_VECTOR __interrupt void USCIB0_ISR(void){ switch(__even_in_range(UCB0IV, USCI_I2C_UCBIT9IFG)){ case USCI_NONE: break; // Vector 0: No interrupts case USCI_I2C_UCALIFG: break; // Vector 2: ALIFG case USCI_I2C_UCNACKIFG: // Vector 4: NACKIFG UCB0CTL1 |= UCTXSTT; // I2C start condition break; case USCI_I2C_UCSTTIFG: break; // Vector 6: STTIFG case USCI_I2C_UCSTPIFG: break; // Vector 8: STPIFG case USCI_I2C_UCRXIFG3: break; // Vector 10: RXIFG3 case USCI_I2C_UCTXIFG3: break; // Vector 14: TXIFG3 case USCI_I2C_UCRXIFG2: break; // Vector 16: RXIFG2 case USCI_I2C_UCTXIFG2: break; // Vector 18: TXIFG2 case USCI_I2C_UCRXIFG1: break; // Vector 20: RXIFG1 case USCI_I2C_UCTXIFG1: break; // Vector 22: TXIFG1 case USCI_I2C_UCRXIFG0: // Vector 24: RXIFG0 voltage=(voltage<<8)+UCB0RXBUF; break; case USCI_I2C_UCTXIFG0: // Vector 26: TXIFG0 if (TXByteCtr){ // Check TX byte counter UCB0TXBUF = TXData; // Load TX buffer TXByteCtr--; // Decrement TX byte counter } else{ UCB0CTLW0 |= UCTXSTP; // I2C stop condition UCB0IFG &= ~UCTXIFG; // Clear USCI_B0 TX int flag } break; case USCI_I2C_UCBCNTIFG: // Vector 28: BCNTIFG __bic_SR_register_on_exit(LPM3_bits); break; case USCI_I2C_UCCLTOIFG: break; // Vector 30: clock low timeout case USCI_I2C_UCBIT9IFG: break; // Vector 32: 9th bit default: break; } }
  9. Like
    chicken reacted to maelli01 in Products using MSP430   
    Hioki multimeter MSP430F449
     
     

     
    8:12
  10. Like
    chicken reacted to StrangerM in How to save variables in FRAM ( MSP430FR4133 ).   
    "uint8_t lo __attribute__ ((section (".text"))) ; " does not work. http://forum.43oh.com/topic/5474-energia-and-wolverine-tips/
    But.... it runs.

    Simple example
    #include <msp430.h> #include "LCD_Launchpad.h" #define M P2_6 #define M1 P1_2 uint8_t L ; LCD_LAUNCHPAD myLCD ; uint8_t lo __attribute__ ((section (".text"))) ; void setup() { myLCD.init(); pinMode(M, INPUT_PULLUP); pinMode(M1, INPUT_PULLUP); // Serial.begin(9600) ; myLCD.clear(); } void loop() { if (digitalRead(M)==0 ){ SYSCFG0 &= ~PFWP; // Program FRAM write enable lo=5; // Record in FRAM SYSCFG0 |= PFWP; // Program FRAM write protected (not writable) } if (digitalRead(M1)==0 ){ SYSCFG0 &= ~PFWP; // Program FRAM write enable lo=3; // Record in FRAM SYSCFG0 |= PFWP; // Program FRAM write protected (not writable) } myLCD.print(lo); myLCD.print("Lo"); delay(1000); // Serial.println(lo); }
  11. Like
    chicken got a reaction from energia in I2C - MSP430 to MSP430 problems   
    How long are the wires over which you want to do I2C?
    Are the grounds connected?
    Weaker (i.e. higher value) pull-ups will make noise issues worse.
  12. Like
    chicken got a reaction from oPossum in Products using MSP430   
    A MSP430F415 in a cheap fingertip oximeter from AliExpress


     
    Teardown here: http://www.kean.com.au/oshw/oximeter/
     
    I wonder if that nicely labeled JTAG header is still functional.

     
    With 16K Flash and 512 bytes of RAM, this MCU is comparable to the MSP430G2553. Energia on an oximeter anyone?
     
    Addendum 2/28: I ordered an identical looking model off AliExpress. Unfortunately, it's no longer MSP430 inside :-( It's now powered by a STM32F030 ARM M0.
  13. Like
    chicken got a reaction from Fmilburn in Products using MSP430   
    A MSP430F415 in a cheap fingertip oximeter from AliExpress


     
    Teardown here: http://www.kean.com.au/oshw/oximeter/
     
    I wonder if that nicely labeled JTAG header is still functional.

     
    With 16K Flash and 512 bytes of RAM, this MCU is comparable to the MSP430G2553. Energia on an oximeter anyone?
     
    Addendum 2/28: I ordered an identical looking model off AliExpress. Unfortunately, it's no longer MSP430 inside :-( It's now powered by a STM32F030 ARM M0.
  14. Like
    chicken reacted to StrangerM in [POTM] dAISy - A Simple AIS Receiver   
    I used HAT with USB/COM  cable and have checked up by RasPI test generator.
    Excellent.


  15. Like
    chicken reacted to Fmilburn in [POTM] dAISy - A Simple AIS Receiver   
    dAISy Hat for the Raspberry Pi
     
    I have been using the new dAISy hat for the Raspberry Pi for a while now with OpenCPN and thought I would make a post.  I find it very usable on a RPi 3 (much improved over the RPi 2) and have seen improved reception with the two channel dAISy receiver as well.  Below is a screenshot of the most recent version of OpenCPN (4.5.0) running on a Raspberry Pi 3 with the latest Raspbian and

  16. Like
    chicken reacted to Fmilburn in Introduction to Finite State Machines   
    I recently became interested in Finite State Machines and ended up writing a tutorial which has been posted on the 43oh blog:  http://43oh.com/2017/02/how-to-implement-finite-state-machines-using-energia/
     
    The example uses Energia but adapting it to C / C++ for use with Code Composer Studio or other IDEs would be simple.  While conceptually easy, working through the details and applying the concepts in a more structured manner were instructive for me.  The tutorial is just an introduction but there are additional references at the bottom.  If you are aware of other good resources feel free to post them below.
  17. Like
    chicken got a reaction from energia in Library DNP3 to MSP430   
    Definitely looks like a complex undertaking. But those are the best learning opportunities.
     
    You will have to get an understanding about the overall architecture of OpenDNP. As @@Fmilburn suggested, contacting the owner or main contributors of the Github repository is probably your best bet when stuck on that topic. This includes getting their implementation to build. If the AVR implementation is working, there's a good chance that the FR6989 has sufficient resources.
     
    The "embedded" link includes "adapter" sub-folders, which look like platform specific code for AtmelAVR and AtmelDue (probably referring to the boards, not the whole Arduino programming framework). I think the files in there are a good indication for what needs to be re-implemented for a new platform like MSP430. On a quick glance, the code doesn't look too extensive, which is encouraging.
     
    Also check whether they make use of Atmel libraries in the code that's not platform specific.
  18. Like
    chicken got a reaction from StrangerM in [POTM] dAISy - A Simple AIS Receiver   
    For those with a dAISy USB or BoosterPack, I just published a new firmware version 4.11 on GitHub.
    https://github.com/astuder/dAISy/tree/master/Firmware
     
    It introduces the greatest incremental improvement since firmware 4.02. Turns out, slower channel hopping works A LOT better. Same range, but in my tests the change results in about 25-30% more messages received.
     
    I also fixed bug in serial communication that only occurs when you try to connect dAISy to an Android device. That bug was introduced a month ago, and impacts only a few customers that ordered units between December 20 2016 and January 18 2017.
     
    As always, please let me know if you run into any issues.
  19. Like
    chicken got a reaction from m0nk37 in MSP430G2553 and 3-wire SPI RGB LED timing help   
    Just the other day, there was an article on hackaday that may give you some workarounds
    http://hackaday.com/2017/01/20/cheating-at-5v-ws2812-control-to-use-a-3-3v-data-line/
     
    Alternatively, a level shifter like SN74HCT125 could be used.
  20. Like
    chicken got a reaction from m0nk37 in MSP430G2553 and 3-wire SPI RGB LED timing help   
    Looking at the data sheet:
    - Hi/lo speed is determined by the voltage on the SET pin. See page 2
    - The timing waveform on page 4 is describing 1 bit. Repeat it 72 times to transmit 72 bits of data (8/8/8 bit RGB for 3 LEDs), times the number of chained ICs.
     
    From what I understand, the SPI trick uses multiple bits of SPI data to match a single LED bit's timing. E.g. you'd use 100 to transmit a 0 and 110 to transmit a 1. You just have to make sure that SPI runs at roughly 600ns / bit, i.e. 1.666 MHz, with 1.6 probably being close enough. The trickier question is how to get the color data into that format and feeding it to the SPI peripheral. That's where the library comes in.
     
    @@Fmilburn to the rescue :-)
  21. Like
    chicken reacted to StrangerM in [POTM] dAISy - A Simple AIS Receiver   
    It`s for TIVA-C. As is...
    AIS_dAISy_TIVANEW.zip
  22. Like
    chicken reacted to JLV in i2c LCD   
    I succeed  interfacing a 16x2 LCD with a 430G2553 trough a PCF8574A port expansor as I2C/parallel  converter using the DFRobot.com library posted by Fmilburn, after solving the Energia 18 known issue with the 2553 I2C pin association described here. 
    To do this, it iwas necessary to copy the files twi.c and twi_sw.c  in the folder hardware/msp430/cores/msp430 in the Energia installation and, in addition to that, to edit the .cpp file in the library to add the line "Wire.setModule(0);" just before "Wire.begin(0);".
    Two additional comments that could be usefull for those that could want to use the same configuration:
    1) Pay attention to the chip used in the I2C backpack: Most of the code examples use the address 0x20, that is the default for the to PCF8574 (unless you had been playing with the A0, A1 and A2 pins) but today it is pretty usual to find the version PCF8574A where the default address is 0x38.
    2) Most LCDs work with 5V, but the PCF8574 works fine with any voltage in the range 2.5 - 6 V. So, you have two alternatives to wire the LCD to the 2553 without using the space-consuming level converters:
    - Connect the backpack to 3.3 V using an additional wire to feed the LCD with 5V, or
    - Connect the LCD and the backpack to 5V, but removing the pull up resistors from the SCA and SCL lines on the backpack board and placing them on the pins 14 and 15 of the G2553 (to 3.3V, obviously).
    BTW, you should also consider this last solution if you plan to connect more than one display (or other devices) to the I2C bus, to avoid the parallel of the individual pull up resistors.
    JLV
  23. Like
    chicken got a reaction from NurseBob in "Fatal Error:Could not find device " Error in MSP-FET and MSP430   
    Sounds like an issue with the wiring between the programmer and the MCU. Which pins of the MSPFET did you connect to what pins of the MCU?
  24. Like
    chicken got a reaction from LiviuM in Implementing a simple Menu   
    PS: If you want to get fancy/generic, you could implement the state/menu system with a structure. Something along these lines:
    struct {   int menu_id, // continuous but not functional, helps to keep track of the menu id's   int next_menu, // entry when pressing next   void (*action) (void),  // action when pressing select   const char* label  // displayed text } menu_t; int current_menu = 0; void do_select0(void) {   current_menu = 2; // set to sub menu } void do_ select1(void) {   // do main action 1 } void do_subaction1(void) {   // do sub action 1 } void do_subaction2(void) {   // do sub action 2 } void do_gotop(void) {   current_menu = 0; // set to top menu } menu_t menu[] = {   // Top level     { 0, 1,"Sub Menu", do_select0 },     { 1, 0, "Action", do_select1 },   // Sub menu     { 2, 3, "Sub action 1", do_subaction1 },     { 3, 4, "Sub action 2", do_subaction2 },     { 4, 2, "Up", do_gotop } }; and in the main loop / event handler:
    switch(event) { case next:   current_menu = menu[current_menu].next_menu;   write_text(menu[current_menu].label);   break; case select:   menu[current_menu].action();   write_text(menu[current_menu].label);   break; default;   // do nothing   break; } event = none;  // reset event variable
  25. Like
    chicken got a reaction from NurseBob in Library DNP3 to MSP430   
    Definitely looks like a complex undertaking. But those are the best learning opportunities.
     
    You will have to get an understanding about the overall architecture of OpenDNP. As @@Fmilburn suggested, contacting the owner or main contributors of the Github repository is probably your best bet when stuck on that topic. This includes getting their implementation to build. If the AVR implementation is working, there's a good chance that the FR6989 has sufficient resources.
     
    The "embedded" link includes "adapter" sub-folders, which look like platform specific code for AtmelAVR and AtmelDue (probably referring to the boards, not the whole Arduino programming framework). I think the files in there are a good indication for what needs to be re-implemented for a new platform like MSP430. On a quick glance, the code doesn't look too extensive, which is encouraging.
     
    Also check whether they make use of Atmel libraries in the code that's not platform specific.
×
×
  • Create New...