Brief Introduction of 51 Single Chip Microcomputer Watchdog Circuit

Publisher:CaptivatingGazeLatest update time:2012-08-08 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The watchdog circuit is composed of 89C51 single-chip microcomputer and X25045. The hardware connection diagram of X25045 is shown in Figure 2. The X25045 chip contains a watchdog timer, and the system monitoring time can be preset by software. If there is no bus activity within the preset time of the watchdog timer, X25045 will output a high-level signal from RESET, and output a positive pulse through the differential circuit C2 and R3 to reset the CPU. In the circuit of Figure 2, there are 3 reset signals for the CPU: power-on reset (C1, R2), manual reset (S, R1, R2) and watchdog reset (C2, R3), which are added to the RESET terminal after being synthesized by the OR gate. The time constants of C2 and R3 do not need to be too large, and hundreds of microseconds are sufficient, because the CPU oscillator is already working at this time.


Figure 2 X25045 watchdog circuit hardware connection diagram

The preset time of the watchdog timer is set by the corresponding bit of the status register of X25045. As shown in Table 2, there are 6 bits in the status register of X25045, of which WD1 and WD0 are related to the watchdog circuit, and the remaining bits are related to the working settings of EEPROM.


Table 2 X25045 status register

WD1=0, WD0=0, preset time is 1.4s.
WD1=0, WD0=1, preset time is 0.6s.
WD1=1, WD0=0, preset time is 0.2s.
WD1=1, WD0=1, disable watchdog.

The length of the watchdog circuit timing time can be determined by the cycle of the specific application program, and is usually slightly longer than the maximum cycle time when the system is working normally. When programming, you can add a dog feeding instruction in the appropriate place of the software to make the watchdog timing time never reach the preset time, and the system will not reset and work normally. When the system runs away and the program cannot be captured back by software traps or other methods, the watchdog timing time will quickly increase to the preset time, forcing the system to reset. [page]

The following is part of the watchdog program written in C language.

#include reg51.h
sbit cs=P1^2;/*Chip select signal is generated by P1.2*/
sbit sck=P1^3; /*Clock signal is generated by P1.3*/
sbit si=P1^0; /*SI is generated by P1.0*/
sbit so=P1^1; /*SO is generated by P1.1*/
sbit c=ACC^7; /*Define bit variables*/
bdata unsigned char com;
void tran() /*Send one byte data sub-function*/
{
unsigned char i;
for(i=0; i<8; i++)
{ ACC=com; /*Put data into a*/
si=c;
sck=0; /*sck generates an up jump*/
sck=1;
com=com<<1; /*Shift left one bit*/
}
return;
}
main()
{
com=0x06; /*Send write and read enable command*/
cs=0;
tran();
cs=1;
com=0x01; /*Send write status word command*/
cs=0;
tran();
com=0x00; /*Timing 1.4s*/
tran();
cs=1;
...;Program part for normal system operation
}

It should be noted that when the program is running normally, a dog feeding instruction should be added in an appropriate place so that the timing time of the system during normal operation does not reach the preset time. The system will not reset. The dog feeding instruction is as follows.

main()
{
...; The program part for normal system operation
{
cs=0; /*Generate cs pulse*/
cs=1;
}
}

The watchdog circuit of X25045 is very convenient to use. X25045 also integrates 512BEEPROM and voltage operation monitoring system. Only one chip, plus crystal oscillator and reset circuit can form a single-chip microcomputer application system, which is very suitable for the design of portable instruments and embedded systems.

Reference address:Brief Introduction of 51 Single Chip Microcomputer Watchdog Circuit

Previous article:Design of remote intelligent voice anti-theft alarm system based on single chip microcomputer
Next article:Brief Introduction of MCU Extended Interrupt Method

Recommended ReadingLatest update time:2024-11-16 17:39

51 MCU-Final key program
1. Code and analysis Let's post the code first, and then analyze the principle u8 KEY_Scan(u8 mode,u16 TIMES) {       static u8 key_up=1; //Key release flag     static u16 times;     if(mode)key_up=1; //If mode is equal to 1, continuous pressing is supported         if(key_up&&(KEY4==0||KEY8==0||KEY12==0||KEY16==0
[Microcontroller]
51 MCU Assembly Language Experiment (IV) ----Serial Communication Experiment
1. Experimental purpose:    Learn how the serial port works and master how to write microcontroller communication programs. 2. Experimental equipment:    One PC computer and one Dais-52PRO+ experimental system. 3. Experimental content:    Serial communication with PC 4. Serial communication with PC    1. Experim
[Microcontroller]
51 MCU Assembly Language Experiment (IV) ----Serial Communication Experiment
80C51 MCU-LED running water light effect
This article will introduce a marquee experiment based on 8051 microcontroller, and realize the LED running light effect by writing code. This experiment will use the P2 port of 8051 microcontroller to control 8 LED lights to realize the running light effect. Experimental preparation 8051 Microcontro
[Microcontroller]
51 MCU drives YL-69 soil moisture sensor
The program in the YL-69 data sheet includes the test program for the 51 microcontroller and Arduino. I used the program for the 51. Let me talk about my module first. It is a four-wire system. If you buy a three-wire system, it doesn't matter. You will understand it after reading it. I won't talk about the connection
[Microcontroller]
51 MCU drives YL-69 soil moisture sensor
51 single chip microcomputer realizes three-phase six-step stepper motor control
The MCU source program is as follows #include reg52.h            #define uchar unsigned char #define uint unsigned int uint speed = 100; //initial speed uint max = 200; // slowest speed uint min = 20; //fastest speed sbit swich = P2^0; //main switch sbit dir = P2^1; //Motor rotation direction sbit le1=P2^6; sbit
[Microcontroller]
51 single chip microcomputer realizes three-phase six-step stepper motor control
Microcontroller Course Design-ATMEL51 Series Microcontroller Programmer
I have designed many things with single-chip microcomputers. I can say that I have used all the peripheral resources of AT microcontrollers (including AVR microcontrollers). So I am thinking about what kind of thing I should design? ?   Once I went to an interview, I told the interviewer that I had designed a developm
[Microcontroller]
Microcontroller Course Design-ATMEL51 Series Microcontroller Programmer
ADC0808 Program Based on AT89C51 Microcontroller
Introduction to AT89C51 Microcontroller AT89C51 is a low voltage, high performance CMOS 8-bit microprocessor with 4K bytes of flash programmable and erasable read only memory (FPEROM), commonly known as a single chip microcomputer. The device is manufactured using ATMEL's high-density non-volatile memory manufacturing
[Microcontroller]
ADC0808 Program Based on AT89C51 Microcontroller
Design of LED display system based on 51 single chip microcomputer
introduction Recently, the author found in a logistics call system project based on field bus on a large production line in a factory that due to the large amount of information flow to be displayed, the existing LED display screen control system based on AT89C51 chip is limited by the processing speed, system
[Microcontroller]
Design of LED display system based on 51 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

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号