JPH05204715A - Watchdog timer circuit - Google Patents

Watchdog timer circuit

Info

Publication number
JPH05204715A
JPH05204715A JP4206459A JP20645992A JPH05204715A JP H05204715 A JPH05204715 A JP H05204715A JP 4206459 A JP4206459 A JP 4206459A JP 20645992 A JP20645992 A JP 20645992A JP H05204715 A JPH05204715 A JP H05204715A
Authority
JP
Japan
Prior art keywords
time
program
processing
bit
shortest
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
JP4206459A
Other languages
Japanese (ja)
Inventor
Takahito Yamagishi
孝仁 山岸
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP4206459A priority Critical patent/JPH05204715A/en
Publication of JPH05204715A publication Critical patent/JPH05204715A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To detect whether the processing time of a program is within set time or not. CONSTITUTION:With the start of a program processing, a bit SWP is set to show a state under processing, and a counter RW is started. A shortest/longest set time code is decoded from the operand of an instruction code by an instruction decoder DISR and a decoder DSLC and shortest set time TS is set to a processing time range setting register RSL. When the bit S is fallen before the lapse of the shortest set time TS, an detection circuit DSF detects the state of a bit FSL and detects that the program is abnormality early finished. When the bit S is fallen before the lapse of longest set time TL, the fall detection circuit DSF detects the state of the bit FSL and detects that the program is normally finished.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、マイクロコンピュータ
またはマイクロプロセッサに内蔵され、プログラムの暴
走を検出するためのウォッチドッグタイマ回路に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a watchdog timer circuit incorporated in a microcomputer or a microprocessor for detecting runaway of a program.

【0002】[0002]

【従来の技術】マイクロコンピュータまたはマイクロプ
ロセッサにおいては、ウォッチドッグタイマを用いてプ
ログラムやハードウェアの暴走や異常等を検出すること
が行われている。
2. Description of the Related Art In a microcomputer or a microprocessor, a watchdog timer is used to detect runaway or abnormality of a program or hardware.

【0003】ウォッチドッグタイマは、プログラムの処
理中、一定時間経過すると割り込みを起こし、そのとき
のプログラムの処理状態を監視する。正常な場合には、
プログラムは一定時間経過前に終了し、一定時間に達す
る前にウォッチドッグタイマはリセットされる。
The watchdog timer causes an interrupt when a certain time elapses during the processing of the program, and monitors the processing state of the program at that time. If normal,
The program ends before the fixed time elapses, and the watchdog timer is reset before the fixed time is reached.

【0004】そして、一定時間を経過してもプログラム
が処理中であると、ウォッチドッグタイマにより異常と
判定され、異常信号が発生する。
If the program is still being processed even after the elapse of a certain time, the watchdog timer determines that the program is abnormal and an abnormal signal is generated.

【0005】他のウォッチドッグタイマ回路としては、
図5に示す特開昭55−57956号公報のものがあ
る。図中、1はマイクロコンピュータ、2は中央処理装
置(CPU)、3はメモリー、4は入出力インターフェ
ース(I/O)、5はデータバス、6はアドレスバス、
7はコントロールバス、8は被制御機器、9は監視回
路、10は警報回路、11はリセット回路である。
As another watchdog timer circuit,
There is one disclosed in JP-A-55-57956 shown in FIG. In the figure, 1 is a microcomputer, 2 is a central processing unit (CPU), 3 is a memory, 4 is an input / output interface (I / O), 5 is a data bus, 6 is an address bus,
Reference numeral 7 is a control bus, 8 is a controlled device, 9 is a monitoring circuit, 10 is an alarm circuit, and 11 is a reset circuit.

【0006】これは、マイクロコンピュータの出力端子
からプログラムに従い所定範囲の周期の連続パルスを出
力し、この連続パルスの有無によってプログラムが正常
に実行されているかどうかを監視して、ノイズなどによ
る誤動作等でプログラムが異常になった場合を検知して
いた。
This is because a continuous pulse having a predetermined range of cycles is output from an output terminal of a microcomputer according to a program, and whether or not the program is normally executed is monitored depending on the presence or absence of the continuous pulse to cause a malfunction due to noise or the like. Was detecting when the program became abnormal.

【0007】[0007]

【発明が解決しようとする課題】しかしながら、前者の
場合、プログラム処理が異常で、正規の処理時間より短
い時間で終了した場合、一定時間経過前に終了している
ため、異常であると判定されない。
However, in the former case, if the program processing is abnormal and is completed in a time shorter than the regular processing time, it is not judged to be abnormal because it is completed before the elapse of a certain time. ..

【0008】また、後者の場合、プログラムの処理時間
範囲が設定できなかった。
In the latter case, the processing time range of the program could not be set.

【0009】本発明は、上記に鑑み、プログラムが暴走
した場合、処理時間が異常に長くなったときだけでな
く、処理時間が異常に短くなったときでも、その異常を
検出することができるウォッチドッグタイマ回路の提供
を目的とする。
In view of the above, the present invention is a watch capable of detecting an abnormality not only when the program runs out of control but also when the processing time becomes abnormally short, not only when the processing time becomes abnormally long. The purpose is to provide a dog timer circuit.

【0010】[0010]

