JPH0727480B2 - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0727480B2
JPH0727480B2 JP63124272A JP12427288A JPH0727480B2 JP H0727480 B2 JPH0727480 B2 JP H0727480B2 JP 63124272 A JP63124272 A JP 63124272A JP 12427288 A JP12427288 A JP 12427288A JP H0727480 B2 JPH0727480 B2 JP H0727480B2
Authority
JP
Japan
Prior art keywords
microcomputer
address
program counter
execution
reset
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.)
Expired - Fee Related
Application number
JP63124272A
Other languages
Japanese (ja)
Other versions
JPH01293448A (en
Inventor
崇 内貴
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.)
Rohm Co Ltd
Original Assignee
Rohm 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 Rohm Co Ltd filed Critical Rohm Co Ltd
Priority to JP63124272A priority Critical patent/JPH0727480B2/en
Publication of JPH01293448A publication Critical patent/JPH01293448A/en
Publication of JPH0727480B2 publication Critical patent/JPH0727480B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Description

【発明の詳細な説明】 (a)産業上の利用分野 この発明はメモリにストアされたプログラムを順次実行
するマイクロコンピュータに関する。
The present invention relates to a microcomputer that sequentially executes programs stored in a memory.

(b)従来の技術 一般に、マイクロコンピュータは所定の処理内容をROM
などに予め書き込んでおくことによって、特定の処理を
行うコントローラとして種々の電子機器内に組み込まれ
ている。
(B) Conventional Technology Generally, a microcomputer stores predetermined processing contents in a ROM.
It is incorporated in various electronic devices as a controller that performs a specific process by writing it in advance.

このようなマイクロコンピュータを用いて電子機器など
の制御を行う装置を設計する際に特に注意すべき点は、
如何にして異常動作の発生を防止するかである。マイク
ロコンピュータが異常動作する原因は主に瞬時停電や外
来雑音などであるが、このような影響を受けないよう
に、一般にハードウェアに対策が講じられている。しか
しながら電源電圧の変動が緩慢であったり、予期せぬ強
力な雑音が発生する場合があり、ハードウェアによる対
策だけでは異常動作に対する十分な信頼性が確保できな
い場合があった。
Special points to note when designing a device that controls electronic equipment using such a microcomputer are:
How to prevent the occurrence of abnormal operation. The cause of abnormal operation of the microcomputer is mainly due to momentary power failure or external noise, but hardware is generally provided with measures to prevent such influence. However, the fluctuation of the power supply voltage may be slow, or unexpectedly strong noise may occur, and it may be impossible to secure sufficient reliability against abnormal operation only by taking measures by hardware.

そこで、異常動作が発生したとき、これを直ちに検知し
て動作を停止または再起動させる手段も利用されてい
る。たとえばウォッチドグタイマによって異常動作の発
生を検知することが行われている。これは所定bit数の
カウンタとこのカウンタを一定時間間隔でカウントアッ
プするタイミング信号を発生する回路およびカウント値
が所定値に達したときマイクロコンピュータをリセット
する回路を設けておき、プログラムの実行中に所定時間
間隔で前記タイマをリセットする処理を挿入しておくも
のである。したがってプログラムが正常に動作している
ときは、タイマがタイムアップすることがなくマイクロ
コンピュータがリセットされることはないが、何らかの
原因で異常動作すれば、プログラムが正しく実行されな
いため、タイマをリセットする処理が実行されずに一定
時間経過したときの前記タイマがタイムアップしてマイ
クロコンピュータが強制的にリセットされる。
Therefore, a means for immediately detecting an abnormal operation and stopping or restarting the operation is also used. For example, a watchdog timer is used to detect the occurrence of abnormal operation. This is provided with a counter of a predetermined number of bits, a circuit that generates a timing signal that counts up this counter at fixed time intervals, and a circuit that resets the microcomputer when the count value reaches a predetermined value. A process for resetting the timer is inserted at a predetermined time interval. Therefore, when the program is operating normally, the timer will not expire and the microcomputer will not be reset.However, if the program malfunctions for some reason, the program will not run correctly and the timer will be reset. When a certain period of time elapses without executing the process, the timer expires and the microcomputer is forcibly reset.

(c)発明が解決しようとする課題 ところが、このようなウォッチドグタイマを用いて異常
動作を検知する従来のマイクロコンピュータにおいては
次のような問題があった。
(C) Problem to be Solved by the Invention However, the conventional microcomputer that detects an abnormal operation using such a watchdog timer has the following problems.

第2図はマイクロコンピュータの処理手順の一例を表す
フローチャートである。マイクロコンピュータに電源が
投入されてACL回路が作動すれば、マイクロコンピュー
タは自動的に実行開始アドレスから実行を開始し、先ず
所定の初期設定を行い、その後、処理Aを行う(n1→n
2)。続いてウォッチドグタイマのタイマをリセットし
て所定の条件判断を行う(n3→n4)。この判断がONであ
れば処理Bを行って再びn2へ戻る(n5→n2)。n4の条件
判断でYESとなれば処理Cを行いタイマをリセットする
(n6→n7)。このように適当なタイミングでタイマをリ
セットすればウォッチドグタイマによる強制的なリセッ
トが掛けられないが、もし何らかの原因でマイクロコン
ピュータの起動時にプログラムの途中から実行を開始し
たような場合、条件によっては完全な暴走を行わずに、
タイマをリセットする処理を正常に行うことがある。例
えば、第2図に示した例では、n1の初期設定が行われず
に、n2から実行が開始され、n2〜n5のループを実行する
ことがある。しかしならn1の初期設定が行われていない
ために、n4の条件判断が常にNOとなって、このループを
永久に繰り返すといったことも起こり得る。このような
問題を解消するためには起動時の実行開始アドレスが正
常であることを検出するためのプログラムを設けておく
ことが必要であるが、そのためにはプログラム全体が複
雑化し、その容量も増大するという問題があった。
FIG. 2 is a flowchart showing an example of the processing procedure of the microcomputer. If the microcomputer is powered on and the ACL circuit is activated, the microcomputer automatically starts execution from the execution start address, first performs a predetermined initialization, and then performs the process A (n1 → n).
2). Then, the timer of the watchdog timer is reset to make a predetermined condition judgment (n3 → n4). If this determination is ON, the process B is performed and the process returns to n2 again (n5 → n2). If YES in the condition judgment of n4, process C is performed and the timer is reset (n6 → n7). If the timer is reset at an appropriate timing in this way, the watchdog timer cannot be forcibly reset, but if for some reason the microcomputer starts running in the middle of the program, depending on the conditions, Without a complete runaway,
The process to reset the timer may be performed normally. For example, in the example shown in FIG. 2, execution may be started from n2 and n2 to n5 may be executed without initializing n1. However, since the initial setting of n1 has not been performed, the condition judgment of n4 may always be NO, and this loop may be repeated forever. In order to solve such a problem, it is necessary to provide a program for detecting that the execution start address at startup is normal, but for that purpose, the entire program becomes complicated and its capacity is also increased. There was a problem of increase.

この発明の目的は起動時に正常なアドレスから実行が開
始されているか否かを検出できるようにして、異常動作
の続行を防止できるようにしたマイクロコンピュータを
提供することにある。
An object of the present invention is to provide a microcomputer capable of detecting whether or not execution is started from a normal address at the time of start-up and preventing continuation of an abnormal operation.

