The 89S51 and 89C51 in ATMEL's 89S51 series have the same functions. The instructions are compatible. HEX programs can be used directly without any conversion. The 89S51 only adds a watchdog function compared to the 89C51. For other functions of the 89S51, please refer to the 89C51 data.
The specific usage of the watchdog is as follows:
In the initialization of the program, write 01EH first and then 0E1H to the watchdog register (WDTRST address is 0A6H) to activate the watchdog.
Org 0000
Ljmp begin
Begin:
Mov 0A6H,#01EH ; send 1E first
Mov 0A6H,#0E1H ; send to E1
;Activate the watchdog during program initialization.
…
…
For:
…
Mov 0A6H,#01EH ; send 1E first
Mov 0A6H,#0E1H ; send to E1
;Feed the dog command
…
Ljmp for
In C language, a declaration statement needs to be added.
Add a line sfr WDTRST = 0xA6 in the AT89X51.h declaration file;
Main()
{
WDTRST=0x1E;
WDTRST=0xE1; //Initialize watchdog.
While (1)
{
WDTRST=0x1E;
WDTRST=0xE1; //Dog feeding instruction
}
}
Note:
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 CPU crystal oscillator. When the crystal oscillator stops oscillating, the watchdog is invalid.
3. 89S51 has only 14-bit counter. The dog 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 dog must be fed once every 16 milliseconds.
Previous article:How are C51 data stored in memory?
Next article:Comparison between MSP430 series and 89C5l series
Recommended ReadingLatest update time:2024-11-16 19:48
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MSP432P401M MSP432P4xx: Falcon Series
- [F-Wireless Microphone Amplification System] Hubei Province_First Prize
- [Repost] Nine things to note when testing PCB boards
- [Fudan Micro FM33LC046N Review] + GPTIM_PWM
- Automotive RFCMOS 77GHz Radar Module Design
- Help: Puyuan DS5102CA waveform measurement problem
- What is the difference between cmw500 signaling and non-signaling?
- MSP430 MCU Development Record (2)
- [MM32 eMiniBoard Review] + OLED screen driver display
- How to speed up pmos shutdown and control the delay time within us