mg84fl54b Megawin Technology, mg84fl54b Datasheet - Page 64

no-image

mg84fl54b

Manufacturer Part Number
mg84fl54b
Description
Full-speed Usb Micro-controller
Manufacturer
Megawin Technology
Datasheet
18. One-Time-Enabled Watchdog Timer (WDT)
The WDT is intended as a recovery method in situations where the CPU may be subjected to software upset.
The WDT consists of a 15-bits free-running counter, an 8-bit prescaler and a control register (WDTCR). System
clock (Fosc) available for the WDT. The block diagram is shown below.
18.1. WDT Block Diagram
To enable the WDT, users must set ENW bit (WDTCR.5). When the WDT is enabled, the counter will increment
one by an interval of (12 x Prescaler / Fosc). And now the user needs to clear it by writing “1” to the CLRW bit
(WDTCR.4) before WDT overflows. When WDT overflows, the MCU will reset itself and re-start.
Why is the WDT called “One-time Enabled”? It is because: Once the WDT is enabled by setting ENW bit, there
is no way to disable it except through power-on reset, which will clear the ENW bit. The WDTCR register will
keep the previous programmed value unchanged after hardware (RST-pin) reset, software reset and WDT reset.
For example, if the WDTCR is 0x2D, it still keeps at 0x2D rather than 0x00 after these resets. Only power-on
reset can initialize it to 0x00.
WDTCR (Address=E1H, Watch-Dog-Timer Control Register)
Note: This is a Write-only register, and it can only be reset to its initial value through power-on reset.
WRF: WDT reset flag. When WDT overflows, this bit is set by H/W. It should be cleared by software.
ENW: Enable WDT. Set to enable WDT. (Note: Once set, it can only be cleared by power-on reset.)
CLRW: Clear WDT. “Writing 1” to this bit will clear WDT. (Note: It has no need to be cleared by “writing 0”.)
WIDL: WDT in Idle mode. Set this bit to let WDT keep counting while the MCU is in the Idle mode.
PS2~PS1: Prescaler select. See the following Table.
64
IDLE
Fosc/12
WRF
7
6
-
ENW
5
CLRW
MG84FL54B Data Sheet
1/256
1/128
4
1/64
1/32
1/16
8-bit prescalar
1/8
1/4
1/2
WIDL
WRF
3
-
ENW
CLRW
PS2
2
WIDL
PS2
WDTCR Register
PS1
PS1
1
15-bit timer
PS0
PS0
0
MEGAWIN

Related parts for mg84fl54b