JP2008225807A - Control device, and program runaway monitoring method for the same - Google Patents

Control device, and program runaway monitoring method for the same Download PDF

Info

Publication number
JP2008225807A
JP2008225807A JP2007062699A JP2007062699A JP2008225807A JP 2008225807 A JP2008225807 A JP 2008225807A JP 2007062699 A JP2007062699 A JP 2007062699A JP 2007062699 A JP2007062699 A JP 2007062699A JP 2008225807 A JP2008225807 A JP 2008225807A
Authority
JP
Japan
Prior art keywords
timer
watchdog
general
time
control device
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
JP2007062699A
Other languages
Japanese (ja)
Inventor
Mitsunori Kuzushima
光則 葛島
Masanao Suga
政直 菅
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.)
Yaskawa Electric Corp
Original Assignee
Yaskawa Electric 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 Yaskawa Electric Corp filed Critical Yaskawa Electric Corp
Priority to JP2007062699A priority Critical patent/JP2008225807A/en
Publication of JP2008225807A publication Critical patent/JP2008225807A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a control device and a program runaway monitoring method therefor that can detect a program runaway and restart or stop the program promptly before the runaway causes failures such as memory destruction while facilitating additions to, modifications to and migrations of initial processing and without employing any special circuits for program runaway detection. <P>SOLUTION: The control device comprises an interrupt trigger part 7 for triggering interrupt handling when a general purpose timer 12 times out, and an interrupt handling part 8 for executing the interrupt handling. A watchdog processing part 6 sets the timer time of the general purpose timer 12 and the number of resets of a watchdog timer 11, and during initial processing, permits interrupts from the general purpose timer 12 to reset the watchdog timer 11 by the set number in the interrupt handling. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、CPUを搭載し、ソフトウェアのプログラムにより各種の制御を行う制御装置およびそのプログラム暴走を監視する方法に関する。   The present invention relates to a control device that is equipped with a CPU and performs various controls by a software program and a method for monitoring the program runaway.

従来、制御装置のソフトウェアのプログラム暴走を監視する手段として、ウォッチドッグタイマと呼ばれる、プログラムによってリセット可能なタイマを設け、設定された一定時間内にプログラムによるリセットがなされずタイムアウトした場合は、プログラム暴走と判定し、制御装置の強制停止あるいはプログラムの再スタートを行うという方法が多くとられている。その際、ウォッチドッグタイマに設定する時間は制御装置として許容しうる最大時間に設定しておくのが一般的である。   Conventionally, as a means of monitoring program runaway of control unit software, a timer called a watchdog timer has been provided that can be reset by a program. If a program does not reset within a set period of time and the program times out, program runaway In many cases, the control device is forcibly stopped or the program is restarted. In this case, the time set for the watchdog timer is generally set to the maximum time allowed for the control device.

図4は、従来のウォッチドッグタイマを使用する制御装置の構成例を示すブロック図である。
図4において、1Aは制御装置であり、中央制御部2Aとウォッチドッグタイマ11から成る。ウォッチドッグタイマ11は、一定の設定時間を有するタイマからなる。aはウォッチドッグタイマのリセット信号であって、プログラムにてウォッチドッグタイマ11に入力されることでタイマをリセットし、かつ、タイマを再起動する。以降プログラムで信号aを出力する毎に、ウォッチドッグタイマ11のリセットと再起動を繰り返す。bはウォッチドッグタイマ11のタイムアウト信号で、プログラムがウォッチドッグタイマ11に設定している時間以内に信号aを出力しない場合に出力され、以降、プログラム再起動あるいは強制停止条件等に使用される。
ここで、プログラムの処理を考えてみると、処理内容は一般にイニシャル処理と通常処理に分かれている。
図4では、中央処理部2Aの中に、イニシャル処理を行うイニシャル処理部4と通常処理を行う通常処理部5がある。また、ウォッチドッグタイマ11にリセット信号aを出力するウォッチドッグ処理部6Aがある。
FIG. 4 is a block diagram illustrating a configuration example of a control device using a conventional watchdog timer.
In FIG. 4, reference numeral 1 </ b> A denotes a control device, which includes a central control unit 2 </ b> A and a watchdog timer 11. The watchdog timer 11 is a timer having a certain set time. A is a reset signal for the watchdog timer, and is reset to the timer when the program is input to the watchdog timer 11 by a program, and the timer is restarted. Thereafter, every time the signal a is output by the program, the reset and restart of the watchdog timer 11 are repeated. “b” is a time-out signal of the watchdog timer 11, which is output when the signal “a” is not output within the time set in the watchdog timer 11 by the program, and is used thereafter for program restart or forced stop conditions.
Here, considering the processing of the program, the processing contents are generally divided into initial processing and normal processing.
In FIG. 4, the central processing unit 2 </ b> A includes an initial processing unit 4 that performs initial processing and a normal processing unit 5 that performs normal processing. There is also a watchdog processing unit 6A that outputs a reset signal a to the watchdog timer 11.

