New watchdog circuit based on X25045

Publisher:Qinghua2022Latest update time:2006-08-09 Source: 今日电子Keywords:gatekeeper Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  The watchdog circuit is one of the anti-interference measures required by embedded systems. This article uses the X25045 chip to design a new watchdog circuit. It has the characteristics of small size, less I/O port lines and convenient programming. It can be widely used in instrumentation and various industrial control systems.

Preface

  When industrial control systems are running, they usually encounter various on-site interferences. Anti-interference ability is an important indicator to measure the performance of industrial control systems. The watchdog circuit is an important guarantee for the operation of the self-monitoring system. Almost all industrial control systems contain watchdog circuits. In the 8096 series of microcontrollers and the enhanced 8051 series of microcontrollers, this system has been built inside the chip. Users only need to open it with software, which is very convenient to use. But at present, industrial control systems still use cheap ordinary 8051 series microcontrollers, so the watchdog circuit must be built by the user.

  Watchdog circuits generally include software watchdogs and hardware watchdogs. Software watchdog does not require external hardware circuitry, but the system needs to transfer a timer resource, which is difficult to achieve in many systems. Moreover, if the system software does not run properly, the watchdog system may also be paralyzed. The hardware watchdog is a true "program execution monitor". For example, the counting watchdog circuit usually consists of a 555 multivibrator, a counter, and some resistors, capacitors, etc. The system circuit composed of discrete components is relatively complex. The operation is not reliable enough.

Introduction to X25045 chip

  X25045 is a standardized 8-pin integrated circuit produced by Xicor Company in the United States. It combines three functions of EEPROM, watchdog timer, and voltage monitoring into a single chip, greatly simplifying hardware design, improving system reliability, and reducing It reduces the space requirements for printed circuit boards, reduces costs and system power consumption, and is an ideal microcontroller peripheral chip. The X25045 pins are shown in Figure 1.


Figure 1 X25045 pin diagram

Its pin functions are as follows.

CS: Chip select input;
SO: Serial output, data is output bit by bit from this pin;
SI: Serial input, data or commands are written to X25045 bit by bit from this pin;
SCK: Serial clock input, its rising edge Write data or commands, and output the data on the falling edge;
WP: write protection input. When it is low, writing operations are prohibited;
Vss: ground;
Vcc: power supply voltage;
RESET: reset output.
Before X25045 performs read and write operations, it needs to issue instructions to it first. The instruction name and instruction format are shown in Table 1.


Table 1 X25045 instructions and their meanings

X25045 watchdog circuit design and programming

  The X25045 hardware connection diagram is shown in Figure 2. The X25045 chip contains a watchdog timer, which can preset the system monitoring time through 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 three reset signals for the CPU: power-on reset (C1, R2), manual reset (S, R1, R2) and Watchdog reset (C2, R3), which are synthesized through an OR gate and then added to the RESET terminal. The time constants of C2 and R3 do not need to be too large, just hundreds of microseconds, 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 through the corresponding bit of the status register of X25045. As shown in Table 2, there are 6 bits in the X25045 status register with meaning, among which WD1 and WD0 are related to the watchdog circuit, and the remaining bits are related to the EEPROM working settings.


Table 2 X25045 status register

WD1=0, WD0=0, the preset time is 1.4s.
WD1=0, WD0=1, the preset time is 0.6s.
WD1=1, WD0=0, preset time is 0.2s.
WD1=1, WD0=1, the watchdog is prohibited from working.

  The timing time of the watchdog circuit can be determined by the cycle period of the specific application, which is usually slightly longer than the maximum cycle time when the system is working normally. When programming, you can add a dog feeding instruction to the appropriate place in the software so that the watchdog's timing time will 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 using software traps or other methods, the watchdog timer quickly increases to the preset time, forcing the system to reset.

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

#include "reg51.h"
sbit cs=P1^2;/*The chip select signal is generated by P1.2*/
sbit sck=P1^3; /*The clock signal is generated by P1.3*/
sbit si=P1^0 ; /*SI is generated from P1.0*/
sbit so=P1^1; /*SO is generated from P1.1*/
sbit c=ACC^7; /*Define bit variable*/
bdata unsigned char com;
void tran( ) /*Send one byte data sub-function*/
{
unsigned char i;
for(i=0; i<8; i++)
{ ACC=com; /*Put the data into a*/
si=c;
sck= 0; /*sck generates an upward transition*/
sck=1;
com=com<<1; /*shift one bit to the left*/
}
return;
}
main()
{
com=0x06; /*enable writing and reading Command*/
cs=0;
tran();
cs=1;
com=0x01; /*Send status word command*/
cs=0;
tran();
com=0x00; /*Timing 1.4s*/
tran() ;
cs=1;
...;Program part for normal operation of the system
}

  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 during normal operation of the system does not reach the preset time. The system will not reset. The instructions for feeding the dog are as follows.

main()
{
...;Program part for normal operation of the system
{
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 such a chip, plus a crystal oscillator and reset circuit, can form a microcontroller application system, which is very suitable for the design of portable instruments and embedded systems.

References
1. Li Chaoqing. Microcontroller Principles and Control Technology. Beijing University of Aeronautics and Astronautics Press, 2001
2. Hu Wei, Ji Xiaoheng. Microcontroller C program time and application examples. People's Posts and Telecommunications Press, 2003
3. x25045 information of American Xicor Company

开始插入图片 admin20060217113703.jpg admin20060217113713.jpg admin20060217113915.gif admin20060217113924.gif 结束插入图片
Keywords:gatekeeper Reference address:New watchdog circuit based on X25045

Previous article:New watchdog circuit based on X25045
Next article:Development based on ARM intelligent traffic signal control board

Recommended ReadingLatest update time:2024-11-16 18:06

FCT (Functional Circuit Test) Test System Based on PXI and LabVIEW
Challenge: Use PXI control boards and LabVIEW software to build a relatively complete PCB functional test (FCT) system. This system can be used to perform comprehensive and fully automatic tests on audio, video, and various static parameters (voltage, current, and frequency). For newly developed and produced PCBs, t
[Test Measurement]
FCT (Functional Circuit Test) Test System Based on PXI and LabVIEW
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

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号