【課題を解決するための手段】本発明請求項1による課
題解決手段は、図1,2の如く、プログラムの処理中で
あることを示すビットFF1を含む制御レジスタR
と、プログラムの処理開始と同時に計数を開始するカ
ウンタRと、プログラムの処理時間の最短時間T
設定する最短時間設定レジスタRと、プログラムの処
理時間の最長時間Tを設定する最長時間設定レジスタ
と、カウンタRのカウント値Tと最短時間設定
レジスタRの設定値Tあるいは最長時間設定レジス
タRの設定値Tをそれぞれ比較する比較回路
SW,CLWと、これらの比較によりカウンタR
カウント値Tと最短時間設定レジスタRあるいは最
長時間設定レジスタRの設定値T,Tが等しくな
ったとき、制御レジスタRのビットFF1の状態から
プログラムの処理状態を検出する検知回路Sとを備
え、最短設定時間経過時に処理中であるか否かを検知
し、最長設定時間を越えた時点で処理が終了しているか
否かを検知するものである。
The problem solving means according to claim 1 of the present invention is, as shown in FIGS. 1 and 2, a control register R including a bit FF1 indicating that a program is being processed.
C , a counter R W that starts counting at the same time as the start of processing of the program, a shortest time setting register R S that sets the shortest time T S of the processing time of the program, and a longest time T L of the processing time of the program comparator circuit C SW for comparing the longest time setting register R L, the counter R W of the count value T W and the shortest time setting register R S settings T S or maximum set value T L time setting register R L respectively, C When the count value T W of the counter R W and the set values T S and T L of the shortest time setting register R S or the longest time setting register R L become equal to each other by LW and these comparisons, the bit FF1 of the control register R C is set. provided from the state and the detection circuit S C for detecting the processing state of the program, detecting whether or not in process at the time elapsed shortest set time, the longest set Processing at the time of exceeding the time is to detect whether or not completed.

【0011】本発明請求項2〜4による課題解決手段
は、図3,4の如く、プログラムが格納されたROM
と、ROMからの命令コードをデコードするインストラ
クションデコーダーDISRと、プログラムが処理中であ
ることを示すフリップフロップのビットSWPと、インス
トラクションデコーダーDISRからのオペランドにより
最短設定時間と最長設定時間コードをデコードするデコ
ーダDSLCと、最長設定時間TLを一時保留しておく最長
設定時間保留レジスタRTLと、最短設定時間TSと最長
設定時間TLを切り替えるマルチプレクサMPXと、プロ
グラムの処理時間を計測するためのクロックCLKを入
力とするカウンタRWと、プログラム処理の最短設定時
間TSと最長設定時間TLを設定する処理時間範囲設定レ
ジスタRSLと、処理時間範囲設定レジスタRSLの内容が
最短設定時間TSか最長設定時間TLかを示すフリップフ
ロップのビットFSLと、カウンタRWのカウント値TW
処理時間範囲設定レジスタRSLの最短設定時間TSまた
は最長設定時間TLと一致しているか否かを検出する一
致検出回路CCと、プログラム処理中を示すビットSWP
の状態と一致検出回路CCにより異常を検知する一致時
異常検知回路EDCと、プログラム処理中を示すビットS
WPの立ち下がりを検知する立ち下がり検知回路DSFと、
立ち下がり検知回路DSFの出力と最短設定時間TSか最
長設定時間TLかを示すビットFSLの状態により異常を
検知する立ち下がり時異常検知回路FDCとを備え、最短
設定時間前に処理が終了したか否かを検知し、最長設定
時間前に処理が終了したか否かを検知するものである。
The problem solving means according to claims 2 to 4 of the present invention is a ROM storing a program as shown in FIGS.
, The instruction decoder D ISR that decodes the instruction code from the ROM, the bit SWP of the flip-flop that indicates that the program is being processed, and the operand from the instruction decoder D ISR determine the minimum set time and the maximum set time code. a decoder D SLC for decoding, and the longest set time pending register R TL to be suspended temporarily maximum setting time T L, a multiplexer M PX switching the shortest set time T S and the longest set time T L, the processing time of the program Contents of the counter R W that receives the clock CLK for measurement, the processing time range setting register R SL that sets the shortest setting time T S and the longest setting time T L of the program processing, and the processing time range setting register R SL And the bit F SL of the flip-flop indicating whether is the shortest set time T S or the longest set time T L A coincidence detection circuit C C for detecting whether match the counter R W count value T W and treatment time range setting register R SL shortest set time T S or maximum set time T L of the during program processing Indicates bit SWP
And the coincidence detection circuit E DC for detecting an abnormality by the coincidence detection circuit C C and the bit S indicating that the program is being processed.
A fall detection circuit D SF for detecting the fall of WP ,
The output of the fall detection circuit D SF and the fall abnormality detection circuit F DC that detects an abnormality according to the state of the bit F SL indicating the shortest set time T S or the longest set time T L are provided. It is to detect whether or not the processing is completed, and to detect whether or not the processing is completed before the longest set time.

【0012】[0012]

【作用】上記請求項1による課題解決手段において、プ
ログラム処理の最短時間と最長時間を最短時間設定レジ
スタR、最長時間設定レジスタRにそれぞれ設定し
ておく。プログラム処理のルーチンに入ると、処理中を
示すビットFF1をセット“1”し、ルーチンから出る
とリセット“0”する。
In the problem solving means according to claim 1, the shortest time and the longest time of the program processing are set in the shortest time setting register R S and the longest time setting register R L , respectively. When the program processing routine is entered, the bit FF1 indicating that processing is in progress is set to "1", and when the routine is exited, it is reset to "0".

【0013】最短設定時間経過時にビットFF1の状態
が“1”ならば正常であり、“0”ならば異常に早く処
理が終了したと判定する。
If the state of the bit FF1 is "1" when the shortest set time has elapsed, it is determined to be normal, and if the state is "0", it is determined that the processing is completed abnormally early.

【0014】最長設定時間経過後にビットFF1の状態
が“0”ならば正常であり、“1”ならばプログラムが
暴走して異常に処理時間が長くなっていると判定する。
If the state of the bit FF1 is "0" after the elapse of the longest set time, it is normal, and if it is "1", it is determined that the program has run away and the processing time is abnormally long.

【0015】請求項2〜4による課題解決手段におい
て、プログラム処理が始まると処理中であることを示す
ビットSWPをセットすると同時にカウンタRWがスター
トし、インストラクションデコーダーDISRによりRO
Mの命令コードから解読された最短・最長設定時間コー
ドがデコーダーDSLCでデコードされ、最短設定時間TS
が処理時間範囲設定レジスタRSLに設定される。
[0015] In SUMMARY by claims 2 to 4, starting at the same time the counter R W Setting bit S WP indicating that it is processing the program processing is started, RO by instruction decoder D ISR
The shortest and longest set time code decoded from the M instruction code is decoded by the decoder D SLC , and the shortest set time T S
Is set in the processing time range setting register R SL .

