JPH04106639A - Watch dog performing method for system using cpu - Google Patents

Watch dog performing method for system using cpu

Info

Publication number
JPH04106639A
JPH04106639A JP2224926A JP22492690A JPH04106639A JP H04106639 A JPH04106639 A JP H04106639A JP 2224926 A JP2224926 A JP 2224926A JP 22492690 A JP22492690 A JP 22492690A JP H04106639 A JPH04106639 A JP H04106639A
Authority
JP
Japan
Prior art keywords
cpu
value
timer
interrupt
processing
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.)
Pending
Application number
JP2224926A
Other languages
Japanese (ja)
Inventor
Masanori Okuda
奥田 匡則
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP2224926A priority Critical patent/JPH04106639A/en
Publication of JPH04106639A publication Critical patent/JPH04106639A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To prevent the occurrence of a fatal accident in a system caused by the run-out-of-control of a CPU without using any IC for watch dog by making the CPU to make an illegal process by using the value of an internal counter in an interrupting process and setting the internal counter to its initial value at every ordinary processing cycle of the CPU. CONSTITUTION:An interrupting process is actuated by the interrupt of an internal (external) timer 12 and the value of a software timer set in a system RAM 13 is read. When the value of the software timer is not '0', the interrupting process is terminated by decreasing the value of the software timer. When the value of the software timer is '0', a CPU 11 terminates the interrupting process by performing an illegal process. In addition, the software timer is set to its initial value at every one cycle of a main processing routine. Therefore, the occurrence of a fatal accident in the system caused by the run-out-of- control of the CPU can be prevented without using any IC for watch dog.

Description

【発明の詳細な説明】 [産業上の利用分野] この発明はCPUを用いたシステムにおけるウォッチド
ッグの実施方法に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a method of implementing a watchdog in a system using a CPU.

[従来技術] 第4図は従来のウォッチドッグの実施方法を示すブロッ
ク図である。
[Prior Art] FIG. 4 is a block diagram showing a conventional method of implementing a watchdog.

CPU41はウォッチドッグタイマ(減算カウンタ)4
2に接続されている。また、CPU41とウォッチドッ
グタイマ42には各々クロックCLKが入力されている
。ウォッチドッグタイマ42は1クロツク毎にタイマ値
を1づつデクリメントする。
The CPU 41 has a watchdog timer (subtraction counter) 4
Connected to 2. Further, a clock CLK is input to each of the CPU 41 and the watchdog timer 42. The watchdog timer 42 decrements the timer value by 1 every clock.

第5図は従来のウォッチドッグの実施方法を有するCP
Uシステムのメイン処理ルーチンを示すフローチャート
、第6図は割込み処理を示すフローチャートである。メ
イン処理ルーチンにおいて、1サイクル、即ち処理A、
B、Cの終了ごとにウォッチドッグタイマ42が初期値
にセットされるプログラムが設けられている(ステップ
5゜1)。いま、ウォッチドッグタイマのカウント時間
をtl、メイン処理ルーチンの最大処理時間をt、とす
ると、1.、< 1 、となるようにウォッチドッグタ
イマ42のカウント時間をセットすると、CPU41が
正常に動作しソフトウェアの処理が正常な場合には、ウ
ォッチドッグタイマ42はCPU41に対して何ら影響
を与えない。しかし、ソフトウェアの処理上で何らかの
異常、例えば暴走等が起こった場合、メイン処理ルーチ
ンの処理時間が長くなり、ウォッチドッグタイマ42の
カウント時間を越えてしまう。このとき、ウォッチドッ
グタイマ42の値はOとなり、ウォッチドッグタイマ4
2はCPU41に割込みをかける。割込み処理において
、イリーガル処理(ステップ601)が行なわる。ここ
でイリーガル処理とは異常を検知した場合にCPUを正
常動作に戻し、または外部に異常を通知し、または動作
を停止する処理の総称をいう。
Figure 5 shows a CP with a conventional watchdog implementation method.
FIG. 6 is a flowchart showing the main processing routine of the U system, and FIG. 6 is a flowchart showing interrupt processing. In the main processing routine, one cycle, that is, processing A,
A program is provided in which the watchdog timer 42 is set to an initial value each time B and C end (step 5.1). Now, if the count time of the watchdog timer is tl, and the maximum processing time of the main processing routine is t, then 1. , < 1. If the CPU 41 operates normally and the software processing is normal, the watchdog timer 42 has no effect on the CPU 41. However, if some abnormality occurs in the software processing, such as a runaway, the processing time of the main processing routine becomes longer and exceeds the count time of the watchdog timer 42. At this time, the value of the watchdog timer 42 becomes O, and the value of the watchdog timer 42 becomes O.
2 interrupts the CPU 41. In the interrupt processing, illegal processing (step 601) is performed. Here, illegal processing is a general term for processing that returns the CPU to normal operation, notifies the outside of the CPU, or stops the operation when an abnormality is detected.

