The usage of 89S51 watchdog function is as follows

Publisher:技术旅人Latest update time:2018-01-25 Source: eefocusKeywords:89S51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The usage of 89S51 watchdog function is as follows: 
In the initialization of the program, write 01EH first and then write 0E1H to the watchdog register (WDTRST address is 0A6H). The watchdog can 
be activated  .
Org 0000  
Ljmp begin 
Begin: 
Mov 0A6H,#01EH; send 1E first 
Mov 0A6H,#0E1H; send E1 later 

; Activate the watchdog in the program initialization. 
…… 
…… 
For: 
…… 
Mov 0A6H,#01EH ;Send 1E first 
Mov 0A6H,#0E1H ;Send E1 later 
;Feed the dog instruction 
…… 
Ljmp for 

In C language, a declaration statement must be added. 
Add a line in the AT89X51.h declaration file sfr WDTRST = 0xA6; 
Main() 

WDTRST=0x1E; 
WDTRST=0xE1;//Initialize the watchdog. 
While (1) 

WDTRST=0x1E; 
WDTRST=0xE1;//Feed the dog instruction 




Notes: 
1. The watchdog of 89S51 must be activated by the program before it starts working. Therefore, it is necessary to ensure that the CPU has a reliable power-on reset. 
Otherwise, the watchdog will not work. 
2. The watchdog uses the crystal oscillator of the CPU . The watchdog is also invalid when the crystal oscillator stops. 
3. 89S51 has only 14-bit counter. The watchdog must be fed at least once in 16383 machine cycles . And this time is 
fixed  and cannot be changed. When the crystal oscillator is 12M, the watchdog must be fed once every 16 milliseconds.
The timer can also be used to extend the watchdog feeding time from a few seconds to a few minutes. 
In general, a dedicated watchdog chip is used. 


Keywords:89S51 Reference address:The usage of 89S51 watchdog function is as follows

Previous article:51 MCU and USB chip PDIUSBD12 interface firmware program
Next article:2864LCD display remote control key value decoder

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号