【0016】その後、最短設定時間TSより前に処理中
を示すビットSWPが立ち下がった場合、処理時間範囲設
定レジスタRSLに最短または最長設定時間が設定されて
いることを示すビットFSLの状態を検出し、最短時間T
Sが設定されているならば、プログラムが異常に早く終
了したことを検知する。
[0016] Then, when the fall of the bit S WP indicating that a processed before a shortest set time T S, the processing time range setting register R SL indicates that the minimum or maximum set time is set to the bit F SL State is detected and the shortest time T
If S is set, detect that the program terminated abnormally early.

【0017】カウンタRWと最短設定時間TSが一致する
と、最長設定時間TLが処理時間範囲設定レジスタRSL
に設定される。そして、最長設定時間TLより前に処理
中を示すビットSWPが立ち下がった場合、処理時間範囲
設定レジスタRSLに最短または最長設定時間が設定され
ていることを示すビットFSLの状態を検出し、最長時間
Lが設定されているならば、プログラムが正常に終了
したことを検知する。
When the counter R W and the shortest set time T S match, the longest set time T L becomes the processing time range setting register R SL.
Is set to. Then, when the bit S WP indicating that the process before the maximum setting time T L falls, the state of the bit F SL that indicates that minimum or maximum set time to the processing time range setting register R SL is set If the maximum time T L is set, it is detected that the program has ended normally.

【0018】[0018]

【実施例】【Example】

(第一実施例)図1は本発明の第一実施例を示すウォッ
チドッグタイマ回路のブロツク図、図2はプログラムが
正常作動時および異常作動時におけるウォッチドッグタ
イマ回路内の信号波形図である。
(First Embodiment) FIG. 1 is a block diagram of a watchdog timer circuit showing a first embodiment of the present invention, and FIG. 2 is a signal waveform diagram in the watchdog timer circuit during normal operation and abnormal operation of a program. ..

【0019】本実施例のウォッチドッグタイマ回路は、
プログラムの処理中であることを示すビットFF1を含
む制御レジスタRと、プログラムの処理開始と同時に
計数を開始するカウンタRと、プログラムの処理時間
の最短時間Tを設定する最短時間設定レジスタR
と、プログラムの処理時間の最長時間Tを設定する
最長時間設定レジスタRと、カウンタRのカウント
値Tと最短時間設定レジスタRの設定値Tあるい
は最長時間設定レジスタRの設定値Tをそれぞれ比
較する比較回路CSW,CLWと、これらの比較により
カウンタRのカウント値Tと最短時間設定レジスタ
あるいは最長時間設定レジスタRの設定値T
が等しくなったとき、制御レジスタRのビットF
F1の状態からプログラムの処理状態を検出する検知回
路Sとを備えている。
The watchdog timer circuit of this embodiment is
A control register R C including a bit FF1 indicating that the program is being processed, a counter R W that starts counting at the same time as the start of the program processing, and a shortest time setting register that sets the shortest time T S of the program processing time. R
S and a maximum time setting register R L for setting the maximum time T L program processing time, the counter R W of the count value T W and the shortest time setting register R S settings T S or maximum time setting register R L comparator circuit C SW, C LW and the count value of the counter R W these comparison T W and the shortest time setting register R S or maximum time setting register R L set value T S to compare the set value T L, respectively,
When T L becomes equal, bit F of control register R C
A detection circuit S C for detecting the processing state of the program from the state of F1.

【0020】各レジスタは、フリップフロップを有して
おり、複数のビットで構成されている。そして、制御レ
ジスタRのビットの中にプログラムの処理状態を示す
ビットFF1があり、ビットFF1は、プログラムの処
理ルーチンに入ると、“1”にセットされ、ルーチンか
ら脱出すると“0”にリセットされる。
Each register has a flip-flop and is composed of a plurality of bits. Then, in the bits of the control register R C , there is a bit FF1 indicating the processing state of the program. The bit FF1 is set to “1” when entering the processing routine of the program, and reset to “0” when exiting from the routine. To be done.

【0021】最短時間設定レジスタRには、最短時間
設定値Tが設定され、最長時間設定レジスタR
は、最長時間設定値Tが設定されている。
[0021] The shortest time setting register R S, is set shortest time set value T S, the maximum time setting register R L, the maximum time set value T L is set.

【0022】比較回路CSW,CLWは、カウンタR
のカウント値Tと設定値T,Tとを比較するコン
パレータであり、T=T,T=Tとなったとき
に検知回路Sにそれぞれ信号を出力する。
The comparator circuits C SW and C LW are provided with a counter R W.
Is a comparator for comparing the count value T W of T w with the set values T S , T L, and outputs a signal to the detection circuit S C when T W = T S , T W = T L , respectively.

【0023】検知回路Sは、比較回路CSW,CLW
からの信号により作動され、ビットFF1の状態を検知
して、プログラムの処理時間が最短設定時間と最長設定
時間との間にあるか否かを判定するものである。
The detection circuit S C is composed of comparison circuits C SW and C LW.
Is detected by detecting the state of the bit FF1 and whether or not the processing time of the program is between the shortest set time and the longest set time.

【0024】上記構成において、制御レジスタRのプ
ログラムの処理中を示すビットFF1は、処理中ではセ
ット状態“1”であり、処理が終了するとリセット状態
“0”となる。
In the above structure, the bit FF1 indicating that the program of the control register R C is being processed is in the set state "1" during the processing, and becomes the reset state "0" when the processing is completed.

【0025】プログラムの処理ルーチン(例えば割り込
み)に入ると、ビットFF1が“1”となり、カウンタ
がスタートする。
[0025] Upon entering the program routine (eg interrupt), bit FF1 becomes "1", the counter R W is started.

【0026】カウンタRのカウント値Tと最短時間
設定レジスタRの設定値Tとを比較回路CSWによ
り比較し、等しくなったときビットFF1の状態を検知
回路Sで検知し、図2(c)の如く、リセット状態
“0”ならば処理が異常に早く終了したと判定する。そ
して、この異常を外部にエラー信号として出力する。
[0026] Compared with the counter R W of the count value T W and the shortest time setting register R S settings T S and a comparator circuit C SW, it detects the state of the bit FF1 by the detection circuit S C when equal, As shown in FIG. 2C, if the reset state is “0”, it is determined that the processing has ended abnormally early. Then, this abnormality is output as an error signal to the outside.

【0027】図2(b)のようにセット状態“1”なら
ば、さらにカウンタRのカウントを継続し、カウント
値Tと最長時間設定レジスタRの設定値Tとを比
較回路CLWにより比較し、TがTを越えた時点で
再度ビットFF1の状態を検知回路Sで検知し、図2
(b)のようにリセット状態“0”ならば正常であると
判定し、図2(d)のようにセット状態“1”のままな
らば、プログラムが暴走して処理時間が異常に長くなっ
ていると判定する。
If the set state is "1" as shown in FIG. 2B, the counter R W is further continued to count, and the count value T W and the set value T L of the longest time setting register R L are compared. compared with LW, T W detects the status again bit FF1 at the time beyond the T L by the detection circuit S C, FIG. 2
If the reset state is “0” as shown in (b), it is determined to be normal, and if the set state is “1” as shown in FIG. 2 (d), the program runs away and the processing time becomes abnormally long. It is determined that

【0028】したがって、従来のウォッチドッグタイマ
回路は、プログラムが暴走した場合、すなわち処理時間
が異常に長くなった場合のみしか検出できなかったが、
プログラムの処理時間の最短時間経過した時点で、処理
が終了しているか否かを検出することにより、プログラ
ムの処理時間が異常に短い場合も検出することができ
る。
Therefore, the conventional watchdog timer circuit can detect only when the program goes out of control, that is, when the processing time becomes abnormally long.
Even when the processing time of the program is abnormally short, it can be detected by detecting whether or not the processing is completed when the shortest time of the processing time of the program has elapsed.

【0029】(第二実施例)上記第一実施例では、処理
時間のカウンタが最短設定時間と一致した時にプログラ
ム処理が異常に早く終了したか否か、および最長設定時
間を越えた時点でその処理が正常に終了していたか異常
に長くなっているかを検知していた。
(Second Embodiment) In the first embodiment, whether or not the program processing ends abnormally early when the processing time counter coincides with the shortest set time, and when the longest set time is exceeded, It was detecting whether the processing was completed normally or abnormally long.

【0030】ところが、処理時間のカウンタが最短設定
時間と一致するまでにプログラム処理が異常に早く終了
した場合、これを検知できなかった。また、処理時間の
カウンタが最長設定時間と一致するまでにプログラムが
正常に終了した場合にも、これを検知できなかった。
However, if the program processing ends abnormally early before the processing time counter coincides with the shortest set time, this cannot be detected. Further, even if the program ends normally before the processing time counter matches the longest set time, this could not be detected.

【0031】そこで、本実施例のウォッチドッグタイマ
回路は、プログラムが格納されたROMと、ROMから
の命令コードをデコードするインストラクションデコー
ダーDISRと、プログラムが処理中であることを示すフ
リップフロップのビットSWPと、インストラクションデ
コーダーDISRからのオペランドにより最短設定時間と
最長設定時間コードをデコードするデコーダDSLCと、
最長設定時間TLを一時保留しておく最長設定時間保留
レジスタRTLと、最短設定時間TSと最長設定時間TL
切り替えるマルチプレクサMPXと、プログラムの処理時
間を計測するためのクロックCLKを入力とするカウン
タRWと、プログラム処理の最短設定時間TSと最長設定
時間TLを設定する処理時間範囲設定レジスタRSLと、
処理時間範囲設定レジスタRSLの内容が最短設定時間T
Sか最長設定時間TLかを示すフリップフロップのビット
SLと、カウンタRWのカウント値TWと処理時間範囲設
定レジスタRSLの最短設定時間TSまたは最長設定時間
Lと一致しているか否かを検出する一致検出回路C
Cと、プログラム処理中を示すビットSWPの状態と一致
検出回路CCにより異常を検知する一致時異常検知回路
DCと、プログラム処理中を示すビットSWPの立ち下が
りを検知する立ち下がり検知回路DSFと、立ち下がり検
知回路DSFの出力と最短設定時間TSか最長設定時間TL
かを示すビットFSLの状態により異常を検知する立ち下
がり時異常検知回路FDCと、一致時異常検知回路EDC
出力と立ち下がり時異常検知回路DSFの出力を2入力と
し異常検知信号を出力する論理和回路OR1と、プログ
ラムの処理中を示すビットSWPの極性を反転させるイン
バータINV1と、論理和回路OR1とインバータIN
V1の出力を2入力としカウンタRWをリセットする論
理和回路OR2とから構成されている。
Therefore, in the watchdog timer circuit of this embodiment, the ROM in which the program is stored, the instruction decoder D ISR for decoding the instruction code from the ROM, and the bit of the flip-flop indicating that the program is being processed. SWP, and a decoder D SLC for decoding the minimum set time and the maximum set time code by the operand from the instruction decoder D ISR ,
And the longest set time pending register R TL to be suspended temporarily maximum setting time T L, a multiplexer M PX switching the shortest set time T S and the longest set time T L, a clock CLK to measure the processing time of the program A counter R W as an input, a processing time range setting register R SL for setting a shortest set time T S and a longest set time T L of program processing,
The content of the processing time range setting register R SL is the shortest setting time T
Match the bit F SL of the flip-flop indicating S or the longest set time T L, the count value T W of the counter R W , and the shortest set time T S or the longest set time T L of the processing time range setting register R SL. Match detection circuit C for detecting whether or not
C , the state of the bit SWP indicating that the program is being processed and the coincidence abnormality detection circuit E DC that detects an abnormality by the coincidence detection circuit C C, and the fall detection that detects the falling of the bit SWP that indicates that the program is being processed The output of the circuit D SF and the fall detection circuit D SF and the shortest set time T S or the longest set time T L
An abnormality detection circuit F DC during the fall detecting an abnormality by the state of bit F SL indicating whether the output of the abnormality detection circuit D SF when falling output and falling of the match when the abnormality detection circuit E DC and 2 input abnormality detection signal OR circuit OR1 for outputting a signal, an inverter INV1 for inverting the polarity of a bit SWP indicating that a program is being processed, an OR circuit OR1 and an inverter IN
It is composed of an OR circuit OR2 which receives the output of V1 as two inputs and resets the counter R W.

【0032】プログラムが処理中を示すビットSWPは、
プログラムの処理ルーチンに入ると“1”にセットさ
れ、処理ルーチンから抜けると“0”にリセットされ
る。
The bit SWP indicating that the program is processing is
It is set to "1" when entering the processing routine of the program, and reset to "0" when exiting the processing routine.

【0033】処理時間範囲設定レジスタRSLの内容が最
短設定時間TSか最長設定時間TLかを示すビットF
SLは、処理時間範囲設定レジスタRSLの内容が最短設定
時間TSの時“0”にリセットされ、最長設定時間TL
時“1”にセットされる。
Bit F indicating whether the content of the processing time range setting register R SL is the shortest set time T S or the longest set time T L
SL is reset to "0" when the content of the processing time range setting register R SL is the shortest set time T S , and is set to "1" when the longest set time T L.

【0034】一致時異常検知回路EDCは、最短設定時間
Sに達したとき、ビットSWPが“1”であればプログ
ラムの処理が正常であると判定し、“0”であればプロ
グラムの処理が異常であると判定する。また、最長設定
時間TLに達したとき、ビットSWPが“0”であればプ
ログラムの処理が正常であると判断し、“1”であれば
プログラムの処理が異常であると判定する。
When the shortest set time T S is reached, the coincidence abnormality detection circuit E DC determines that the program processing is normal if the bit SWP is "1", and if the bit SWP is "0", the program processing is normal. It is determined that the process of is abnormal. When the longest set time T L is reached, if the bit SWP is “0”, it is determined that the program processing is normal, and if the bit SWP is “1”, it is determined that the program processing is abnormal.

【0035】立ち下がり時異常検知回路FDCは、ビット
SLが“0”のときビットSWPの立ち下がりが検知され
ると、プログラムの処理が異常であると判定し、ビット
SLが“1”のときビットSWPの立ち下がりが検知され
ると、プログラムが正常に終了したと判定する。
The falling time abnormality detection circuit F DC, when falling of the bits S WP when bit F SL is "0" is detected, it is determined that processing of the program is abnormal, the bit F SL is " When the falling edge of the bit SWP is detected in the case of "1", it is determined that the program has ended normally.

【0036】上記構成において、プログラムの処理ルー
チンに入ると、プログラムが格納されたROMからの命
令コードをインストラクションデコーダーDISRにより
デコードし、インストラクションデコーダーDISRから
の出力によってビットSWPが“1”となり、カウンタR
Wのカウントがスタートする。
[0036] In the above arrangement, upon entering the program routine, decodes the instruction code from the program is stored ROM by instruction decoder D ISR, bit S WP becomes "1" by the output from the instruction decoder D ISR , Counter R
W count starts.

【0037】そして、インストラクションデコーダーD
ISRからのオペランドの最短,最長設定コードがデコー
ダDSLCに入力され、ビットFSLが“0”にリセットさ
れる。デコーダDSLCからの最短設定時間TSが、ビット
SLの“0”によりマルチプレクサMPXを通り、インス
トラクションデコーダーDISRからの信号により処理時
間範囲設定レジスタRSLに設定される。一方、最長設定
時間TLは、最長設定時間保留レジスタRTLにインスト
ラクションデコーダーDISRからの信号により設定され
る。
Then, the instruction decoder D
The shortest and longest operand setting codes from the ISR are input to the decoder D SLC , and the bit F SL is reset to "0". The shortest setting time T S from the decoder D SLC is set in the processing time range setting register R SL by the signal from the instruction decoder D ISR through the multiplexer M PX by the bit F SL of “0”. On the other hand, the longest set time T L is set in the longest set time holding register R TL by a signal from the instruction decoder D ISR .

【0038】カウンタRWのカウント値TWと処理時間範
囲設定レジスタRSLの最短設定時間TSが一致する前
に、プログラムの処理中を示すビットSWPが“1”から
“0”に立ち下がった場合、これを立ち下がり検知回路
SFが検知する。立ち下がり検知回路DSFの出力により
立ち下がり時異常検知回路FDCでは、ビットFSL
“0”状態を検知し、図4(c)のようにプログラムが
異常に早く終了したと判定する。すると、論理和回路O
R1を通して、異常検知出力として外部に出力し、最長
設定時間保留レジスタRTLおよび論理和回路OR2を通
してカウンタRWをそれぞれリセットする。
The counter before a shortest set time T S of R W count value T W and treatment time range setting register R SL of match, the bit S WP shows the processing of the program up to "1" to "0" When it falls, the fall detection circuit D SF detects it. The output of the fall detection circuit D SF causes the fall abnormality detection circuit F DC to detect the "0" state of the bit F SL , and determines that the program ends abnormally early as shown in FIG. 4 (c). Then, the OR circuit O
It is output to the outside as an abnormality detection output through R1, and the counter R W is reset through the longest set time holding register R TL and the OR circuit OR2.

【0039】カウンタRWのカウント値TWと処理時間範
囲設定レジスタRSLの最短設定時間TSが一致した時、
一致検出回路CCの出力とビットSWPの状態を一致時異
常検知回路EDCで検知し、図4(c)のようにビットS
WPが“0”ならば、プログラム処理が異常に早く終了し
たことおよび立ち下がり検知回路DSFが異常であると判
定する。そして、論理和回路OR1を通して異常検知出
力として外部に出力し、最長設定時間保留レジスタRTL
および論理和回路OR2を通してカウンタRWをそれぞ
れリセットする。
[0039] When the counter R W count value T W and treatment time range setting register R SL minimum setup time T S of match,
The output of the coincidence detection circuit C C and the state of the bit SW P are detected by the abnormality detection circuit E DC at the time of coincidence, and as shown in FIG.
If WP is "0", it is determined that the program processing has ended abnormally early and the fall detection circuit D SF is abnormal. Then, it is output to the outside as an abnormality detection output through the OR circuit OR1, and the longest set time holding register R TL
And the counter R W is reset through the OR circuit OR2.

【0040】ここで、図4(b)のようにビットSWP
“1”ならば、プログラムは正常に処理されていると判
定し、一致時異常検知回路EDCからの制御信号によりビ
ットFSLが“1”にセットされ、最長設定時間保留レジ
スタRTLの内容がビットFSLの“1”によりマルチプレ
クサMPXを通り、処理範囲設定レジスタRSLに設定され
る。
Here, if the bit SWP is "1" as shown in FIG. 4B, it is determined that the program is processed normally, and the bit F is generated by a control signal from the coincidence abnormality detection circuit E DC. SL is set to "1", the contents of the longest set time pending register R TL passes through the multiplexer M PX by "1" bit F SL, it is set in the processing range setting register R SL.

【0041】カウンタRWのカウンタ値TWと処理時間範
囲設定レジスタRSLの最長設定時間TLが一致する前
に、プログラムの処理中を示すビットSWPが“1”から
“0”に立ち下がった場合、立ち下がり検知回路DSF
より検知され、立ち下がり検知回路DSFの出力とビット
SLの“1”状態とから立ち下がり時異常検知回路FDC
では、プログラムが正常に終了したと判定する。
The counter before the maximum setting time T L of R W counter value T W and treatment time range setting register R SL of match, the bit S WP shows the processing of the program up to "0" to "1" If lowered, it is detected by the fall detecting circuit D SF, the abnormality detection circuit during the fall from "1" state of the output bit F SL falling detection circuit D SF F DC
Then, it is determined that the program has ended normally.

【0042】カウンタRWのカウンタ値TWと処理時間範
囲設定レジスタRSLの最長設定時間TLが一致した時、
一致検出回路CCの出力とビットSWPの状態を一致時異
常検知回路EDCで検知し、図4(b)のようにビットS
WPが“0”ならばプログラムが正常に終了していたと判
定する。
[0042] when the counter R W counter value T W and processing the longest set time T L of the time range setting register R SL of the match,
The output of the coincidence detection circuit C C and the state of the bit SW P are detected by the abnormality detection circuit E DC at the time of coincidence, and as shown in FIG.
If WP is "0", it is determined that the program has ended normally.

【0043】また、図4(d)のようにビットSWP
“1”ならばプログラムが暴走して処理時間が異常に長
くなっていると判定し、論理和回路OR1を通して異常
検知出力として外部に出力し、最長設定時間保留レジス
タRTLおよび論理和回路OR2を通してカウンタRW
それぞれリセットする。
If the bit SWP is "1" as shown in FIG. 4 (d), it is determined that the program has run away and the processing time is abnormally long, and an external signal is output as an abnormality detection output through the OR circuit OR1. To reset the counter R W through the longest set time holding register R TL and the OR circuit OR2.

【0044】このように、プログラムのオペランドに最
短,最長設定時間コードを含むことによりプログラム処
理の最短設定時間と最長設定時間を設定することがで
き、最短設定時間経過時にプログラムが処理中であるか
否かの検知、および最長設定時間経過時にプログラム処
理が終了しているか否かの検知ができる。
Thus, by including the shortest and longest set time codes in the program operand, the shortest set time and the longest set time of the program processing can be set, and whether the program is being processed when the shortest set time has elapsed. It is possible to detect whether or not the program processing is completed when the longest set time has elapsed.

【0045】また、プログラムが処理中であることを示
すビットの立ち下がりを検知することにより、処理時間
範囲設定レジスタに最短時間が設定されている時にはプ
ログラムが異常に早く終了したこと、および最長時間が
設定されている時にはプログラムが正常に終了したこと
を検知できる。
Further, by detecting the falling edge of the bit indicating that the program is being processed, the program ends abnormally early when the shortest time is set in the processing time range setting register, and the longest time. When is set, it can detect that the program ended normally.

【0046】そのため、第一実施例では、カウンタが最
短設定時間と一致する前にプログラム処理が異常に早く
終わったことをカウンタが最短設定時間と一致するまで
検知できず、またカウンタが最長設定時間と一致する前
にプログラムが正常に終わったことをカウンタが最長設
定時間と一致するまで検知できなかったが、命令コード
のオペランドに含まれるプログラムの最短設定時間と最
長設定時間のコードをデコードして処理時間範囲設定レ
ジスタに設定し、プログラムの処理中を示すビットの立
ち下がりを検知することにより、最短設定時間以前での
プログラム処理の異常、あるいは最長設定時間以前での
プログラム処理の正常な終了も検知することができる。
Therefore, in the first embodiment, it is not possible to detect that the program processing ends abnormally early before the counter coincides with the shortest set time until the counter coincides with the shortest set time, and the counter has the longest set time. It was not possible to detect that the program ended normally before the match with the above, until the counter matched the maximum set time, but the code of the minimum set time and the maximum set time of the program contained in the operand of the instruction code was decoded. By setting the processing time range setting register and detecting the falling edge of the bit indicating that the program is being processed, abnormalities in the program processing before the shortest set time or normal termination of the program processing before the longest set time can be detected. Can be detected.

【0047】なお、本発明は、上記実施例に限定される
ものではなく、本発明の範囲内で上記実施例に多くの修
正および変更を加え得ることは勿論である。
The present invention is not limited to the above embodiments, and it goes without saying that many modifications and changes can be made to the above embodiments within the scope of the present invention.

【0048】[0048]

【発明の効果】以上の説明から明らかな通り、本発明請
求項1によると、プログラムの処理時間の最短時間を設
定する最短時間設定レジスタと、プログラムの処理時間
の最長時間を設定する最長時間設定レジスタとを設け、
最短設定時間経過時にプログラムが処理中であるか否か
を検知し、最長設定時間を越えた時点でその処理が終了
しているか否かを検知するため、従来のウォッチドッグ
タイマでは、プログラムが暴走した場合、すなわち処理
時間が異常に長くなった場合のみしか検出できなかった
が、プログラムの処理時間が異常に短い場合も検出する
ことができる。
As is apparent from the above description, according to claim 1 of the present invention, the shortest time setting register for setting the shortest time of the processing time of the program and the longest time setting for setting the longest time of the processing time of the program. Register and
In the conventional watchdog timer, the program runs out of control in order to detect whether the program is being processed when the shortest set time has elapsed and whether the processing has ended when the longest set time is exceeded. Although it can be detected only when the processing time is abnormally long, that is, when the processing time of the program is abnormally short, it can be detected.

【0049】請求項2〜4によると、プログラムのオペ
ランドに最短、最長設定時間コードを含んでいるので、
プログラム処理の最短設定時間と最長設定時間を設定す
ることができる。したがって、最短設定時間経過時にプ
ログラムが処理中であるか否かの検知、また最長設定時
間経過時にプログラム処理が終了しているか否かの検知
ができる。
According to the second to fourth aspects, since the program operands include the shortest and longest set time codes,
The minimum set time and the maximum set time of program processing can be set. Therefore, it is possible to detect whether or not the program is being processed when the shortest set time has elapsed, and to detect whether or not the program processing has ended when the longest set time has elapsed.

【0050】また、プログラムが処理中であることを示
すビットの立ち下がりを検知することにより、最短設定
時間経過前にプログラムが異常に早く終了したこと、お
よび最長設定時間経過前にプログラムが正常に終了した
ことを検知することができる。
Further, by detecting the falling edge of the bit indicating that the program is being processed, the program ends abnormally early before the shortest set time elapses, and the program becomes normal before the longest set time elapses. It can detect the end.

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

【図1】本発明の第一実施例を示すウォッチドッグタイ
マ回路のブロツク図
FIG. 1 is a block diagram of a watchdog timer circuit showing a first embodiment of the present invention.

【図2】プログラムが正常作動時および異常作動時にお
けるウォッチドッグタイマ回路内の信号波形図
FIG. 2 is a signal waveform diagram in the watchdog timer circuit when the program operates normally and abnormally.

【図3】本発明の第二実施例を示すウォッチドッグタイ
マ回路のブロック図
FIG. 3 is a block diagram of a watchdog timer circuit showing a second embodiment of the present invention.

【図4】プログラムの正常作動時および最短設定時間よ
り短い時および最長設定時間より長い時の異常作動時に
おけるウォッチドッグタイマ回路内の信号波形図
FIG. 4 is a signal waveform diagram in the watchdog timer circuit during normal operation of the program and during abnormal operation when the time is shorter than the shortest set time and longer than the longest set time.

【図5】従来のマイクロコンピュータの誤動作防止装置
のブロック図
FIG. 5 is a block diagram of a conventional malfunction prevention device for a microcomputer.

【符号の説明】[Explanation of symbols]

SW,CLW 比較回路 FF1 ビット R 制御レジスタ R 最長時間設定レジスタ R 最短時間設定レジスタ S 検知回路 DISR インストラクションデコーダー DSLC デコーダー SWP ビット RTL 最長設定時間保留レジスタ MPX マルチプレクサ RW カウンタ RSL 処理時間範囲設定レジスタ FSL ビット CC 一致検出回路 EDC 一致時異常検知回路 DSF 立ち下がり検知回路 FDC 立ち下がり時異常検知回路C SW , C LW comparison circuit FF 1 bit R C control register R L longest time setting register R S shortest time setting register S C detection circuit D ISR instruction decoder D SLC decoder S WP bit R TL longest setting time hold register M PX multiplexer R W counter R SL Processing time range setting register F SL bit C C Match detection circuit E DC Match error detection circuit D SF Fall detection circuit F DC Fall error detection circuit

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 プログラムの暴走を検出するものであっ
て、プログラムの処理中であることを示すビットを含む
制御レジスタと、プログラムの処理開始と同時に計数を
開始するカウンタと、プログラムの処理時間の最短時間
を設定する最短時間設定レジスタと、プログラムの処理
時間の最長時間を設定する最長時間設定レジスタと、カ
ウンタのカウント値と最短時間設定レジスタの設定値あ
るいは最長時間設定レジスタの設定値をそれぞれ比較す
る比較回路と、これらの比較によりカウンタのカウント
値と最短時間設定レジスタあるいは最長時間設定レジス
タの設定値が等しくなったとき、制御レジスタのビット
の状態からプログラムの処理状態を検出する検知回路と
を備えたことを特徴とするウォッチドッグタイマ回路。
1. A control register for detecting runaway of a program, the control register including a bit indicating that the program is being processed, a counter for starting counting at the same time as the start of processing of the program, and a processing time of the program. The shortest time setting register that sets the shortest time, the longest time setting register that sets the longest program processing time, the counter count value and the shortest time setting register setting value or the longest time setting register setting value are compared. And a detection circuit for detecting the processing state of the program from the bit state of the control register when the count value of the counter becomes equal to the set value of the shortest time setting register or the longest time setting register by these comparisons. A watchdog timer circuit characterized by being provided.
【請求項2】 プログラムの暴走を検出するものであっ
て、プログラムの処理中であることを示すビットを含む
レジスタと、ビットのセットと同時にカウントを開始し
プログラムが処理中でない時にリセット状態にあるカウ
ンタと、プログラムの処理時間を設定する処理時間範囲
設定レジスタと、処理時間範囲設定レジスタに最短設定
時間または最長設定時間が設定されているかを示すビッ
トを含むレジスタと、カウンタのカウント値と処理時間
範囲設定レジスタの設定値が一致するか否かを検出する
一致検出回路と、プログラムの処理中であることを示す
ビットの状態と処理時間範囲設定レジスタに最短設定時
間または最長設定時間が設定されているかを示すビット
の状態と一致検出回路の出力とから各設定時間前のプロ
グラムの処理状態を検知する異常検知回路とを備えたこ
とを特徴とするウォッチドッグタイマ回路。
2. A program for detecting runaway of a program, the register including a bit indicating that the program is being processed, and a count being started at the same time when the bit is set and being in a reset state when the program is not being processed. A counter, a processing time range setting register that sets the processing time of the program, a register that contains a bit that indicates whether the minimum setting time or the maximum setting time is set in the processing time range setting register, the counter count value, and the processing time The match detection circuit that detects whether the set values in the range setting register match, the state of the bit that indicates that the program is being processed, and the processing time The shortest or longest set time is set in the range setting register. The processing state of the program before each set time is determined from the state of the bit indicating whether A watchdog timer circuit comprising an abnormality detection circuit for detecting.
【請求項3】 請求項2項記載のウォッチドッグタイマ
回路において、プログラムの内蔵されたROMと、RO
Mの内容を解読して起動する命令デコーダーと、命令デ
コーダーからのオペランドに含まれるプログラムの最短
設定時間と最長設定時間のコードをデコードするデコー
ダーと、最短設定時間と最長設定時間を切り替えるマル
チプレクサと、最長設定時間を保留するレジスタとを備
えたことを特徴とするウォッチドッグタイマ回路。
3. The watchdog timer circuit according to claim 2, wherein a ROM containing a program and an RO
An instruction decoder that decodes and activates the contents of M, a decoder that decodes the code of the minimum set time and the maximum set time of the program included in the operand from the instruction decoder, and a multiplexer that switches the minimum set time and the maximum set time. A watchdog timer circuit, comprising: a register that holds a maximum set time.
【請求項4】 請求項2記載の異常検知回路は、プログ
ラムの処理中を示すビットの立ち下がりを検知する立ち
下がり検知回路と、立ち下がり検知回路の出力と最短設
定時間または最長設定時間が設定されているかを示すビ
ットの状態とによりプログラムの処理が異常か正常かを
検知する立ち下がり時異常検知回路とを有することを特
徴とするウォッチドッグタイマ回路。
4. The abnormality detection circuit according to claim 2, wherein a fall detection circuit that detects a fall of a bit indicating that a program is being processed, an output of the fall detection circuit, and a minimum set time or a maximum set time are set. A watchdog timer circuit, comprising: a fall abnormality detection circuit that detects whether the processing of the program is abnormal or normal depending on the state of a bit indicating whether the program is being processed.
JP4206459A 1991-09-20 1992-08-03 Watchdog timer circuit Pending JPH05204715A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4206459A JPH05204715A (en) 1991-09-20 1992-08-03 Watchdog timer circuit

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP24105691 1991-09-20
JP3-241056 1991-09-20
JP4206459A JPH05204715A (en) 1991-09-20 1992-08-03 Watchdog timer circuit

Publications (1)

Publication Number Publication Date
JPH05204715A true JPH05204715A (en) 1993-08-13

Family

ID=26515665

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4206459A Pending JPH05204715A (en) 1991-09-20 1992-08-03 Watchdog timer circuit

Country Status (1)

Country Link
JP (1) JPH05204715A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100311366B1 (en) * 1994-11-28 2002-02-19 구자홍 Controller having watch dog timer function
DE102006046188A1 (en) * 2006-09-29 2008-04-03 Infineon Technologies Ag Safety-controller`s operation monitoring method, involves generating signal, when determined runtime falls below lower threshold value for runtime of process, and triggering signal during falling of threshold value

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100311366B1 (en) * 1994-11-28 2002-02-19 구자홍 Controller having watch dog timer function
DE102006046188A1 (en) * 2006-09-29 2008-04-03 Infineon Technologies Ag Safety-controller`s operation monitoring method, involves generating signal, when determined runtime falls below lower threshold value for runtime of process, and triggering signal during falling of threshold value

Similar Documents

Publication Publication Date Title
JPH0528063A (en) Microcomputer
JPH05204715A (en) Watchdog timer circuit
JPH11259340A (en) Reactivation control circuit for computer
JPS62145440A (en) Runaway detection circuit
JPH11330931A (en) Device and method for monitoring clock operation of control system
KR100311366B1 (en) Controller having watch dog timer function
JP2814800B2 (en) Microcomputer
JPH11203173A (en) Watch dog timer circuit
JP2008152621A (en) Microcomputer
JPH0581138A (en) Microprogram controller
KR940002276B1 (en) Malfunction detecting method for micro-controller
JPH04142635A (en) Abnormal operation detecting device for processor
JPH05257748A (en) Microprocessor device
JPH0773073A (en) Watch dog timer circuit
JPS6349855A (en) Detecting device for interruption cycle abnormality of cpu
JPS63316146A (en) Microcomputer
JPH04225432A (en) Interruption processing time control system for one-chip microcomputer
JPH05225359A (en) Microcomputer device
JPH0683671A (en) Operation monitoring circuit for semiconductor device
KR960003096B1 (en) Error detecting circuit
JP2776765B2 (en) Infinite loop detector
JPH0784836A (en) Watchdog circuit
JP2003067221A (en) Watchdog timer control circuit
JPH09237205A (en) Program runaway detection device
JPH06222961A (en) Watchdog timer