[発明が解決しようとする課題] しかしながら、上記従来の方法では、必ずウォッチドッ
グ用ICが必要であり、ハードウェア上構成が複雑化す
るという問題点があった。また、ウォッチドッグタイマ
を使用しない場合には、CPUの暴走によるシステムの
致命的な事故を防ぐことが困難であるという問題点があ
った。
[Problems to be Solved by the Invention] However, the conventional method described above always requires a watchdog IC, which has the problem of complicating the hardware configuration. Furthermore, when the watchdog timer is not used, there is a problem in that it is difficult to prevent a fatal system accident due to a runaway CPU.

本発明は、上記問題点に鑑みてなされたもので、ウォッ
チドッグ用ICを用いることなく、CPUの暴走による
システムの致命的な事故を未然に防ぐことが可能なCP
Uを用いたシステムにおけるウォッチドッグの実施方法
を提供することを目的とする。
The present invention has been made in view of the above problems, and is a CPU that can prevent fatal system accidents caused by CPU runaway without using a watchdog IC.
The purpose of this paper is to provide a method for implementing a watchdog in a system using U.

[課題を解決するための手段] 上記課題を解決するために本発明はCPUと記憶装置を
具備するCPUを用いたシステムにおいて、 CPUの内部又は外部タイマにより割込みをかける割込
み手段と、 該割込み手段による割込みによって減算される内部カウ
ンタを有し、 前記割込みによる割込み処理において前記内部カウンタ
の値によって、CPUのイリーガル処理を行ない、CP
Uの通常の処理1サイクルごとに前記内部カウンタを初
期値にセットすることを特徴とするものである。
[Means for Solving the Problems] In order to solve the above problems, the present invention provides a system using a CPU that includes a CPU and a storage device, and includes: an interrupt means for generating an interrupt by an internal or external timer of the CPU; and the interrupt means. has an internal counter that is decremented by an interrupt caused by the interrupt, and in the interrupt processing caused by the interrupt, illegal processing of the CPU is performed according to the value of the internal counter, and the CPU
The present invention is characterized in that the internal counter is set to an initial value every cycle of normal processing of U.

