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.
Previous article:51 MCU and USB chip PDIUSBD12 interface firmware program
Next article:2864LCD display remote control key value decoder
Recommended ReadingLatest update time:2024-11-23 15:00
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- MCU drives 24V solenoid valve
- Wi-Fi 6 and CHIP: True Plug-and-Play Smart Home
- RS232 serial port definition
- Which LED driver chip can achieve 5W, 7W, 12W, 15W bulbs? Is there any recommendation?
- The PWM output signal of the 28335 chip is always high
- 【Running posture training shoes】No.007-Self-generating function research
- uboot logo replacement problem
- Why do 4G industrial routers need a hardware watchdog?
- EEWORLD University Hall----Cybernetics and System Identification
- Where is the through hole metallization option for ad 18? Picture 1 is mine, and picture 2 is someone else's.