In the following code the incrementation of wdt_counter does not work.
The value stay at 0.
Does that have something to do with the read_eeprom instruction ?
Any suggestion ?
Thanks !!
Pic 18f2525 and compiler 4.065
Code:
if (temp == WDT_TIMEOUT)
{
printf("\r\nwatchdog timeout!\r\n");
write_eeprom(816,87); // store 'w'
wdt_counter = read_eeprom (817) + 1;
write_eeprom(817,wdt_counter);
}
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Mon Dec 27, 2010 4:48 pm
There's no way for us to test this code fragment. You don't initialize
eeprom address 817. We don't know its initial value.
Also, your code doesn't read address 817 and display it. So how do you
know what the initial state is ? What if the initial state is 0xFF ?
(0xFF = erased eeprom, possibly done by the ICD programmer).
If you add 1 to 0xFF, then you get 0x00.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum