Jump to content
psp1004umd

Store values inside µc

Recommended Posts

Hello everyone ,

i was wondering if we can store some values inside an msp430g2231(or msp430g2231)

i know how to do that on an arduino EEPROM  

But i can't find anything on an MSP using energia :/

 

Share this post


Link to post
Share on other sites

The msp430g2231 only has a total of 2048 bytes of flash. If you use Energia, you are going to suck up half that flash just getting it to compile an empty sketch. The EEPROM on an atmega328p has 1024 bytes of eeprom.  What do  you want to store in EEPROM?

Share this post


Link to post
Share on other sites

Hi psp1004umd,

this MCU has the following "informational" Flash Memory:

Size 256 Byte in 4 Segments á 64 Bytes, Flash 010FFh to 01000h

There is a library colled "MspFlash.h" which you can include in your script. With this, you can use the segments B, C and D. A is protected so far.
You should be aware of the contraints when writing Flashmemory, you always have to erase the hole segment first:

Example:

#define Flash1 SEGMENT_B  // Alarmdata (AnzAlarme * 3 bytes, max. 21 Alarme moeglich/possible)
#define Flash2 SEGMENT_C  // Configdata ( 1 byte "Bundesland" (region)), 7 bytes last Time/Date
#define Flash3 SEGMENT_D  // 16 Feiertagsdaten nach Bundesland (German holidays per region),  3 Byte each.

//

void WFlash_Alarm() {
  Flash.erase(Flash1);
  for (byte i = 0; i < AnzAlarme; i++) {
    AlarmType::AType *M = &Alarme;
    Flash.write(Flash1 + (i * 3) , (unsigned char*) M, 3);
  }
}

If this is clear, just write a reply.

regards,

Stephan

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×