図5は、従来の制御装置のプログラムの処理手順を示すフローチャートである。スタート後、まず時間t1をかけてイニシャル処理を行い(S22)、次に時間t2で通常処理が行われる(S24)。一般的に、イニシャル処理と通常処理を比較した場合、メモリ領域への各種初期設定処理等から、イニシャル処理時間が通常処理時間より著しく長くなる場合が多い(t1>>t2)。この場合、図5のフローチャートのように、S21とS23でウォッチドッグタイマをリセットする場合、ウォッチドッグタイマにはt1とt2の長い方、すなわちt1を基準に時間を設定する必要があるが、ウォッチドッグタイマに設定できる時間の上限を超える場合が多く、t1を基準に時間を設定できないという問題があった。
このような場合、すなわちt1を基準にウォッチドッグタイマの時間を設定できない場合に、ウォッチドッグタイマの設定時間をt2より少しだけ長く設定する方法がとられていた。
FIG. 5 is a flowchart showing a processing procedure of a program of a conventional control device. After the start, first, the initial process is performed over time t1 (S22), and then the normal process is performed at time t2 (S24). In general, when initial processing is compared with normal processing, the initial processing time is often significantly longer than the normal processing time (t1 >> t2) due to various initial setting processing to the memory area. In this case, as shown in the flowchart of FIG. 5, when resetting the watchdog timer in S21 and S23, the watchdog timer needs to set the time based on the longer of t1 and t2, ie, t1, In many cases, the upper limit of the time that can be set in the dog timer is exceeded, and there is a problem that the time cannot be set with reference to t1.
In such a case, that is, when the time of the watchdog timer cannot be set with reference to t1, a method of setting the set time of the watchdog timer slightly longer than t2 has been taken.

図6は、ウォッチドッグタイマの設定時間をt2より少しだけ長く設定した場合のプログラム暴走監視方法の処理手順を示すフローチャートである。イニシャル処理において、時間t2ごとにウォッチドッグタイマをリセットするようにしたものである。こうすることで、イニシャル処理時に発生するプログラム暴走を検出することができ、暴走によるメモリ破壊等の不具合に至る前にすみやかにプログラムを再スタートあるいは停止可能にすることができる。   FIG. 6 is a flowchart showing the processing procedure of the program runaway monitoring method when the set time of the watchdog timer is set slightly longer than t2. In the initial process, the watchdog timer is reset every time t2. By doing this, it is possible to detect a program runaway that occurs during the initial processing, and to make it possible to restart or stop the program immediately before a failure such as memory destruction due to the runaway occurs.

また、ウォッチドッグタイマを2個使用してイニシャル処理と通常処理で監視時間を切り替えるようにし、それぞれのウォッチドッグタイマのタイムアウト信号をオアゲートに入力し、オアゲートからの出力信号によりプログラムの暴走を検出する方法が提案されている(例えば、特許文献1参照)。
特開 昭60−164852号公報(第3図)
In addition, two watchdog timers are used to switch the monitoring time between the initial process and the normal process, the timeout signal of each watchdog timer is input to the OR gate, and the program runaway is detected by the output signal from the OR gate. A method has been proposed (see, for example, Patent Document 1).
JP-A-60-164852 (Fig. 3)

しかしながら、従来の方法で、イニシャル処理において、時間t2ごとにウォッチドッグタイマをリセットする方法では、イニシャル処理の追加、変更、移動のたびに時間t2ごとにウォッチドッグタイマをリセットするようにプログラムを変更する手間がかかるという問題がある。また、ウォッチドッグタイマを2個使用してイニシャル処理と通常処理で監視時間を切り替える方法では、特別なハードウェア回路を必要とし、回路が複雑になると共に、コストも高くなるという問題がある。   However, in the method of resetting the watchdog timer every time t2 in the initial process in the conventional method, the program is changed so that the watchdog timer is reset every time t2 every time the initial process is added, changed, or moved There is a problem that it takes time and effort. In addition, the method of using two watchdog timers to switch the monitoring time between the initial process and the normal process requires a special hardware circuit, which complicates the circuit and increases the cost.

本発明はこのような問題点に鑑みてなされたものであり、イニシャル処理の追加、変更、移動が生じても簡単に対応でき、プログラム暴走検出のための特別な回路を設けることなく、プログラムの暴走を検出し、暴走によるメモリ破壊等の不具合に至る前にすみやかにプログラムを再スタートあるいは停止可能とする制御装置およびそのプログラム暴走監視方法を提供することを目的とする。   The present invention has been made in view of such problems, and can easily cope with the addition, change, and movement of initial processing, and without providing a special circuit for detecting program runaway. It is an object of the present invention to provide a control device and a program runaway monitoring method capable of detecting a runaway and promptly restarting or stopping a program before a malfunction such as memory destruction due to the runaway occurs.

上記問題を解決するため、本発明は、次のようにしたのである。
請求項1に記載の発明は、リセット信号によりリセット可能なタイマで、一定時間内にリセットされずタイムアウトした場合タイムアウト信号を出力するウォッチドッグタイマと、装置全体の制御を行う中央制御部とから成り、前記中央制御部に、CPUと、電源投入時のイニシャル処理を行うイニシャル処理部と、前記イニシャル処理後の通常時の処理を行う通常処理部と、ウォッチドッグタイマのリセット処理を行うウォッチドッグ処理部と、を有する制御装置において、前記制御装置内に汎用タイマを備え、前記中央処理部に、前記汎用タイマがタイムアウトしたとき割り込み処理を起動する割り込み起動部と、前記割り込み処理を実行する割り込み処理部とを備え、前記ウォッチドッグ処理部は、前記汎用タイマのタイマ時間と、前記ウォッチドッグタイマをリセットする回数を設定し、前記イニシャル処理実行中は汎用タイマからの割り込みを許可し、前記割り込み処理で前記ウォッチドッグタイマを設定した回数だけリセットすることを特徴とするものである。
また、請求項2に記載の発明は、請求項1記載の制御装置において、前記ウォッチドッグ処理部は、前記汎用タイマのタイマ時間を前記ウォッチドッグタイマのタイマ時間より短く設定することを特徴とするものである。
また、請求項3に記載の発明は、請求項1記載の制御装置において、前記ウォッチドッグ処理部は、前記ウォッチドッグタイマをリセットする回数Nを、イニシャル処理時間をt1、汎用タイマのタイマ時間をt4としたとき、t4*N>t1となるような数で設定することを特徴とするものである。
また、請求項4に記載の発明は、請求項1記載の制御装置において、前記ウォッチドッグ処理部は、前記イニシャル処理終了後、前記汎用タイマの割り込みを禁止し、前記汎用タイマを他用途として使用するための設定をすることを特徴とするものである。
In order to solve the above problem, the present invention is as follows.
The invention described in claim 1 is a timer that can be reset by a reset signal, and includes a watchdog timer that outputs a timeout signal when a timeout occurs without being reset within a predetermined time, and a central control unit that controls the entire apparatus. The central control unit includes a CPU, an initial processing unit that performs initial processing at power-on, a normal processing unit that performs normal processing after the initial processing, and a watchdog process that performs reset processing of a watchdog timer A control unit comprising a general-purpose timer in the control device, the central processing unit having an interrupt activation unit for starting an interrupt process when the general-purpose timer times out, and an interrupt process for executing the interrupt process The watchdog processing unit includes a timer time of the general-purpose timer and a previous time Set the number of times to reset the watchdog timer, during the initial process run enables interrupts from the general-purpose timer, and is characterized in that only reset a set number of times the watchdog timer by the interrupt processing.
The invention according to claim 2 is the control device according to claim 1, wherein the watchdog processing unit sets a timer time of the general-purpose timer to be shorter than a timer time of the watchdog timer. Is.
According to a third aspect of the present invention, in the control device according to the first aspect, the watchdog processing unit sets the number N of times of resetting the watchdog timer, the initial processing time t1, and the timer time of the general-purpose timer. When t4 is set, the number is set such that t4 * N> t1.
According to a fourth aspect of the present invention, in the control device according to the first aspect, the watchdog processing unit prohibits the interruption of the general-purpose timer after the completion of the initial processing, and uses the general-purpose timer for other purposes. It is characterized by making a setting for this.

また、請求項5に記載の発明は、リセット信号によりリセット可能なタイマで、一定時間内にリセットされずタイムアウトした場合タイムアウト信号を出力するウォッチドッグタイマと、装置全体の制御を行う中央制御部とから成り、前記中央制御部に、CPUと、電源投入時のイニシャル処理を行うイニシャル処理部と、前記イニシャル処理後の通常時の処理を行う通常処理部と、ウォッチドッグタイマのリセット処理を行うウォッチドッグ処理部と、を有する制御装置のプログラム暴走監視方法において、前記制御装置内に汎用タイマを備え、前記中央処理部に、前記汎用タイマがタイムアウトしたとき割り込み処理を起動する割り込み起動部と、前記割り込み処理を実行する割り込み処理部とを備え、前記汎用タイマのタイマ時間と、前記ウォッチドッグタイマをリセットする回数を設定し、前記イニシャル処理実行中は汎用タイマからの割り込みを許可し、前記割り込み処理で前記ウォッチドッグタイマを設定した回数だけリセットすることを特徴とするものである。
また、請求項6に記載の発明は、請求項5記載の制御装置のプログラム暴走監視方法において、前記汎用タイマのタイマ時間を前記ウォッチドッグタイマのタイマ時間より短く設定することを特徴とするものである。
また、請求項7に記載の発明は、請求項5記載の制御装置のプログラム暴走監視方法において、前記ウォッチドッグタイマをリセットする回数Nを、イニシャル処理時間をt1、汎用タイマのタイマ時間をt4としたとき、t4*N>t1となるような数で設定することを特徴とするものである。
また、請求項8に記載の発明は、請求項5記載の制御装置のプログラム暴走監視方法において、前記イニシャル処理終了後、前記汎用タイマの割り込みを禁止し、前記汎用タイマを他用途として使用するための設定をすることを特徴とするものである。
The invention according to claim 5 is a timer that can be reset by a reset signal, a watchdog timer that outputs a time-out signal when a time-out occurs without being reset within a fixed time, a central control unit that controls the entire apparatus, The central control unit includes a CPU, an initial processing unit that performs initial processing at power-on, a normal processing unit that performs normal processing after the initial processing, and a watch that performs reset processing of the watchdog timer In a program runaway monitoring method for a control device having a dog processing unit, the control device includes a general-purpose timer, and the central processing unit includes an interrupt activation unit that activates interrupt processing when the general-purpose timer times out, and An interrupt processing unit for executing interrupt processing, the timer time of the general-purpose timer, The number of times to reset the watchdog timer is set, an interrupt from a general-purpose timer is permitted during the execution of the initial process, and the watchdog timer is reset by the set number of times in the interrupt process. .
The invention according to claim 6 is the program runaway monitoring method of the control device according to claim 5, wherein the timer time of the general-purpose timer is set shorter than the timer time of the watchdog timer. is there.
Further, according to a seventh aspect of the present invention, in the program runaway monitoring method of the control device according to the fifth aspect, the number N of times of resetting the watchdog timer is defined as an initial processing time t1, a general-purpose timer time t4. In this case, the number is set such that t4 * N> t1.
Further, according to an eighth aspect of the present invention, in the program runaway monitoring method of the control device according to the fifth aspect, the general-purpose timer is prohibited from being interrupted after the initial process is completed, and the general-purpose timer is used for other purposes. It is characterized by setting.

本発明によれば、汎用タイマを備え、汎用タイマがタイムアウトしたとき割り込み処理を起動し、汎用タイマのタイマ時間と、ウォッチドッグタイマをリセットする回数を設定し、イニシャル処理実行中は汎用タイマからの割り込みを許可し、割り込み処理で前記ウォッチドッグタイマを設定した回数だけリセットするので、イニシャル処理の追加、変更、移動が生じた場合はウォッチドッグタイマをリセットする回数を変更するだけで簡単に対応でき、かつ制御装置に一般的に装備されている汎用タイマを有効に活用することによりプログラム暴走検出のための特別な回路を設けることなく、プログラムの暴走を検出し、暴走によるメモリ破壊等の不具合に至る前にすみやかにプログラムを再スタートあるいは停止可能とすることができる。   According to the present invention, a general-purpose timer is provided, interrupt processing is started when the general-purpose timer times out, and the timer time of the general-purpose timer and the number of times to reset the watchdog timer are set. Since interrupts are enabled and the watchdog timer is reset for the number of times set in the interrupt process, if the initial process is added, changed, or moved, it can be easily handled by changing the number of times the watchdog timer is reset. In addition, by making effective use of general-purpose timers that are generally equipped in control devices, it is possible to detect program runaway without providing a special circuit for program runaway detection, and to prevent problems such as memory corruption due to runaway. The program can be restarted or stopped as soon as possible

以下、本発明の方法の具体的実施例について、図に基づいて説明する。   Hereinafter, specific examples of the method of the present invention will be described with reference to the drawings.

