Hello
I want to save two variables in segment B in flash of msp430g2101 .
When in saved variable x1 at address 0x1080 with following funcation call, it get saved.
But when i saved variable x2 at address 0x1084(in same segment B) it get saved but this time variable x1 get deleted.
The function i used is given below
void write_Seg(unsigned int addr,unsigned int value)
{
unsigned int *Flash_ptr; // Flash pointer
Flash_ptr =(unsigned int*)addr;
FCTL2=FN0+FSSEL0+FWKEY;
FCTL3 = FWKEY; // Clear Lock bi
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash segment
while(FCTL3 & BUSY);
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
*Flash_ptr = value; // Write value to flash
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
Can you pls let me know why I am unable to save two variable in same segment B.
Thanks
Manish