Hi,

I tried to write some data into FLASH memory. I used the following code example:

const uint16_t test_var = 5;

int main()
{
.
.
.
FCTL3 = FWKEY;        // Unlock the flash.
FCTL1 = FWKEY | WRT;  // Enable flash write.
test_var56++;      // Write the data to the flash.
do {
  _NOP();
} while(FCTL3 & BUSY);
FCTL1 = FWKEY;        // Disable flash write.
FCTL3 = FWKEY | LOCK; // Lock the flash.*/
.
.
.
}

However, it does not work. The value of "test_var" after the first run is always "4". A second reset does not change value at all.

It seems that only the least significant bit is written to the flash.

Any ideas?

Thanks a lot.

Greetings,

    Wolfgang


--
Wolfgang Granzer
[email protected]
http://www.woif.org

Reply via email to