AnsweredAssumed Answered

D Flash data is not getting updated correctly on mc9s12xep100 after power on.

Question asked by Salman Shaikh on Jul 27, 2017
Latest reply on Jul 28, 2017 by ZhangJennie

I am using mc9s12xep100 board and 'IEE1.c' and 'IEE1.h' to update some values in D flash.


I am using following code to read a byte from D Flash, if value is less than 50, I set value to 1,

otherwise i increment the value by 1.

But I always see the value as 1.

When I am in debug mode, this code works correctly. When in run mode I face the above problem.


uint16_t RetVal=0;
uint8_T NewData =0;
RetVal = IEE1_GetByte((IEE1_TAddress)(0x100D00), &NewData);

if(NewData > 50) {
NewData = 1; // If previous value greater than 50, set value to 1

RetVal = IEE1_SetByte((IEE1_TAddress)(0x100D00),NewData);
} else {
NewData++; // If previous value less than 50 increment value by 1
RetVal = IEE1_SetByte((IEE1_TAddress)(0x100D00),NewData);