Jump to content
43oh

Recommended Posts

  • 3 months later...

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

 

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...