background image
宏晶科技:www.MCU-Memory.com   Mobile:13922805190(姚永平)   Tel:0755-82948409    Fax: 0755-82944243
宏晶科技:专业单片机 / 存储器供应商   www.MCU-Memory.com   STC12C5410AD 系列 1T 8051 单片机中文指南
30
适用型号:  STC12C5410AD 系列
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:
            
看门狗定时器预分频值,如下表所示
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
P S 2
P S 1
P S 0
P r e - s c a l e
预 分 频
W D T   P e r i o d   @ 2 0 M H z
 0
 0
 0
    2
              3 9 . 3   m S
 0
 0
 1
    4
              7 8 . 6   m S
 0
 1
 0
    8
          1 5 7 . 3   m S
 0
 1
 1
        1 6
          3 1 4 . 6   m S
 1
 0
 0
        3 2
          6 2 9 . 1   m S
 1
 0
 1
        6 4
                1 . 2 5 S
 1
 1
 0
        1 2 8
                2 . 5 S
 1
 1
 1
        2 5 6
                5 S
P S 2
P S 1
P S 0
P r e - s c a l e
预 分 频
W D T   P e r i o d   @ 1 2 M H z
 0
 0
 0
    2
              6 5 . 5   m S
 0
 0
 1
    4
          1 3 1 . 0   m S
 0
 1
 0
    8
          2 6 2 . 1   m S
 0
 1
 1
        1 6
          5 2 4 . 2   m S
 1
 0
 0
        3 2
            1 . 0 4 8 5 S
 1
 0
 1
        6 4
            2 . 0 9 7 1 S
 1
 1
 0
        1 2 8
            4 . 1 9 4 3 S
 1
 1
 1
        2 5 6
            8 . 3 8 8 6 S
               看门狗应用及测试程序
The WDT period is determined by the following equation 看门狗溢出时间计算
看门狗溢出时间 =( N x Pre-scale x 32768) / Oscillator frequency
设时钟为 1 2 M H z :
看门狗溢出时间 =  ( 12 x Pre-scale x 32768) / 12000000 = Pre-scale x 393216 / 12000000