Other Parts Discussed in Thread: CC430F6137
Hello.
i have problem with flash memory in CC430F6137. My code is:
char kod;
Flash_ptr = (char *)0x1900;
kod = *Flash_ptr;
if(kod==0x02){lcd2(0x0A22);}
if(kod==0x03){lcd3(0x0A22);}
if(kod==0x07){lcd7(0x0A22);}
if(kod==0x00){lcd0(0x0A22);}
// save to flash
if((P2IN & BIT5)==0) // 1
{ lcd4(0x0A27);
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
Flash_ptr = (char *)0x1900; // Initialize Flash pointer
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + LOCK; // Set Erase bit
*Flash_ptr = 0x01; // Dummy write to erase Flash seg
lcd2(0x0A27);
}
if this is the correct code. does not read the value written?
best regards