10 years, 10 months ago.

Watchdog?

Hello, my programm works with a ad-converter. At first time I set the samplerate e.g. 500Hz. I stored it in samplerate.(samplerate = 500;) After the watchdog reset what happends with by samplerate;

this function is good but how workes ?

if ((LPC_WDT->WDMOD >> 2) && 1) myled4 = 1; after watchdog reset set samplerate to the last samplerate; else myled3 = 1; normal reset set the samplerate=500;

With my AVR Controller I stored in the EEPROM. Must I do the same thing ? Bernd

1 Answer

10 years, 10 months ago.

It depends on your device. For example the LPC1768 doesn't have an EEPROM.

If yours does have one, storing it there is one option (search for the IAP library on how to do that). Alternatively for example on the LPC1768 (but I think more uCs have some similar registers), there are some registers that can be used to store information and which are not affected by resets: http://www.nxp.com/documents/user_manual/UM10360.pdf, page 568. I *assume* they also stay intact with a watchdog reset, but that would be something you have to test. Of course that is also extremely limited in how much you can store.

Alternatively you have the localfilesystem on some mbed devices which can be used (assuming you use the entire mbed, and not for example using only the microcontroller on acustom PCB), or external flash memory.

Accepted Answer