CN101833480A - Method for realizing watchdog by using timer and resetting pin of singlechip - Google Patents
Method for realizing watchdog by using timer and resetting pin of singlechip Download PDFInfo
- Publication number
- CN101833480A CN101833480A CN 201010167515 CN201010167515A CN101833480A CN 101833480 A CN101833480 A CN 101833480A CN 201010167515 CN201010167515 CN 201010167515 CN 201010167515 A CN201010167515 A CN 201010167515A CN 101833480 A CN101833480 A CN 101833480A
- Authority
- CN
- China
- Prior art keywords
- timer
- pin
- chip microcomputer
- singlechip
- house dog
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000010586 diagram Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 239000012467 final product Substances 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a method for realizing a watchdog by using a timer and a resetting pin of a singlechip. At least one timer used for resetting the singlechip when a program runs abnormally is arranged in the singlechip; one output pin (P0) of the singlechip is connected with the resetting pin (RST) of the singlechip; the resetting pin (RST) is connected with a resistor (R1) which is earthed; and the output pin (P0) is a control pin of the watchdog. When the singlechip runs normally, the time of the timer is reset constantly. When the singlechip works abnormally, the time of the timer increases continuously; and when the time of the timer reaches a preset upper limit, the control pin of the watchdog sends out a resetting signal to reset the singlechip. Since no special chip is used, the invention has low cost and good applicability.
Description
Technical field
The present invention relates to the single chip circuit design field, relate in particular to a kind of method that realizes and control house dog.
Background technology
In the operational process of single-chip microcomputer, we usually can run into single-chip microcomputer owing to run into special circumstances, cause the normal operation of program to be interrupted; make program fleet; single-chip microcomputer can't remain in operation, and total system enters dead state, can cause some unforeseen consequences in practice.In order to monitor and keep the normal operation of single-chip microcomputer, all can add watchdog chip in the general single chip circuit or in single-chip microcomputer built-in watchdog chip so that occur can finding and recover normal as soon as possible when unusual in system.
Summary of the invention
Need special chip, cost height, deficiency poor for applicability in order to overcome existing chip microcontroller watchdog function, the invention provides and a kind ofly avoid adopting special chip, cost is low, applicability is good realizes the method for house dog with singlechip timer and resetting pin.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of method with singlechip timer and resetting pin realization house dog, described single-chip microcomputer built-in at least one be used for the timer that when program is not normally moved, single-chip microcomputer resetted, an output pin (P0) of single-chip microcomputer is connected with the resetting pin (RST) of single-chip microcomputer, and described resetting pin (RST) is connected described resistance (R1) ground connection with resistance (R1); A described output pin (P0) is the house dog control pin, and when single-chip microcomputer normally moves, the time of described timer constantly is reset; When single-chip microcomputer takes place when unusual, the time of timer can increase always, reaches the preset upper limit time when the time of timer, and the house dog control pin sends reset signal, and single-chip microcomputer is resetted.
Further, when program initialization, the value of house dog control pin is put 0, and the initial value and the preset upper limit time of timer are set.
Further again, reach the preset upper limit time when the time of timer, enter timer and interrupt, timer interrupt program is replaced into 1 with the value of house dog control pin by 0, and the value of resetting pin (RST) is 1 simultaneously, and single-chip microcomputer is reset.
The initial value of described timer is 0.
Described timer is at least two.Can select the quantity of timer according to the complicated process of the configuration of single-chip microcomputer and program.
The Standard resistance range of described resistance (R1) is 100 Ω~10K Ω.
Technical conceive of the present invention is: one or more timers of use singlechip are used as the timer of house dog, take the control pin of an output pin of single-chip microcomputer as house dog specially.If single-chip microcomputer runs well, timer time can constantly be reset; If single-chip microcomputer takes place unusual, the time of timer then can increase always, and when timer arrived Preset Time, control pin sent reset signal, and single-chip microcomputer is resetted, thereby realizes watchdog function.
P0 is the control pin of house dog, and single-chip microcomputer is made as 0 after starting, and the value of RST is 0, does not influence the normal operation of single-chip microcomputer.The timer of single-chip microcomputer just begins to start after configuring initial value, the time of timer is provided with the time that is greater than program loop, opens timer and interrupts, and each circulation of master routine is reset to the value of timer at the beginning, it is the feeding of house dog, if program fleet can not be reset to timer, then when timer time arrives, entering timer interrupts, the value of P0 is changed to 1, thereby single-chip microcomputer is resetted, return to original state and rerun.
Beneficial effect of the present invention mainly shows: 1, do not need external chip and complicated circuit can realize watchdog function, and the normal operation of protection system, circuit is simple; 2, cost is low; 3, can be applicable to that some does not have the single-chip microcomputer application scenario of watchdog chip.
Description of drawings
Fig. 1 is a schematic diagram of realizing watchdog function.
Fig. 2 is the process flow diagram of Single Chip Microcomputer (SCM) program.
Embodiment
Below in conjunction with accompanying drawing the present invention is further described.
See figures.1.and.2, a kind of method with singlechip timer and resetting pin realization house dog, described single-chip microcomputer built-in at least one be used for the timer that when program is not normally moved, single-chip microcomputer resetted, an output pin P0 of single-chip microcomputer is connected with the resetting pin RST of single-chip microcomputer, and described resetting pin RST is connected described resistance R 1 ground connection with resistance R 1; A described output pin P0 is the house dog control pin, and when single-chip microcomputer normally moves, the time of described timer constantly is reset; When single-chip microcomputer takes place when unusual, the time of timer can increase always, reaches the preset upper limit time when the time of timer, and the house dog control pin sends reset signal, and single-chip microcomputer is resetted.
When program initialization, the value of house dog control pin is put 0, and the initial value and the preset upper limit time of timer are set.The initial value of described timer is 0.Described timer is at least two.Can select the quantity of timer according to the complicated process of the configuration of single-chip microcomputer and program.
Reach the preset upper limit time when the time of timer, enter timer and interrupt, timer interrupt program is replaced into 1 with the value of house dog control pin by 0, and the value of resetting pin (RST) is 1 simultaneously, and single-chip microcomputer is reset.
The Standard resistance range of described resistance (R1) is 100 Ω~10K Ω.
Among Fig. 1, the output pin P0 of single-chip microcomputer U1 is connected to above the resetting pin RST of self, again by resistance R 1 ground connection.Before single-chip microcomputer starts, RST ground connection, value is 0, single-chip microcomputer can normally start.Value with P0 when program initialization is changed to 0, use at least one timer of single-chip microcomputer to be used for the use of house dog, set the initial value and the preset value of timer, preferably initial value is made as 0, preset value is made as the maximal value of timer, here can use a plurality of timers to be used for increasing time of WatchDog Timer, select the quantity of timer according to the complexity of the configuration of single-chip microcomputer and program.At the beginning the initial value of timer being reset of each program loop, if program is normally moved like this, can or not trigger timer and interrupt less than preset value the working time of timer always, program circular flow is always gone down; Cause program fleet if run into special circumstances, because timer is to adopt independent circuits, can not be affected, timer time can increase always, when reaching preset value, enters timer and interrupts.In timer interrupt program, the value of P0 is set to 1, and the value of RST is 1, and single-chip microcomputer is reset, and program is restarted operation.
In order to further specify concrete enforcement of the present invention, the idiographic flow of Single Chip Microcomputer (SCM) program is done detailed description according to process flow diagram shown in Figure 2.
Step 1, initialization single-chip microcomputer timer, the initial value of timer is made as 0, and preset value is made as the timer maximal value.
Step 2, output pin P0 value is 0.
Step 3 is opened global interrupt and timer and is interrupted, and starts timer.
Step 4, the initial value of replacement timer.
Step 5, the working procedure main body.
Step 6 skips to step 4.
If the forbidding watchdog function only need be changed to 0 with P0, the value of not going to change P0 gets final product.
Claims (6)
1. method that realizes house dog with singlechip timer and resetting pin, it is characterized in that: described single-chip microcomputer built-in at least one be used for the timer that when program is not normally moved, single-chip microcomputer resetted, an output pin (P0) of single-chip microcomputer is connected with the resetting pin (RST) of single-chip microcomputer, and described resetting pin (RST) is connected described resistance (R1) ground connection with resistance (R1); A described output pin (P0) is the house dog control pin, and when single-chip microcomputer normally moves, the time of described timer constantly is reset; When single-chip microcomputer takes place when unusual, the time of timer can increase always, reaches the preset upper limit time when the time of timer, and the house dog control pin sends reset signal, and single-chip microcomputer is resetted.
2. the method with singlechip timer and resetting pin realization house dog as claimed in claim 1 is characterized in that: when program initialization, the value of house dog control pin is put 0, and the initial value and the preset upper limit time of timer are set.
3. the method with singlechip timer and resetting pin realization house dog as claimed in claim 2, it is characterized in that: reach the preset upper limit time when the time of timer, entering timer interrupts, timer interrupt program is replaced into 1 with the value of house dog control pin by 0, the value of resetting pin (RST) is 1 simultaneously, and single-chip microcomputer is reset.
4. the method with singlechip timer and resetting pin realization house dog as claimed in claim 2, it is characterized in that: the initial value of described timer is 0.
5. the method with singlechip timer and resetting pin realization house dog as claimed in claim 2, it is characterized in that: described timer is at least two.
6. realize the method for house dog as one of claim 1~5 is described with singlechip timer and resetting pin, it is characterized in that: the Standard resistance range of described resistance (R1) is 100 Ω~10K Ω.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010101675152A CN101833480B (en) | 2010-05-11 | 2010-05-11 | Method for realizing watchdog by using timer and resetting pin of singlechip |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010101675152A CN101833480B (en) | 2010-05-11 | 2010-05-11 | Method for realizing watchdog by using timer and resetting pin of singlechip |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101833480A true CN101833480A (en) | 2010-09-15 |
CN101833480B CN101833480B (en) | 2012-07-25 |
Family
ID=42717557
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2010101675152A Expired - Fee Related CN101833480B (en) | 2010-05-11 | 2010-05-11 | Method for realizing watchdog by using timer and resetting pin of singlechip |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101833480B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102050363A (en) * | 2010-12-22 | 2011-05-11 | 重庆伊士顿电梯有限责任公司 | High-rise elevator control master command board and control method thereof |
CN103324546A (en) * | 2013-06-25 | 2013-09-25 | 杭州华三通信技术有限公司 | Watchdog service delay method and device |
CN103580941A (en) * | 2012-08-01 | 2014-02-12 | 研祥智能科技股份有限公司 | Network watchdog and implementation method thereof |
CN114333282A (en) * | 2022-02-10 | 2022-04-12 | 上海集嘉同速汽车科技有限公司 | Pedal signal redundancy transmission device and control method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060053349A1 (en) * | 2004-09-09 | 2006-03-09 | Oki Electric Industry Co., Ltd. | Microcomputer with watchdog timer generating internal and external reset signals |
CN101079002A (en) * | 2007-07-03 | 2007-11-28 | 广东省环境保护监测中心站 | Detection type computer operation monitoring device and its monitoring method |
CN101344862A (en) * | 2008-09-01 | 2009-01-14 | 华为技术有限公司 | Anti-interference equipment of embedded system |
-
2010
- 2010-05-11 CN CN2010101675152A patent/CN101833480B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060053349A1 (en) * | 2004-09-09 | 2006-03-09 | Oki Electric Industry Co., Ltd. | Microcomputer with watchdog timer generating internal and external reset signals |
CN101079002A (en) * | 2007-07-03 | 2007-11-28 | 广东省环境保护监测中心站 | Detection type computer operation monitoring device and its monitoring method |
CN101344862A (en) * | 2008-09-01 | 2009-01-14 | 华为技术有限公司 | Anti-interference equipment of embedded system |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102050363A (en) * | 2010-12-22 | 2011-05-11 | 重庆伊士顿电梯有限责任公司 | High-rise elevator control master command board and control method thereof |
CN102050363B (en) * | 2010-12-22 | 2013-08-28 | 重庆伊士顿电梯有限责任公司 | High-rise elevator control master command board and control method thereof |
CN103580941A (en) * | 2012-08-01 | 2014-02-12 | 研祥智能科技股份有限公司 | Network watchdog and implementation method thereof |
CN103580941B (en) * | 2012-08-01 | 2018-01-30 | 研祥智能科技股份有限公司 | Network watchdog and its implementation |
CN103324546A (en) * | 2013-06-25 | 2013-09-25 | 杭州华三通信技术有限公司 | Watchdog service delay method and device |
CN103324546B (en) * | 2013-06-25 | 2016-12-28 | 杭州华三通信技术有限公司 | A kind of method and device of watchdog service delay |
CN114333282A (en) * | 2022-02-10 | 2022-04-12 | 上海集嘉同速汽车科技有限公司 | Pedal signal redundancy transmission device and control method |
Also Published As
Publication number | Publication date |
---|---|
CN101833480B (en) | 2012-07-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101833480B (en) | Method for realizing watchdog by using timer and resetting pin of singlechip | |
CN103105915A (en) | Intelligent terminal reset method and intelligent terminal reset system | |
CN102306132A (en) | Mobile terminal and method for waking up mobile terminal | |
CN107111526A (en) | Watchdog timer | |
CN104750568A (en) | Abnormal forced resetting type watchdog circuit of microcontroller | |
CN102339239B (en) | Watchdog circuit with automatic switch-off function | |
CN104503857A (en) | Computer startup management control system | |
CN102866928A (en) | Watchdog circuit with power supply managing function | |
CN207115391U (en) | A kind of automatic reset circuit | |
CN104750567A (en) | Watchdog reset method based on FPGA | |
CN104101100B (en) | Water heater and control method thereof | |
CN206058183U (en) | Microcontroller | |
CN206432968U (en) | A anti-single chip microcomputer halt circuit | |
CN205910667U (en) | Multi -processor control circuit that resets | |
CN102270028B (en) | Automatic Loongson mainboard resetting device based on field programmable gate array (FPGA) | |
CN104572331A (en) | Monitoring module with power monitoring and electrifying delay enable | |
CN104333359B (en) | Restart protection circuit suitable for the microprocessing systems many condition of Intelligent bracelet | |
CN202632277U (en) | Watchdog with data communication function | |
CN102880480A (en) | Method for updating application program of intelligent water meter on line | |
CN203386143U (en) | Remote machine reset device | |
CN203350646U (en) | Automatic downloading device of single-chip microcomputer | |
CN202615379U (en) | Watchdog resetting circuit | |
CN204131480U (en) | The microprocessing systems many condition being applicable to Intelligent bracelet restarts protective circuit | |
CN203849730U (en) | Watchdog circuit of electronic system | |
CN207817678U (en) | A kind of configurable watchdog circuit for resetting duration and timing length |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120725 Termination date: 20170511 |