(d)課題を解決するための手段 この発明のマイクロコンピュータは、予め定めた起動時
の正常な実行開始アドレスとプログラムカウンタの内容
との一致検出を行うアドレス一致検出手段と、 このアドレス一致検出手段の検出結果を記憶する検出結
果記憶手段と、 起動後の所定チェックタイミングで前記検出結果記憶手
段の内容をチェックし、前記アドレス一致検出手段が前
記正常な実行開始アドレスと前記プログラムカウンタの
内容との一致を検出していなかったとき、リセット信号
を発生するリセット信号発生手段と、 を備えたことを特徴としている。
(D) Means for Solving the Problem The microcomputer of the present invention is an address coincidence detecting means for performing coincidence detection between a predetermined normal execution start address at startup and the contents of the program counter, and the address coincidence detecting means. Of the detection result storage means for storing the detection result of, and the content of the detection result storage means is checked at a predetermined check timing after activation, and the address coincidence detection means compares the normal execution start address with the content of the program counter. And a reset signal generating means for generating a reset signal when no match is detected.

(e)作用 この発明のマイクロコンピュータでは、アドレス一致検
出手段は予め定めた起動時の正常な実行開始アドレスと
プログラムカウンタの内容との一致検出を行い、検出結
果記憶手段はアドレス一致検出手段の検出結果を記憶
し、リセット信号発生手段は起動後の所定のチェックタ
イミングで前記検出結果記憶手段の内容をチェックし、
前記アドレス一致検出手段が前記正常な実行開始アドレ
スと前記プログラムカウンタの内容との一致を検出して
いなかったとき、リセット信号を発生する。これによ
り、何らかの原因でマイクロコンピュータの起動時に正
常な実行開始アドレスから実行が開始されなかったか
ら、チェックタイミングで前記検出器結果記憶手段の内
容がチェックされ、リセット信号が発生される。このリ
セット信号によりマイクロコンピュータは再度起動し、
マイクロコンピュータは正常な実行開始アドレスから実
行を開始することになる。即ち、本願発明によれば、起
動時に正常なアドレスから実行が開始されなかったこと
による異常動作の続行が確実に防止され、且つ正常状態
に自動復帰する。
(E) Function In the microcomputer of the present invention, the address match detection means detects a match between the predetermined normal start address at the time of startup and the contents of the program counter, and the detection result storage means detects the address match detection means. The result is stored, the reset signal generating means checks the content of the detection result storing means at a predetermined check timing after starting,
A reset signal is generated when the address match detection means does not detect a match between the normal execution start address and the contents of the program counter. As a result, the execution is not started from the normal execution start address when the microcomputer is started for some reason, so the contents of the detector result storage means are checked at the check timing, and the reset signal is generated. This reset signal restarts the microcomputer,
The microcomputer will start execution from the normal execution start address. That is, according to the invention of the present application, continuation of the abnormal operation due to the fact that the execution is not started from the normal address at the time of startup is surely prevented, and the normal state is automatically restored.

(f)実施例 第1図はこの発明の実施例であるマイクロコンピュータ
の主要部の回路図である。図において1はプログラムカ
ウンタ、2はNORゲート、3はラッチ回路、4はインバ
ータ、5はANDゲートである。プログラムカウンタ1は
図に示した例では10bit構成であり、CPUが実行すべき命
令のアドレスが格納され、命令の実行段階に自動的にカ
ウントアップ(+1)される。但し、ジャンプ命令の場
合は実行段階でジャンプ先のアドレスが格納される。NO
Rゲート2はプログラムカウンタ1の各bitの否定論理和
を求める。従ってプログラムカウンタ1の内容が000000
0000であるときにのみ、その出力を1とする。ラッチ回
路3はNORゲート2の出力状態を一時記憶する。ANDゲー
ト5はラッチ回路3の否定信号とプログラムカウンタ1
の第2bit(最下位bitから3bit目)との論理積を求め、
その結果をマイクロコンピュータのリセット信号として
発生させる。
(F) Embodiment FIG. 1 is a circuit diagram of a main part of a microcomputer according to an embodiment of the present invention. In the figure, 1 is a program counter, 2 is a NOR gate, 3 is a latch circuit, 4 is an inverter, and 5 is an AND gate. The program counter 1 has a 10-bit configuration in the example shown in the figure, stores the address of an instruction to be executed by the CPU, and automatically counts up (+1) at the instruction execution stage. However, in the case of a jump instruction, the jump destination address is stored at the execution stage. NO
The R gate 2 calculates the NOR of each bit of the program counter 1. Therefore, the contents of program counter 1 is 000000
Only when it is 0000, the output is set to 1. The latch circuit 3 temporarily stores the output state of the NOR gate 2. AND gate 5 is a negative signal of latch circuit 3 and program counter 1
The logical product with the 2nd bit (3rd bit from the least significant bit) of
The result is generated as a reset signal for the microcomputer.

