25 / 71 page
宏晶科技:www.MCU-Memory.com Mobile:13922805190(姚永平) Tel:0755-82948409 Fax: 0755-82944243
宏晶科技:专业单片机 / 存储器供应商 www.MCU-Memory.com STC12C2052AD 系列 1T 8051 单片机中文指南
25
看门狗应用
适用型号: STC12C2052AD 系列
Symbol 符号 Function 功能
WDT_FLAG When WDT overflows, this bit is set. It can be cleared by software.
看门狗溢出标志位,当溢出时,该位由硬件置 1,可用软件将其清 0。
EN_WDT
Enable WDT bit. When set, WDT is started
看门狗允许位, 当设置为“1 ”时,看门狗启动。
CLR_WDT
WDT clear bit. When set, WDT will recount. Hardware will automatically clear
this bit.
看门狗清“0 ”位, 当设为“1 ”时,看门狗将重新计数。硬件将自动清“0 ”此位。
IDLE_WDT
When set, WDT is enabled in IDLE mode. When clear, WDT is disabled in IDLE mode
看门狗“IDLE ”模式位, 当设置为“1 ”时, 看门狗定时器在“空闲模式”计数
当清“0”该位时, 看门狗定时器在“空闲模式”时不计数
PS2, PS1, PS0 Pre-scale value of Watchdog timer is shown as the bellowed table:
看门狗定时器预分频值,如下表所示
The WDT period is determined by the following equation 看门狗溢出时间计算
看门狗溢出时间 = (12 x Pre-scale x 32768) / Oscillator frequency
设时钟为 12MHz:
看门狗溢出时间 = (12 x Pre-scale x 32768) / 12000000 = Pre-scale x 393216 / 12000000
Mnemonic
Add
Name
7
6
5
4
3
2
1
0
Reset Value
WDT_CONTR E1h
Watch-Dog-Timer
Control register
WDT_FLAG
-
EN_WDT CLR_WDT IDLE_WDT PS2 PS1 PS0 xx00,0000
PS2
PS1
PS0
Pre-scale
预分频
WDT Period @20MHz
0
0
0
2
39.3 mS
0
0
1
4
78.6 mS
0
1
0
8
157.3 mS
0
1
1
16
314.6 mS
1
0
0
32
629.1 mS
1
0
1
64
1.25S
1
1
0
128
2.5S
1
1
1
256
5S
PS2
PS1
PS0
Pre-scale
预分频
WDT Period @12MHz
0
0
0
2
65.5 mS
0
0
1
4
131.0 mS
0
1
0
8
262.1 mS
0
1
1
16
524.2 mS
1
0
0
32
1.0485S
1
0
1
64
2.0971S
1
1
0
128
4.1943S
1
1
1
256
8.3886S