図1は本発明の制御装置の構成を示すブロック図である。
図1において、1は制御装置であり、中央制御部2とウォッチドッグタイマ11、汎用タイマ12から成る。ウォッチドッグタイマ11は、一定の設定時間を有するタイマからなる。aはウォッチドッグタイマのリセット信号であって、プログラムにてウォッチドッグタイマ11に入力されることでタイマをリセットし、かつ、タイマを再起動する。以降プログラムで信号aを出力する毎に、ウォッチドッグタイマ2のリセットと再起動を繰り返す。bはウォッチドッグタイマのタイムアウト信号で、プログラムがウォッチドッグタイマ11に設定している時間以内に信号aを出力しない場合に出力され、以降、プログラム再起動あるいは強制停止条件等に使用される。
ウォッチドッグタイマ中央制御部2には、CPU3と、ソフトウェアのイニシャル処理のプログラムから成るイニシャル処理部4、通常処理のプログラムから成る通常処理部5、ウォッチドッグタイマ11に関連した処理を行うウォッチドッグ処理部6、汎用タイマがタイムアウトすると出力される割り込み信号を受けて割り込み処理8を起動する割り込み起動部7、割り込み起動部7から起動される割込み処理部8がある。
本発明が従来と異なる点は、中央制御部2に汎用タイマ12のタイムアウトで起動する割り込み処理部8とそれを起動する割り込み起動部7を備えた点である。
なお、一般に制御装置には、経過時間を算出するためのフリーランタイマや定周期信号を発生させるためのタイマ等、種々の用途に使用できる汎用タイマが1個以上装備されており、特に本発明のために新規に装備する必要はない。cは汎用タイマ12に設定された時間がタイムアウトするごとに生成される割り込み信号であり、中央制御部2に入力され、割り込み処理部8にある割り込み処理プログラムが起動される。
FIG. 1 is a block diagram showing the configuration of the control device of the present invention.
In FIG. 1, reference numeral 1 denotes a control device, which includes a central control unit 2, a watchdog timer 11, and a general-purpose timer 12. The watchdog timer 11 is a timer having a certain set time. A is a reset signal for the watchdog timer, and is reset to the timer when the program is input to the watchdog timer 11 by a program, and the timer is restarted. Thereafter, every time the signal a is output by the program, the reset and restart of the watchdog timer 2 are repeated. “b” is a time-out signal of the watchdog timer, which is output when the signal “a” is not output within the time set in the watchdog timer 11 by the program, and is used thereafter for program restart or forced stop conditions.
The watchdog timer central control unit 2 includes a CPU 3, an initial processing unit 4 composed of a software initial processing program, a normal processing unit 5 composed of a normal processing program, and a watchdog process for performing processing related to the watchdog timer 11 There are an interrupt activation unit 7 that activates the interrupt processing 8 in response to an interrupt signal that is output when the general-purpose timer times out, and an interrupt processing unit 8 that is activated from the interrupt activation unit 7.
The present invention is different from the prior art in that the central control unit 2 is provided with an interrupt processing unit 8 that is activated when the general-purpose timer 12 is timed out and an interrupt activation unit 7 that is activated.
In general, a control device is equipped with one or more general-purpose timers that can be used for various purposes such as a free-run timer for calculating an elapsed time and a timer for generating a fixed period signal. There is no need for new equipment. c is an interrupt signal generated whenever the time set in the general-purpose timer 12 times out, and is input to the central control unit 2 to start the interrupt processing program in the interrupt processing unit 8.

図2は本発明のプログラム暴走監視方法の処理手順を示すフローチャートである。なお、このフローチャートのS1〜S4、S6〜S8はウォッチドック処理部6で処理され、S5はイニシャル処理部4、S9は通常処理部5で処理される。まず、ウォッチドッグタイマ11にタイマ時間t3をセットする(S1)。なお、ウォッチドッグタイマ2に設定する時間がハードウェアで固定化され、プログラムで設定できない場合は本処理は不要であり、t3はハードウェアで固定化された時間となる。次に、汎用タイマ12にタイマ時間t4をセットする(S2)。なお、ここでt4はt3より短くなるように設定する。   FIG. 2 is a flowchart showing the processing procedure of the program runaway monitoring method of the present invention. In this flowchart, S1 to S4 and S6 to S8 are processed by the watchdog processing unit 6, S5 is processed by the initial processing unit 4, and S9 is processed by the normal processing unit 5. First, the timer time t3 is set in the watchdog timer 11 (S1). If the time set in the watchdog timer 2 is fixed by hardware and cannot be set by a program, this processing is unnecessary, and t3 is the time fixed by hardware. Next, the timer time t4 is set in the general-purpose timer 12 (S2). Here, t4 is set to be shorter than t3.

次に、汎用タイマ12によって起動される割込処理プログラムの中でウォッチドッグタイマ11をリセットする回数Nを変数iにセットする(S3)。なお、Nは、t4*Nがイニシャル処理時間t1より大きくなるように選択する。例えば、t1=500ms、t4=10msとすると、t4*N>t1であるため、N>500ms/10ms=50となり、Nは50より大きい値、すなわち51を変数iに設定する。同じように、イニシャル処理の追加、変更、移動が生じ、イニシャル処理時間t1が変わった場合も変数iに設定する値Nを変更すればよい。仮に、t1=1sに変わった場合は、N>1000ms/10ms=100となり、Nは100より大きい値、すなわち101を変数iに設定する。このように、イニシャル処理の追加、変更、移動が生じた場合はウォッチドッグタイマ2をリセットする回数Nを変更するだけで簡単に対応できる。   Next, the number N of times the watchdog timer 11 is reset in the interrupt processing program activated by the general-purpose timer 12 is set in the variable i (S3). N is selected so that t4 * N is longer than the initial processing time t1. For example, when t1 = 500 ms and t4 = 10 ms, since t4 * N> t1, N> 500 ms / 10 ms = 50, and N is set to a value larger than 50, that is, 51 to the variable i. Similarly, when the initial process is added, changed, or moved, and the initial process time t1 is changed, the value N set in the variable i may be changed. If it is changed to t1 = 1s, N> 1000 ms / 10 ms = 100, and N is set to a value larger than 100, that is, 101 to the variable i. As described above, when the initial process is added, changed, or moved, it can be easily dealt with by simply changing the number N of times the watchdog timer 2 is reset.

次に、汎用タイマ3の割込を許可する(S4)。
これにより、汎用タイマ12はt4ごとに割り込み信号cを図1の中央制御部2に出力する。中央制御部2の割り込み起動部7は割り込み処理部8の割り込み処理プログラムを起動する。
図3は割り込みプログラムの処理手順を示すフローチャートである。まず変数iが0以外かをチェックし(S11)、0以外ならウォッチドッグタイマをリセットし(S12)、変数iを1減算する(S13)。
図2の説明に戻ると、イニシャル処理を実行している間(S5)は、図3のS12の処理により、t4の間隔でウォッチドッグタイマ11はリセットされる。この処理は、処理回数がN回に達するまで繰り返される。t4*Nがイニシャル処理時間t1より大きくなるように選択しているので、イニシャル処理(S5)でウォッチドッグタイマ2がタイムアウトになることはない。もし、プログラムの暴走でイニシャル処理時間t1が延びた場合、すなわち処理回数がN回に達してもイニシャル処理が実行され続けていれば、ウォッチドッグタイマ11のリセットが行われないため、ウォッチドッグタイマ11のタイムアウトが発生し、プログラム暴走を検出することができる。
Next, the interrupt of the general-purpose timer 3 is permitted (S4).
As a result, the general-purpose timer 12 outputs an interrupt signal c to the central control unit 2 in FIG. 1 every t4. The interrupt activation unit 7 of the central control unit 2 activates the interrupt processing program of the interrupt processing unit 8.
FIG. 3 is a flowchart showing the processing procedure of the interrupt program. First, it is checked whether the variable i is other than 0 (S11). If it is not 0, the watchdog timer is reset (S12), and the variable i is decremented by 1 (S13).
Returning to the description of FIG. 2, during the initial process (S5), the watchdog timer 11 is reset at an interval of t4 by the process of S12 of FIG. This process is repeated until the number of processes reaches N. Since t4 * N is selected to be longer than the initial processing time t1, the watchdog timer 2 does not time out in the initial processing (S5). If the initial processing time t1 is extended due to a program runaway, that is, if the initial processing continues to be executed even if the number of processing reaches N times, the watchdog timer 11 is not reset. 11 timeouts occur, and program runaway can be detected.

イニシャル処理(S5)の終了後は、汎用タイマ12の割り込みを禁止する(S6)。次に、汎用タイマ12を他用途として使用するための設定を行う(S7)。例えば、汎用タイマ12を経過時間を算出するためのフリーランタイマとして使用するように設定する。以降、通常処理の一巡毎にウォッチドッグタイマ11のリセットを繰り返す(S8、S9)。なお、t1期間とt2期間でウォッチドッグタイマ11に設定する時間は異なっていてもよい。その場合は、t2期間での設定時間をt5とすると、t5のセットはS7の直後に行う。   After the completion of the initial process (S5), the interrupt of the general-purpose timer 12 is prohibited (S6). Next, settings are made to use the general-purpose timer 12 for other purposes (S7). For example, the general-purpose timer 12 is set to be used as a free-run timer for calculating the elapsed time. Thereafter, the resetting of the watchdog timer 11 is repeated for each round of normal processing (S8, S9). Note that the time set in the watchdog timer 11 may be different between the period t1 and the period t2. In that case, if the set time in the period t2 is t5, the setting of t5 is performed immediately after S7.

このように、本発明によれば、制御装置に一般的に装備されている汎用タイマと1個のウォッチドッグタイマを使用することにより、プログラムの暴走を検出し、暴走によるメモリ破壊等の不具合に至る前にすみやかにプログラムを再スタートあるいは停止可能とすることができる。   As described above, according to the present invention, by using the general-purpose timer and one watchdog timer that are generally equipped in the control device, the program runaway is detected, and the malfunction such as memory destruction due to the runaway is detected. The program can be restarted or stopped as soon as possible.

本発明の制御装置の構成を示すブロック図The block diagram which shows the structure of the control apparatus of this invention 本発明のプログラム暴走監視方法の処理手順を示すフローチャートThe flowchart which shows the process sequence of the program runaway monitoring method of this invention 割り込みプログラムの処理手順を示すフローチャートFlow chart showing interrupt program processing procedure 従来のウォッチドッグタイマを使用する制御装置の構成例を示すブロック図The block diagram which shows the structural example of the control apparatus which uses the conventional watchdog timer 従来のプログラムの処理手順を示すフローチャートThe flowchart which shows the processing procedure of the conventional program 従来のプログラム暴走監視方法の処理手順を示すフローチャートThe flowchart which shows the processing procedure of the conventional program runaway monitoring method

符号の説明Explanation of symbols

1、1A 制御装置
2、2A 中央制御部
3 CPU
4 イニシャル処理部
5 通常処理部
6、6A ウォッチドッグ処理部
7 割り込み起動部
8 割り込み処理部
11 ウォッチドッグタイマ
12 汎用タイマ
1, 1A control device 2, 2A central control unit 3 CPU
4 Initial processing unit 5 Normal processing unit 6, 6A Watchdog processing unit 7 Interrupt activation unit 8 Interrupt processing unit 11 Watchdog timer 12 General-purpose timer

Claims (8)