[作用コ CPUを用いたシステムにおけるウォッチドッグの実施
方法を上記のような構成とすることにより内部カウンタ
をウォッチドッグタイマとして用い、割込み処理におい
て内部カウンタの値がOでないときは該内部カウンタを
デクリメントし、内部カウンタの値がOであるときは、
イル−ガル処理を行ない、また、メイン処理ルーチン1
サイクルごとに、内部カウンタを初期値にセットするよ
うにしたので、ハードウェアとしてウォッチドッグ用I
Cを用いることなくウォッチドッグが実施できることと
なる。
[Action] By configuring the watchdog implementation method in a system using a CPU as described above, an internal counter is used as a watchdog timer, and when the value of the internal counter is not O during interrupt processing, the internal counter is decremented. However, when the value of the internal counter is O,
Performs illegal processing, and also executes main processing routine 1.
Since the internal counter is set to the initial value every cycle, the watchdog interface can be used as hardware.
This means that the watchdog can be implemented without using C.

[実施例コ 以下、本発明の実施例を図面に基づいて説明する。[Example code] Embodiments of the present invention will be described below based on the drawings.

第1図は本発明に係るウォッチドッグの実施方法を有す
るCPUを用いたシステムの一実施例を示すブロック図
である。
FIG. 1 is a block diagram showing an embodiment of a system using a CPU having a watchdog implementation method according to the present invention.

内部(外部)タイマはCPUI 2の割込み(INTI
)端子に接続され、一定周期毎にCPUI2に割込みを
かける。
The internal (external) timer is activated by CPUI 2 interrupt (INTI).
) terminal and interrupts the CPUI2 at regular intervals.

第2図は本発明に係るCPUを用いたシステムの割込み
処理を示すフローチャートである。割込み処理は、内部
(外部)タイマ120割込みによって起動され、システ
ムRAM13上に設定きれているソフトウェアタイマの
値を読む(ステップ201)。ソフトウェアタイマの値
がOでなければ、ソフトウェア、タイマの値をデクリメ
ントして(ステップ203)、割込み処理を終了する(
ステップ204)。
FIG. 2 is a flowchart showing interrupt processing of a system using a CPU according to the present invention. Interrupt processing is started by an internal (external) timer 120 interrupt, and reads the value of the software timer that has been set on the system RAM 13 (step 201). If the software timer value is not O, the software decrements the timer value (step 203) and ends the interrupt processing (
Step 204).

ソフトウェアタイマの値が0であった場合、CPUII
はイリーガル処理を行ない(ステップ205)割込み処
理を終了する(ステップ206)。内部(外部)タイマ
12の周期的な割込みによって割込み処理は繰り返きれ
る。
If the software timer value is 0, the CPU II
performs illegal processing (step 205) and ends the interrupt processing (step 206). Interrupt processing is repeated by periodic interrupts from the internal (external) timer 12.

第3図は本発明に係るCPUを用いたシステムのメイン
処理ルーチンを示すフローチャートである。一連の通常
の処理、例えば処理A−C(ステップ301〜303)
が終了すると、ソフトウェアタイマの値を初期値にセ・
/卜する処理が行なわれる(ステップ304)。ここで
、ソフトウェアタイマの初期値は、該ソフトウェアのカ
ウント時間をto、メイン処理ルーチンの最大処理時間
をt。とすると、to<t+となるように設定きれた値
である。なお、内部(外部)タイマ12による割込み処
理の周期は、t、、t、と比較して充分に小さい値であ
る。
FIG. 3 is a flowchart showing the main processing routine of a system using a CPU according to the present invention. A series of normal processes, e.g. processes A-C (steps 301-303)
When the software timer is finished, the value of the software timer is set to the initial value.
/Display processing is performed (step 304). Here, the initial value of the software timer is the count time of the software to, and the maximum processing time of the main processing routine t. This is a value that can be set so that to<t+. Note that the period of interrupt processing by the internal (external) timer 12 is a sufficiently small value compared to t, , t.

−Jの通常の処理(ステップ301〜303)が誤りな
く行なわれている場合、メイン処理ルーチン1サイクル
毎に、ソフトウェアタイマに初期値がセットされるため
、ソフトウェアタイマの値が0となることはなく、従っ
て割込み処理においてイリーガル処理は行なわれずCP
U11の動作に影響を与えない。
If the normal processing of -J (steps 301 to 303) is performed without error, the initial value is set to the software timer every cycle of the main processing routine, so the value of the software timer will never become 0. Therefore, illegal processing is not performed in interrupt processing and CP
Does not affect the operation of U11.

しかし、メイン処理ルーチンで異常が起き、CFULL
が暴走状態に陥ると、ソフトウェアタイマは初期値にセ
ットされず、また割込み処理においてデクリメントされ
続けるため、ソフトウェアタイマのタイマ値がOとなる
。このとき内部(外部)タイマ12による割込みがあっ
た場合に割込み処理においてイリーガル処理が行なわれ
、CPU1lが正常な状態に戻される・ [発明の効果] 以上、説明したように本発明によれば、CPUを用いた
システムにおいて、内部カウンタをウォッチドッグタイ
マとして用い、割込み処理において内部カウンタの値が
Oでないときは内部カウンタをデクリメントし、内部カ
ウンタの値が0であるときは、イル−ガル処理を行ない
、また、メイン処理ルーチン1サイクルごとにソフトウ
ェアタイマを初期値にセットする構造にしたため、ハー
ドウェアとしてウォッチドッグ用ICを用いることなく
シンプルな回路構成でウォッチドッグを実施することが
できるという優れた効果が得られる。
However, an error occurred in the main processing routine and CFULL
When the software timer goes out of control, the software timer is not set to its initial value and continues to be decremented during interrupt processing, so the timer value of the software timer becomes O. At this time, if there is an interrupt by the internal (external) timer 12, illegal processing is performed in the interrupt processing, and the CPU 11 is returned to a normal state. [Effects of the Invention] As described above, according to the present invention, In a system using a CPU, an internal counter is used as a watchdog timer, and when the internal counter value is not O during interrupt processing, the internal counter is decremented, and when the internal counter value is 0, illegal processing is performed. In addition, since the software timer is structured to be set to the initial value every cycle of the main processing routine, the watchdog can be implemented with a simple circuit configuration without using a watchdog IC as hardware. Effects can be obtained.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明に係るウォッチドッグの実施方法を有す
るCPUを用いたシステムの一実施例を示すブロック図
、第2図は本発明に係るCPUを用いたシステムの割込
み処理を示すフローチャート、第3図は本発明に係るC
PUを用いたシステムのメイン処理ルーチンを示すフロ
ーチャート、第4図は従来のウォッチドッグの実施方法
を示すブロック図、第5図は従来のウォッチドッグの実
施方法を有するCPUを用いたシステムのメイン処理ル
ーチンを示すフローチャート、第6図は割込み処理を示
すフローチャートである。 図中、11・・・・・・CPU、12・・・・・・内部
(外部)タイマ、13・・・・・・システムRAM。 JJ!aQt・トオ・)ヤス・/手トー/′7り亥オi
乃へ゛♂λ・号フ゛口・7n特許出願人  沖電気工業
株式会社 代理人 弁理士 熊谷 隆(外1名) 末腎?tl)督19鼾ガff1.ホ1フロー斗τ−ト第
2図 木9Ev4(:任うメ4ン〃理ルーチンiオ、η)p+
マート 領禾のウォッチ)゛ツフ゛I)亥方色ガ式°に^170
1フω第4図 第5図
FIG. 1 is a block diagram showing an embodiment of a system using a CPU having a watchdog implementation method according to the present invention, FIG. 2 is a flowchart showing interrupt processing of a system using a CPU according to the present invention, Figure 3 shows C according to the present invention.
A flowchart showing the main processing routine of a system using a PU, Fig. 4 is a block diagram showing a conventional method of implementing a watchdog, and Fig. 5 shows a main processing of a system using a CPU having a conventional method of implementing a watchdog. A flowchart showing the routine, and FIG. 6 is a flowchart showing interrupt processing. In the figure, 11...CPU, 12...Internal (external) timer, 13...System RAM. JJ! aQt・Too・) Yasu・/Teto/'7 Rihai i
Nohe゛♂λ・No. Fukuchi・7n Patent applicant Oki Electric Industry Co., Ltd. Representative Patent attorney Takashi Kumagai (1 other person) End kidney? tl) Kan 19 snoring ff1. Figure 2 Tree 9Ev4 (: Assignment menu iO, η) p+
Mart's watch)
1f ω Fig. 4 Fig. 5

Claims (1)

【特許請求の範囲】 CPUと記憶装置を具備するCPUを用いたシステムに
おいて、 CPUの内部又は外部タイマにより割込みをかける割込
み手段と、 該割込み手段による割込みによって減算される内部カウ
ンタを有し、 前記割込みによる割込み処理において前記内部カウンタ
の値によって、CPUのイリーガル処理を行ない、CP
Uの通常の処理1サイクルごとに前記内部カウンタを初
期値にセットすることを特徴とするCPUを用いたシス
テムにおけるウォッチドッグの実施方法。
[Scope of Claims] A system using a CPU comprising a CPU and a storage device, comprising an interrupt means for generating an interrupt by an internal or external timer of the CPU, and an internal counter that is decremented by an interrupt by the interrupt means, In interrupt processing due to an interrupt, CPU illegal processing is performed according to the value of the internal counter, and the CPU
A method for implementing a watchdog in a system using a CPU, characterized in that the internal counter is set to an initial value every cycle of normal processing of U.
JP2224926A 1990-08-27 1990-08-27 Watch dog performing method for system using cpu Pending JPH04106639A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2224926A JPH04106639A (en) 1990-08-27 1990-08-27 Watch dog performing method for system using cpu

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2224926A JPH04106639A (en) 1990-08-27 1990-08-27 Watch dog performing method for system using cpu

Publications (1)

Publication Number Publication Date
JPH04106639A true JPH04106639A (en) 1992-04-08

Family

ID=16821338

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2224926A Pending JPH04106639A (en) 1990-08-27 1990-08-27 Watch dog performing method for system using cpu

Country Status (1)

Country Link
JP (1) JPH04106639A (en)

Similar Documents

Publication Publication Date Title
US4405982A (en) Arrangement for monitoring the function of a programmable electronic switching circuit
JPH04106639A (en) Watch dog performing method for system using cpu
JPS5920061A (en) Watchdog timer
JPH01246602A (en) Special function unit for programmable controller
JPS5911424A (en) Processing circuit of interruption signal
JPH03208137A (en) Abnormality detection system for control microcomputer
JPS5916054A (en) Microprocessor
JPH01293449A (en) Watch dog timer
JPH0531773B2 (en)
JPS62205441A (en) Microcomputer
JPS5835291B2 (en) Automatic reset device for microprocessor runaway
JP2814587B2 (en) Watchdog timer
JPH0421139A (en) Runaway processing method for microcomputer
JPH01154258A (en) Malfunction detecting device using watchdog timer
JPH01263740A (en) Micro-computer
JPS59148961A (en) Monitoring system of operation of processor
JPS63316146A (en) Microcomputer
JPS60183647A (en) Watchdog timer
JPH04182743A (en) Restarting method for microprocessor
JPS6349855A (en) Detecting device for interruption cycle abnormality of cpu
JPH02224053A (en) Monitoring system for input time of terminal
JPS63282858A (en) System for preventing program runaway
JPH04270441A (en) Data processor
JPS6214235A (en) Information processor
JPH04225432A (en) Interruption processing time control system for one-chip microcomputer