以上に示した構成において、プログラムカウンタ1およ
びNORゲート2はこの発明に係る「アドレス一致検出手
段」に相当し、ラッチ回路3は「検出結果記憶手段」に
相当し、インバータ4とANDゲート5およびプログラム
カウンタ1(特にその第2ビットのビットセル)は「リ
セット信号発生手段」に相当している。すなわち、先ず
マイクロコンピュータに電源が投入されてACL(オート
クリア)回路が作動すれば、プログラムカンタ1の内容
が0000000000となるため、NORゲート2の出力が1とな
りラッチ回路3にその状態が記憶される。しがたってイ
ンバータ4の出力は0である。このため、その後プログ
ラムが順次実行されて、プログラムカウンタ1の第2bit
が1となってもANDゲート5の出力は0のままでありリ
セットは行われない。
In the configuration described above, the program counter 1 and the NOR gate 2 correspond to the "address coincidence detecting means" according to the present invention, the latch circuit 3 corresponds to the "detection result storing means", the inverter 4 and the AND gate 5 and The program counter 1 (particularly the bit cell of the second bit thereof) corresponds to "reset signal generating means". That is, when the microcomputer is powered on and the ACL (auto clear) circuit is activated, the contents of the program counter 1 becomes 0000000000, so the output of the NOR gate 2 becomes 1 and the state is stored in the latch circuit 3. It Therefore, the output of the inverter 4 is zero. Therefore, the programs are sequentially executed after that, and the second bit of the program counter 1
Even if becomes 1, the output of the AND gate 5 remains 0 and the reset is not performed.

もし起動時に正常な実行開始アドレスすなわち00000000
00から実行が開始されなかった場合はNORゲート2の出
力が0となり、ラッチ回路3にその状態が記憶される。
その後プログラムカウンタの第2bitの内容が1となれ
ば、ANDゲートの出力が1となってマイクロコンピュー
タ全体に強制的にリセットが掛けられる。これによりプ
ログラムカウンタ1の内容が0000000000となって、正常
なアドレスから実行が開始される。
If it is a normal execution start address at startup, ie 00000000
When the execution is not started from 00, the output of the NOR gate 2 becomes 0 and the state is stored in the latch circuit 3.
After that, if the content of the second bit of the program counter becomes 1, the output of the AND gate becomes 1 and the entire microcomputer is forcibly reset. As a result, the content of the program counter 1 becomes 0000000000, and execution is started from a normal address.

なお、実施例では異常な状態を検出したときマイクロコ
ンピュータ全体を強制的にリセットする例であったが、
その他に、例えばプログラムを停止させるとともに異常
状態を報知するように構成してもよい。
In the embodiment, the example in which the entire microcomputer is forcibly reset when an abnormal state is detected,
In addition, for example, the program may be stopped and the abnormal state may be notified.

(g)発明の効果 以上のようにこの発明によれば、起動時に開始すべき正
常な実行開始アドレスから実行が開始されなかったこと
を検出して、自動的にリセット信号を発生するように構
成したため、プログラムが複雑化したり、その容量が増
大することなく、正常な起動が行なわれなかったことに
よる異常動作を確実に防止し、且つ正常状態に自動復帰
することができる。
(G) Effect of the Invention As described above, according to the present invention, the reset signal is automatically generated by detecting that the execution has not been started from the normal execution start address that should be started at the time of startup. Therefore, the program does not become complicated and its capacity does not increase, and it is possible to reliably prevent an abnormal operation due to the failure to start normally and to automatically restore the normal state.

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

