About the specific use of 89S51 89S52 watchdog

Publisher:自由思考Latest update time:2018-03-04 Source: eefocusKeywords:89S51  89S52  Watchdog Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

 The specific usage of the watchdog is as follows:

  in the program initialization, first write 01EH and then write 0E1H to the watchdog register (WDTRST address is 0A6H). This activates the watchdog.

code


org 0000 

 

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



In C language, add a declaration statement. 
Add a line sfr WDTRST = 0xA6 in the AT89X51.h declaration file; 

 code

Main() 

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

WDTRST=0x1E; 
WDTRST=0xE1; //Feed the watchdog 


}



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 . When the crystal oscillator stops oscillating, the watchdog is also invalid. 

3. 89S51 has only a 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 needs to be fed once every 16 milliseconds.


Keywords:89S51  89S52  Watchdog Reference address:About the specific use of 89S51 89S52 watchdog

Previous article:Introduction to reset circuit and watchdog circuit
Next article:Light up the running lights with C programming language

Recommended ReadingLatest update time:2024-11-15 07:30

STM8S——watchdog (IWDG)
IWDG working principle:   1. When the value 0xCC is written to the key value register (IWDG_KR), the independent watchdog is started and the counter starts to count down from its reset value 0xFF. When the count is reduced to 0x00, a reset signal is generated.   2. Use IWDG_PR and IWDG_RLR registers to configure a
[Microcontroller]
STM8S——watchdog (IWDG)
Introduction to the differences and characteristics of 8031, 8051, 8751, 89C51, and 89S51
8031/8051/8751 are Intel's early products. Features of 8031: 8031 ​​does not have a program memory ROM inside the chip. When using it, the user needs to connect an external program memory and a logic circuit 373. The external program memory is mostly EPROM 2764 series. If the user wants to modify the program written
[Microcontroller]
The usage of 89S51 watchdog function is as follows
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 th
[Microcontroller]
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号