リセット信号によりリセット可能なタイマで、一定時間内にリセットされずタイムアウトした場合タイムアウト信号を出力するウォッチドッグタイマと、
装置全体の制御を行う中央制御部とから成り、
前記中央制御部に、CPUと、
電源投入時のイニシャル処理を行うイニシャル処理部と、
前記イニシャル処理後の通常時の処理を行う通常処理部と、
ウォッチドッグタイマのリセット処理を行うウォッチドッグ処理部と、を有する制御装置において、
前記制御装置内に汎用タイマを備え、
前記中央処理部に、前記汎用タイマがタイムアウトしたとき割り込み処理を起動する割り込み起動部と、
前記割り込み処理を実行する割り込み処理部とを備え、
前記ウォッチドッグ処理部は、前記汎用タイマのタイマ時間と、前記ウォッチドッグタイマをリセットする回数を設定し、
前記イニシャル処理実行中は汎用タイマからの割り込みを許可し、
前記割り込み処理で前記ウォッチドッグタイマを設定した回数だけリセットすることを特徴とする制御装置。
A timer that can be reset by a reset signal, a watchdog timer that outputs a timeout signal when a timeout occurs without being reset within a certain time, and
It consists of a central control unit that controls the entire device,
In the central control unit, a CPU,
An initial processing unit that performs initial processing at power-on;
A normal processing unit for performing normal processing after the initial processing;
In a control device having a watchdog processing unit for resetting a watchdog timer,
A general-purpose timer is provided in the control device,
An interrupt activation unit that activates an interrupt process when the general-purpose timer times out to the central processing unit;
An interrupt processing unit for executing the interrupt processing,
The watchdog processing unit sets the timer time of the general-purpose timer and the number of times to reset the watchdog timer,
While executing the initial process, enable interrupts from the general-purpose timer.
A control device that resets the watchdog timer a set number of times in the interrupt processing.
前記ウォッチドッグ処理部は、前記汎用タイマのタイマ時間を前記ウォッチドッグタイマのタイマ時間より短く設定することを特徴とする請求項1記載の制御装置。   The control device according to claim 1, wherein the watchdog processing unit sets a timer time of the general-purpose timer to be shorter than a timer time of the watchdog timer. 前記ウォッチドッグ処理部は、前記ウォッチドッグタイマをリセットする回数Nを、イニシャル処理時間をt1、汎用タイマのタイマ時間をt4としたとき、t4*N>t1となるような数で設定することを特徴とする請求項1記載の制御装置。   The watchdog processing unit sets the number of times N for resetting the watchdog timer in such a number that t4 * N> t1, where t1 is an initial processing time and t4 is a timer time of a general-purpose timer. The control device according to claim 1, wherein: 前記ウォッチドッグ処理部は、前記イニシャル処理終了後、前記汎用タイマの割り込みを禁止し、前記汎用タイマを他用途として使用するための設定をすることを特徴とする請求項1記載の制御装置。   The control device according to claim 1, wherein the watchdog processing unit prohibits the interruption of the general-purpose timer after the completion of the initial processing, and makes settings for using the general-purpose timer for other purposes. リセット信号によりリセット可能なタイマで、一定時間内にリセットされずタイムアウトした場合タイムアウト信号を出力するウォッチドッグタイマと、
装置全体の制御を行う中央制御部とから成り、
前記中央制御部に、CPUと、
電源投入時のイニシャル処理を行うイニシャル処理部と、
前記イニシャル処理後の通常時の処理を行う通常処理部と、
ウォッチドッグタイマのリセット処理を行うウォッチドッグ処理部と、を有する制御装置のプログラム暴走監視方法において、
前記制御装置内に汎用タイマを備え、
前記中央処理部に、前記汎用タイマがタイムアウトしたとき割り込み処理を起動する割り込み起動部と、
前記割り込み処理を実行する割り込み処理部とを備え、
前記汎用タイマのタイマ時間と、前記ウォッチドッグタイマをリセットする回数を設定し、
前記イニシャル処理実行中は汎用タイマからの割り込みを許可し、
前記割り込み処理で前記ウォッチドッグタイマを設定した回数だけリセットすることを特徴とする制御装置のプログラム暴走監視方法。
A timer that can be reset by a reset signal, a watchdog timer that outputs a timeout signal when a timeout occurs without being reset within a certain time, and
It consists of a central control unit that controls the entire device,
In the central control unit, a CPU,
An initial processing unit that performs initial processing at power-on;
A normal processing unit for performing normal processing after the initial processing;
In a program runaway monitoring method of a control device having a watchdog processing unit for resetting a watchdog timer,
A general-purpose timer is provided in the control device,
An interrupt activation unit that activates an interrupt process when the general-purpose timer times out to the central processing unit;
An interrupt processing unit for executing the interrupt processing,
Set the timer time of the general-purpose timer and the number of times to reset the watchdog timer,
While executing the initial process, enable interrupts from the general-purpose timer.
A program runaway monitoring method for a control apparatus, wherein the watchdog timer is reset a set number of times in the interrupt processing.
前記汎用タイマのタイマ時間を前記ウォッチドッグタイマのタイマ時間より短く設定することを特徴とする請求項5記載の制御装置のプログラム暴走監視方法。   6. The program runaway monitoring method for a control device according to claim 5, wherein a timer time of the general-purpose timer is set shorter than a timer time of the watchdog timer. 前記ウォッチドッグタイマをリセットする回数Nを、イニシャル処理時間をt1、汎用タイマのタイマ時間をt4としたとき、t4*N>t1となるような数で設定することを特徴とする請求項5記載の制御装置のプログラム暴走監視方法。   6. The number N of times for resetting the watchdog timer is set to a number such that t4 * N> t1, where t1 is an initial processing time and t4 is a timer time of a general-purpose timer. Program runaway monitoring method for the control unit of the system. 前記イニシャル処理終了後、前記汎用タイマの割り込みを禁止し、前記汎用タイマを他用途として使用するための設定をすることを特徴とする請求項5記載の制御装置のプログラム暴走監視方法。   6. The program runaway monitoring method for a control device according to claim 5, wherein after the initial process is finished, interrupting of the general-purpose timer is prohibited, and settings are made to use the general-purpose timer for other purposes.
JP2007062699A 2007-03-13 2007-03-13 Control device, and program runaway monitoring method for the same Pending JP2008225807A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007062699A JP2008225807A (en) 2007-03-13 2007-03-13 Control device, and program runaway monitoring method for the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007062699A JP2008225807A (en) 2007-03-13 2007-03-13 Control device, and program runaway monitoring method for the same