第1図はこの発明の実施例であるマイクロコンピュータ
の主要部の構成を示す回路図である。第2図はウォッチ
ドグタイマを用いた従来のマイクロコンピュータの行う
処理手順の一例を表すフローチャートである。
FIG. 1 is a circuit diagram showing a configuration of a main part of a microcomputer which is an embodiment of the present invention. FIG. 2 is a flowchart showing an example of a processing procedure performed by a conventional microcomputer using a watchdog timer.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】予め定めた起動時の正常な実行開始アドレ
スとプログラムカウンタの内容との一致検出を行うアド
レス一致検出手段と、 このアドレス一致検出手段の検出結果を記憶する検出結
果記憶手段と、 起動後の所定のチェックタイミングで前記検出結果記憶
手段の内容をチェックし、前記アドレス一致検出手段が
前記正常な実行開始アドレスと前記プログラムカウンタ
の内容との一致を検出していなかったとき、リセット信
号を発生するリセット信号発生手段と、 を備えたことを特徴とするマイクロコンピュータ。
1. An address coincidence detection means for performing coincidence detection between a predetermined normal execution start address at startup and the contents of the program counter, and a detection result storage means for storing the detection result of the address coincidence detection means. When the content of the detection result storage means is checked at a predetermined check timing after activation, and the address match detection means does not detect a match between the normal execution start address and the content of the program counter, a reset signal A reset signal generating means for generating a signal, and a microcomputer.
JP63124272A 1988-05-20 1988-05-20 Microcomputer Expired - Fee Related JPH0727480B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63124272A JPH0727480B2 (en) 1988-05-20 1988-05-20 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63124272A JPH0727480B2 (en) 1988-05-20 1988-05-20 Microcomputer

Publications (2)

Publication Number Publication Date
JPH01293448A JPH01293448A (en) 1989-11-27
JPH0727480B2 true JPH0727480B2 (en) 1995-03-29

Family

ID=14881231

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63124272A Expired - Fee Related JPH0727480B2 (en) 1988-05-20 1988-05-20 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0727480B2 (en)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5828341U (en) * 1981-08-17 1983-02-23 三菱電機株式会社 Computer program execution confirmation device

Also Published As

Publication number Publication date
JPH01293448A (en) 1989-11-27

Similar Documents

Publication Publication Date Title
US8954801B2 (en) Microcomputer and method of operation thereof
US4827149A (en) Operation halting circuit
JP2696511B2 (en) Return method from power down mode
JPS62157953A (en) Microcomputer provided with abnormality detecting function
US11163643B2 (en) Boot data validity
US8269526B2 (en) Apparatus for detecting presence or absence of oscillation of clock signal
JPH0727480B2 (en) Microcomputer
JPH11259340A (en) Reactivation control circuit for computer
US6567930B1 (en) Method and apparatus for controlling writing of flash EEPROM by microcomputer
JP2659067B2 (en) Microcomputer reset circuit
JPH01288934A (en) Double microcomputer system runaway preventing circuit
CN110018929B (en) Data backup method, device, equipment and storage medium
JP2000163274A (en) Electronic equipment and recording medium with rom data monitoring program recorded thereon
JPH0120775B2 (en)
JP2001242901A (en) Device for detecting malfunction of programmable controller
KR100459225B1 (en) Processor Having Frame Structure
JPS59185170A (en) Control system for inverter
JPH06103480B2 (en) Blackout processor
JP2012069063A (en) P-run signal output device and incorporated control device
JPH09190360A (en) Microcomputer and its ranaway monitoring processing method
JPH09212201A (en) Control circuit for production facility
KR20040000205A (en) Method of initializing value error detection and recovering in embedded system
JPH0786794B2 (en) Blackout control circuit
JPS63123138A (en) Detection circuit for out-of-control of microcomputer
JPH05143478A (en) Device for protecting contents of non-volatile memory

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees