![NXP Semiconductors MC9S08PA4 Reference Manual Download Page 345](http://html1.mh-extra.com/html/nxp-semiconductors/mc9s08pa4/mc9s08pa4_reference-manual_1721838345.webp)
Note
Before starting the refresh sequence, disable global interrupts.
Otherwise, an interrupt could effectively invalidate the refresh
sequence if writing the four bytes takes more than 16 bus
clocks. Re-enable interrupts when the sequence is finished.
17.3.1.3 Example code: Refreshing the Watchdog
The following code segment shows the refresh write sequence of the WDOG module.
/* Refresh watchdog */
for (;;) // main loop
{
...
DisableInterrupts; // disable global interrupt
WDOG_CNT = 0xA602; // write the 1st refresh word
WDOG_CNT = 0xB480; // write the 2nd refresh word to refresh counter
EnableInterrupts; // enable global interrupt
...
}
17.3.2 Configuring the Watchdog
All watchdog control bits, timeout value, and window value are write-once after reset.
This means that after a write has occurred they cannot be changed unless a reset occurs.
This provides a robust mechanism to configure the watchdog and ensure that a runaway
condition cannot mistakenly disable or modify the watchdog configuration after
configured.
This is guaranteed by the user configuring the window and timeout value first, followed
by the other control bits, and ensuring that CS1[UPDATE] is also set to 0. The new
configuration takes effect only after all registers except WDOG_CNTH:L are written
once after reset. Otherwise, the WDOG uses the reset values by default. If window mode
is not used (CS2[WIN] is 0), writing to WDOG_WINH:L is not required to make the new
configuration take effect.
Chapter 17 Watchdog (WDOG)
MC9S08PA4 Reference Manual, Rev. 5, 08/2017
NXP Semiconductors
345
Summary of Contents for MC9S08PA4
Page 1: ...MC9S08PA4 Reference Manual Supports MC9S08PA4 Document Number MC9S08PA4RM Rev 5 08 2017 ...
Page 2: ...MC9S08PA4 Reference Manual Rev 5 08 2017 2 NXP Semiconductors ...
Page 22: ...MC9S08PA4 Reference Manual Rev 5 08 2017 22 NXP Semiconductors ...
Page 28: ...System clock distribution MC9S08PA4 Reference Manual Rev 5 08 2017 28 NXP Semiconductors ...
Page 150: ...Port data registers MC9S08PA4 Reference Manual Rev 5 08 2017 150 NXP Semiconductors ...
Page 196: ...Human machine interfaces HMI MC9S08PA4 Reference Manual Rev 5 08 2017 196 NXP Semiconductors ...
Page 224: ...Instruction Set Summary MC9S08PA4 Reference Manual Rev 5 08 2017 224 NXP Semiconductors ...
Page 232: ...Functional Description MC9S08PA4 Reference Manual Rev 5 08 2017 232 NXP Semiconductors ...
Page 258: ...FTM Interrupts MC9S08PA4 Reference Manual Rev 5 08 2017 258 NXP Semiconductors ...
Page 294: ...Functional description MC9S08PA4 Reference Manual Rev 5 08 2017 294 NXP Semiconductors ...
Page 398: ...Resets MC9S08PA4 Reference Manual Rev 5 08 2017 398 NXP Semiconductors ...
Page 400: ...MC9S08PA4 Reference Manual Rev 5 08 2017 400 NXP Semiconductors ...