Publications (1)

Publication Number Publication Date
JP2008225807A true JP2008225807A (en) 2008-09-25

Family

ID=39844361

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007062699A Pending JP2008225807A (en) 2007-03-13 2007-03-13 Control device, and program runaway monitoring method for the same

Country Status (1)

Country Link
JP (1) JP2008225807A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013137425A1 (en) * 2012-03-16 2013-09-19 株式会社デンソー Circuit for monitoring abnormalities in ecu
CN104503799A (en) * 2014-12-29 2015-04-08 长园深瑞继保自动化有限公司 Method for performing uninterrupted control over peripherals in system starting process
WO2016194170A1 (en) * 2015-06-03 2016-12-08 株式会社日立製作所 Error detection device and error detection system
US9632855B2 (en) 2014-11-12 2017-04-25 Hyundai Motor Company Method and apparatus for controlling watchdog
CN109710441A (en) * 2018-12-20 2019-05-03 北京东土军悦科技有限公司 A kind of software watchdog, electronic equipment and computer storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013137425A1 (en) * 2012-03-16 2013-09-19 株式会社デンソー Circuit for monitoring abnormalities in ecu
JP2013196084A (en) * 2012-03-16 2013-09-30 Denso Corp Abnormality monitoring circuit of ecu
US9779559B2 (en) 2012-03-16 2017-10-03 Denso Corporation Circuit for monitoring abnormality of ECU
US9632855B2 (en) 2014-11-12 2017-04-25 Hyundai Motor Company Method and apparatus for controlling watchdog
CN104503799A (en) * 2014-12-29 2015-04-08 长园深瑞继保自动化有限公司 Method for performing uninterrupted control over peripherals in system starting process
WO2016194170A1 (en) * 2015-06-03 2016-12-08 株式会社日立製作所 Error detection device and error detection system
CN109710441A (en) * 2018-12-20 2019-05-03 北京东土军悦科技有限公司 A kind of software watchdog, electronic equipment and computer storage medium

Similar Documents

Publication Publication Date Title
US20100306602A1 (en) Semiconductor device and abnormality detecting method
JP2008225858A (en) Device, method and program for recovery from bios stall failure
JP5244981B2 (en) Microcomputer and operation method thereof
JP2008225807A (en) Control device, and program runaway monitoring method for the same
JP2007323631A (en) Cpu runaway determination circuit
CN104391754A (en) Method and device for processing task exception
JP5875558B2 (en) Information processing device
JPWO2013027529A1 (en) Detection of abnormal operation caused by interrupt processing
JP5771114B2 (en) Controller and how to handle tasks and ladders
CN101944056B (en) Method and device for monitoring multitask system
JP2006227962A (en) System and method for monitoring application task
JP2019020869A (en) Vehicle control device
JP2007226527A (en) Controller and watchdog timer
WO2018003560A1 (en) Electronic control device
JP5906807B2 (en) Arithmetic processing device and stall monitoring method
JPS5920061A (en) Watchdog timer
JP2005107757A (en) Method and device for detecting runaway of program
JP2017199180A (en) Image processing device
JP2005031724A (en) Abnormality detecting device
JPH11327959A (en) Method and device for monitoring abnormality of processor
JPH0683652A (en) Microcomputer system
JP2015014966A (en) Information processing device, information processing method, and information processing program
JP6485834B2 (en) Watchdog timer operation check method
JP2006099654A (en) Semiconductor circuit apparatus
JP2020013335A (en) Information processor and information processing method