Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

MSP430 + Reading/writing from flash memory

$
0
0

Hi there,

 

I'm designing a little embedded system for a Formula SAE project. I'm trying to save "tuning" values from an ADC onto the microcontroller for later reference, if the values need to be reset or retuned later. The values are between 0-255 (ADC scaled down by a factor of 4). I'm using a MSP430G2452, and to my understanding this is possible as demonstrated in the mspflash example file. However, I for the life of me could not get anything coherent to display on the LCD hooked up to the MSP430 (44780). 

 

The general gist it I have an array:

 

unsigned int potvalue[4] = {0, 0, 0, 0};
 
 

And I'm trying to copy all of these values into the MSP's flash memory:

 

for(int offsat = 0; offsat < 64; offsat += 1){
            Flash.write(SEGMENT_D + offsat, (unsigned char*)potvalue + offsat, 1);
          }
 
And then later reading it, and outputting the value to the LCD (44780):
 
     lcd.setCursor(0, 1);         
     for(int offset = 0; offset < 64; offset += + 1){    
      Flash.read(SEGMENT_D + offset, &data, 1);
      lcd.print(data);

 

 

...but I seem to just be getting garbage. Any help at all would be greatly appreciated, I'm sure I've done goof'd up in there somewhere! Thanks again!


Viewing all articles
Browse latest Browse all 2077

Trending Articles