JPH06309182A - Interrupt processing method - Google Patents

Interrupt processing method

Info

Publication number
JPH06309182A
JPH06309182A JP9462093A JP9462093A JPH06309182A JP H06309182 A JPH06309182 A JP H06309182A JP 9462093 A JP9462093 A JP 9462093A JP 9462093 A JP9462093 A JP 9462093A JP H06309182 A JPH06309182 A JP H06309182A
Authority
JP
Japan
Prior art keywords
interrupt
level
interrupt signal
interrupt processing
signal
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
JP9462093A
Other languages
Japanese (ja)
Inventor
Masakazu Ito
正和 伊藤
Goji Akiyama
剛司 秋山
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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox 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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP9462093A priority Critical patent/JPH06309182A/en
Publication of JPH06309182A publication Critical patent/JPH06309182A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide the interrupt processing method which performs filtering processing by software and executes interrupt processing without any delay at the time of the occurrence of an interrupt. CONSTITUTION:In the interrupt processing circuit where an interrupt occurs by the fall of an interrupt signal supplied to a CPU, the level of the interrupt signal is periodically discriminated to store two latest levels, and they are read out and the level of the interrupt signal is discriminated again at the time of the occurrence of an interrupt, and interrupt processing is performed when two latest levels are equal to each other and they are different from the level of the interrupt signal discriminated again.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、CPU (中央処理装
置) に供給される割り込み信号の立ち上がり或いは立ち
下がりで割り込みが発生する割り込み処理回路におい
て、割り込み信号が正規のものであるか否かを識別する
割り込み処理方法に関し、特に、ソフトウェアでフィル
タリング処理することによりノイズの影響を防止する割
り込み処理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention determines whether or not an interrupt signal is a normal one in an interrupt processing circuit in which an interrupt is generated at the rise or fall of an interrupt signal supplied to a CPU (central processing unit). The present invention relates to an interrupt processing method for identifying, and particularly to an interrupt processing method for preventing the influence of noise by performing a filtering process by software.

【0002】[0002]

【従来の技術】CPUを使用した電子装置においては、
装置の各部に配置されたセンサやスイッチの状態を、C
PUがプログラムに進行に従って順次検出し、この検出
結果に基づいて各種の制御が行われる。しかしながら、
場合によっては、現在実行されているプログラムとは無
関係に、センサやスイッチである状態が検出されたとき
には、この検出のタイミングに合わせて各種の処理をリ
アルタイムで行う必要が生じる。
2. Description of the Related Art In an electronic device using a CPU,
The state of the sensors and switches arranged in each part of the device
The PU sequentially detects as the program progresses, and various controls are performed based on the detection result. However,
In some cases, regardless of the program currently being executed, when a sensor or switch state is detected, it is necessary to perform various kinds of processing in real time at the timing of this detection.

【0003】そこでこのような要求に応ずるため、特定
センサやスイッチからの信号が入力されたときにはCP
Uに割り込みをかけて、割り込みプログラムを起動さ
せ、特定の処理を優先的に行わせることが行われてい
る。
Therefore, in order to meet such a request, when a signal from a specific sensor or switch is input, the CP
U is interrupted, an interrupt program is activated, and specific processing is preferentially performed.

【0004】CPUへの割り込みは、通常、入力信号の
立ち上がり或いは立ち下がりを検出して行われるが、入
力信号のレベルは、常に安定したものとは限らず、ノイ
ズやチャタリングのために、過渡的にレベルが不安にな
ることが多々ある。このため、誤って割り込み処理が行
われてしまうことがある。
Interrupts to the CPU are usually performed by detecting the rising or falling of the input signal. However, the level of the input signal is not always stable, and it is transient due to noise or chattering. There are many times when the level becomes uneasy. Therefore, interrupt processing may be erroneously performed.

【0005】そこで、ノイズの影響を防止するために、
入力回路には高周波成分を除去するためのコイルとコン
デンサからなるローパスフィルタ回路を設けることが一
般に行われている。しかしながら、このような個別部品
から構成されるローパスフィルタ回路を設けることは、
部品点数が増加すると共に部品を配置するための面積を
必要とするため好ましくまい。
Therefore, in order to prevent the influence of noise,
It is common practice to provide a low-pass filter circuit composed of a coil and a capacitor for removing high frequency components in the input circuit. However, providing a low-pass filter circuit composed of such individual components is
It is not preferable because the number of parts increases and an area for arranging parts is required.

【0006】そこで、昭63ー311402号公報に開
示されているように、ソフトウェア的にフィルタリング
処理を行うことが提案されている。同公報に記載の装置
においては、割り込み信号によって一定時間毎に前記入
力回路からの信号を読み出して、入力信号が一定時間幅
以上変化した場合、たとえば、同じ状態が2回続いたと
きに入力信号を有効なものとすることによりフィルタリ
ング処理を行っている。
Therefore, as disclosed in Japanese Patent Laid-Open No. 63-311402, it has been proposed to perform the filtering process by software. In the device described in the publication, when a signal from the input circuit is read at a constant time interval by an interrupt signal and the input signal changes for a predetermined time width or longer, for example, when the same state continues twice, The filtering process is performed by making

【0007】[0007]

【発明が解決しようとする課題】しかしながら、上記公
報に記載のフィルタリング処理では、外部からの割り込
みが発生してから、一定時間幅以上経過した時に、入力
信号を有効と見做しており、割り込みが発生してから、
割り込みと判断するのに時間がかかり、リアルタイムな
処理ができなくなるという問題が生じる。
However, in the filtering process described in the above publication, the input signal is regarded as valid when a certain time width or more elapses after the external interrupt occurs, and the interrupt process is performed. Has occurred,
There is a problem that it takes a long time to determine that it is an interrupt, and real-time processing cannot be performed.

【0008】また、割り込みが発生してから、一定周期
ごとにチェックを行い、変化がない時割り込み発生と判
断していたため、割り込み発生前の割り込み信号がどの
ような状態であるかチェックをしていない。よって、割
り込みが割り込み信号の立ち下がりのエッジをみる装置
ならば、割り込み発生前の状態がどのような時でも、図
3(b)に示すようなノイズS1が発生したならば、割
り込み発生とみなしてしまう。
Further, since an interrupt is generated, a check is performed at regular intervals, and when there is no change, it is determined that an interrupt has occurred. Therefore, the state of the interrupt signal before the interrupt is checked is checked. Absent. Therefore, if the interrupt is a device that looks at the falling edge of the interrupt signal, if the noise S1 as shown in FIG. 3B occurs at any time before the interrupt occurs, it is regarded as an interrupt occurrence. Will end up.

【0009】そこで本発明は、ソフトウェアでフィルタ
リング処理を行うことができ、しかも、割り込みが発生
した際には遅れることなく割り込み処理を実行すること
ができる割り込み処理方法を提供することを目的とす
る。
Therefore, an object of the present invention is to provide an interrupt processing method capable of performing a filtering process by software and capable of executing the interrupt process without delay when an interrupt occurs.

【0010】[0010]

【課題を解決するための手段】本発明は、前記目的を達
成するため、CPUに供給される割り込み信号の立ち上
がり或いは立ち下がりで割り込みが発生する割り込み処
理回路の割り込み処理方法において、一定周期で前記割
り込み信号のレベルを判別し、少なくとも2回分の最新
のレベルを記憶しておき、割り込み発生時に前記少なく
とも2回分の最新のレベルを読み出すと共に再度割り込
み信号のレベルを判別し、前記少なくとも2回分の最新
のレベルが同じであり、且つ、前記少なくとも2回分の
最新のレベルと前記再度判別した割り込み信号のレベル
が異なるとき、割り込み処理を行うことを特徴とする。
In order to achieve the above object, the present invention provides an interrupt processing method of an interrupt processing circuit in which an interrupt is generated at a rising edge or a falling edge of an interrupt signal supplied to a CPU. The level of the interrupt signal is determined, the latest level for at least two times is stored, the latest level for at least two times is read when an interrupt occurs, the level of the interrupt signal is determined again, and the latest level for at least two times is determined. Is the same, and the latest level for at least two times and the level of the interrupt signal determined again are different, interrupt processing is performed.

【0011】[0011]

【作用】CPUは一定周期で前記割り込み信号のレベル
を判別しており、少なくとも2回分の最新のレベルを記
憶する。割り込み発生時には、最新のレベルを読み出す
と共に再度割り込み信号のレベルを判別し、2回分の最
新のレベルが同じであり、且つ、前記少なくとも2回分
の最新のレベルと前記再度判別した割り込み信号のレベ
ルが異なるときのみ、割り込み処理を行う。これによ
り、割り込みのノイズが発生したような場合には、割り
込み処理は行われない。割り込み信号のレベルの再判別
には、数μs程度しか時間がかからないので、割り込み
発生後直ぐに割り込み処理を行う事ができる。
The CPU discriminates the level of the interrupt signal at regular intervals and stores the latest level for at least two times. When an interrupt occurs, the latest level is read out and the level of the interrupt signal is determined again, the latest levels for two times are the same, and the latest level for at least two times and the level for the interrupt signal determined again are the same. Only when they are different, interrupt processing is performed. As a result, the interrupt processing is not performed when the interrupt noise occurs. Re-determining the level of the interrupt signal takes only a few μs, so the interrupt process can be performed immediately after the interrupt occurs.

【0012】[0012]

【実施例】以下、図面を参照しながら実施例に基づいて
本発明の特徴を具体的に説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The features of the present invention will be specifically described below based on embodiments with reference to the drawings.

【0013】図1は、本発明の割り込み処理方法が適用
される割り込み処理回路のブロック図である。
FIG. 1 is a block diagram of an interrupt processing circuit to which the interrupt processing method of the present invention is applied.

【0014】CPU1に対してバス2を介してROM
(読み出し専用メモリ)3やRAM(ランダムアクセス
メモリ)4が接続されている。ROM3には、CPU1
で実行される主プログラムや、割り込み発生時に実行さ
れる割り込みプログラムが格納されている。また、RA
M4はプログラム実行の際にテーブルやワークエリアと
して使用される。また、CPU1には、割り込み信号発
生回路1からの割り込み信号INTが供給される。割り
込み信号発生回路1は、たとえば、装置内に設けられた
特定のスイッチやセンサがオンとなったときに、一定時
間だけハイレベルとなる割り込み信号INTを発生させ
るものである。なお、本実施例においては、割り込み信
号INTの立ち下がりでCPU1に割り込みがかかるも
のとする。また、割り込み信号INTは、インターフェ
ース6を介してバス2に供給され、割り込み信号INT
のレベルは、CPU1により一定時間毎、たとえば、1
0ms毎に判別される。
ROM for CPU 1 via bus 2
(Read-only memory) 3 and RAM (random access memory) 4 are connected. CPU1 in ROM3
Stores the main program executed in and the interrupt program executed when an interrupt occurs. Also, RA
M4 is used as a table or work area when the program is executed. Further, the interrupt signal INT from the interrupt signal generation circuit 1 is supplied to the CPU 1. The interrupt signal generation circuit 1 is for generating an interrupt signal INT that is at a high level for a certain period of time, for example, when a specific switch or sensor provided in the device is turned on. In this embodiment, the CPU 1 is interrupted at the falling edge of the interrupt signal INT. Further, the interrupt signal INT is supplied to the bus 2 via the interface 6, and the interrupt signal INT
Is set by the CPU 1 at regular intervals, for example, 1
It is determined every 0 ms.

【0015】次に、上述の割り込み処理回路の動作につ
いて図2のフローチャートを参照して説明する。
Next, the operation of the above interrupt processing circuit will be described with reference to the flowchart of FIG.

【0016】CPU1は、内蔵されたタイマにより10
ms毎にインターフェース6及びバス2を介して割り込
み信号INTのレベルを判別し、最新の2回分のレベル
を示すデータを、RAM4に設けられたテーブルに順次
更新しながら書き込んでいく。したがって、RAM4の
テーブルには、現時点から10ms前の割り込み信号I
NTのレベルと、20ms前の割り込み信号INTのレ
ベルとが書き込まれる。
The CPU 1 has a built-in timer for 10
The level of the interrupt signal INT is discriminated via the interface 6 and the bus 2 every ms, and the latest two levels of data are sequentially updated and written in the table provided in the RAM 4. Therefore, in the table of the RAM4, the interrupt signal I 10 ms before the present time
The NT level and the interrupt signal INT level 20 ms before are written.

【0017】割り込み信号INTが立ち下がると割り込
みが発生し、CPU1によりRAM4のテーブルが参照
され、10ms前の割り込み信号INTのレベルと20
ms前の割り込み信号INTのレベルが判別され (ステ
ップ101,102)、両方共ハイレベルである場合に
は、更に現在の割り込み信号INTのレベルが判別され
(ステップ103)、ローレベルである場合には、真の
割り込みであると判断し割り込み処理が行われる。割り
込み信号のレベルの再判別には、数μs程度しか時間が
かからないので、割り込み発生後直ぐに割り込み処理を
行う事ができる。
When the interrupt signal INT falls, an interrupt occurs, the CPU 1 refers to the table of the RAM 4 and the level of the interrupt signal INT 10 ms before and 20
The level of the interrupt signal INT before ms is determined (steps 101 and 102), and if both are high levels, the current level of the interrupt signal INT is further determined.
(Step 103) If the level is low, it is determined that the interrupt is a true interrupt and interrupt processing is performed. Re-determining the level of the interrupt signal takes only a few μs, so the interrupt process can be performed immediately after the interrupt occurs.

【0018】先ず、正規の割り込み信号INTが入力し
た場合について説明する。なお、本実施例においては、
正規の割り込み信号INTとは、図3(a)に示すよう
に、ローレベルからハイレベルに立ち上がり、比較的長
い時間、たとえば、1000ms程度、ハイレベルを維
持した後、ローレベルに立ち下がる信号を意味するもの
とする。
First, the case where the regular interrupt signal INT is input will be described. In this example,
As shown in FIG. 3A, the regular interrupt signal INT is a signal that rises from a low level to a high level, maintains the high level for a relatively long time, for example, about 1000 ms, and then falls to the low level. Shall mean.

【0019】この場合には、信号の立ち下がりでCPU
1に割り込みが発生し、現時点から10ms前と20m
s前の割り込み信号INTのレベルは双方ともハイレベ
ルであり、現在のレベルはローレベルであるので、ステ
ップ101,102,103,104と進み、割り込み
処理が行われる。
In this case, when the signal falls, the CPU
An interrupt occurs at 1, 10ms before and 20m from the current time
Both of the interrupt signals INT before s are at high level and the current level is at low level, so that the process proceeds to steps 101, 102, 103 and 104 to perform interrupt processing.

【0020】次に、同図(b)に示すように、正方向の
ノイズS1が割り込み信号としてCPU1に供給された
場合、ノイズS1の立ち下がりでCPU1に割り込みが
発生するが、現時点から10ms前及び20ms前はロ
ーレベルであるので割り込み処理は行われない。
Next, as shown in FIG. 2B, when the noise S1 in the positive direction is supplied to the CPU 1 as an interrupt signal, an interrupt occurs in the CPU 1 at the falling edge of the noise S1, but 10 ms before the current time. Since it is low level before and 20 ms before, interrupt processing is not performed.

【0021】また、同図(c)に示すように、割り込み
信号INTに負方向のノイズS2が混入したような場
合、CPU1にはノイズS2の立ち下がり時点で割り込
みが発生する。同図(c)に示す例の場合、10ms前
のレベル及び20ms前のレベルの双方がハイレベルで
あるのでステップ103に進む。CPU1がRAM4の
テーブルを参照し、レベルを判別している間に僅かに時
間が経過するので、ステップ103で再度割り込み信号
INTのレベルを判別したときには、レベルはハイレベ
ルに戻っている。したがって、この場合には、割り込み
処理が行われることはなく、ノイズで誤動作することが
ない。
Further, as shown in FIG. 3C, when the noise S2 in the negative direction is mixed in the interrupt signal INT, the CPU 1 is interrupted at the falling edge of the noise S2. In the case of the example shown in FIG. 7C, both the level before 10 ms and the level before 20 ms are high levels, so the routine proceeds to step 103. Since the CPU 1 refers to the table in the RAM 4 and slightly determines the level, when the level of the interrupt signal INT is determined again in step 103, the level returns to the high level. Therefore, in this case, interrupt processing is not performed, and noise does not cause malfunction.

【0022】なお、上述の実施例においては、割り込み
信号の立ち下がりで割り込みが発生する場合について説
明したが、割り込み信号の立ち上がりで割り込みが発生
する場合にも本発明を適用することができる。
In the above embodiment, the case where the interrupt occurs at the falling edge of the interrupt signal has been described, but the present invention can be applied to the case where the interrupt occurs at the rising edge of the interrupt signal.

【0023】[0023]

【発明の効果】以上に述べたように、本発明によれば、
割り込みが発生したときに、割り込み信号が一定時間だ
け所定のレベルを維持しているか否かを判別すると共
に、その後にレベルが変化しているか否かを判別するこ
とにより、割り込み信号が正規なものであるか否かを判
別しているので、ノイズの影響を受けることがなく、し
かも、割り込み信号の立ち上がりや、立ち下がりから遅
れることなく割り込み処理を行わせることができる。
As described above, according to the present invention,
When an interrupt occurs, it determines whether the interrupt signal remains at a predetermined level for a certain period of time, and then determines whether the level has changed. Therefore, it is possible to perform the interrupt processing without being affected by noise and without delay from the rise or fall of the interrupt signal.

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

【図1】 本発明の割り込み処理方法が適用される割り
込み処理回路のブロック図である。
FIG. 1 is a block diagram of an interrupt processing circuit to which an interrupt processing method of the present invention is applied.

【図2】 本発明の割り込み処理方法を説明するための
フローチャートである。
FIG. 2 is a flowchart for explaining an interrupt processing method of the present invention.

【図3】 正規の割り込み信号或いはノイズが入力され
たときの処理を説明するためのタイミングチャートであ
る。
FIG. 3 is a timing chart for explaining processing when a regular interrupt signal or noise is input.

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

1…CPU、2…バス、3…ROM、4…RAM、5…
割り込み信号発生回路、6…インターフェース
1 ... CPU, 2 ... Bus, 3 ... ROM, 4 ... RAM, 5 ...
Interrupt signal generation circuit, 6 ... Interface

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 CPUに供給される割り込み信号の立ち
上がり或いは立ち下がりで割り込みが発生する割り込み
処理回路の割り込み処理方法において、一定周期で前記
割り込み信号のレベルを判別し、少なくとも2回分の最
新のレベルを記憶しておき、割り込み発生時に前記少な
くとも2回分の最新のレベルを読み出すと共に再度割り
込み信号のレベルを判別し、前記少なくとも2回分の最
新のレベルが同じであり、且つ、前記少なくとも2回分
の最新のレベルと前記再度判別した割り込み信号のレベ
ルが異なるとき、割り込み処理を行うことを特徴とする
割り込み処理方法。
1. An interrupt processing method for an interrupt processing circuit in which an interrupt is generated at the rising or falling edge of an interrupt signal supplied to a CPU, wherein the level of the interrupt signal is determined at a constant cycle, and the latest level for at least two times is determined. When the interrupt occurs, the latest level for at least two times is read and the level of the interrupt signal is determined again, the latest level for at least two times is the same, and the latest level for at least two times is stored. The interrupt processing method is characterized in that the interrupt processing is performed when the level of the interrupt signal and the level of the interrupt signal determined again are different.
JP9462093A 1993-04-21 1993-04-21 Interrupt processing method Pending JPH06309182A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9462093A JPH06309182A (en) 1993-04-21 1993-04-21 Interrupt processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9462093A JPH06309182A (en) 1993-04-21 1993-04-21 Interrupt processing method

Publications (1)

Publication Number Publication Date
JPH06309182A true JPH06309182A (en) 1994-11-04

Family

ID=14115307

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9462093A Pending JPH06309182A (en) 1993-04-21 1993-04-21 Interrupt processing method

Country Status (1)

Country Link
JP (1) JPH06309182A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110232A (en) * 1997-10-08 1999-04-23 Fujitsu Ltd Time management change device and external interrupt protection device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110232A (en) * 1997-10-08 1999-04-23 Fujitsu Ltd Time management change device and external interrupt protection device

Similar Documents

Publication Publication Date Title
US4405982A (en) Arrangement for monitoring the function of a programmable electronic switching circuit
AU2010307632B2 (en) Microcomputer and operation method thereof
JPH03288942A (en) Program run-away detecting method for microcomputer
GB2129587A (en) A method of and apparatus for fail-safe operation of a vehicle computer
JPH06324914A (en) Runaway detecting method for computer
JPH06309182A (en) Interrupt processing method
JPH09198258A (en) Task stack overflow detecting circuit
JP3088395B2 (en) Switch interrupt processing circuit and switch interrupt processing method
JPH05501168A (en) Microprocessor circuit device with watchdog circuit and method for monitoring the flow of its processor program
JPS59201123A (en) Interruption processing system
US20030093725A1 (en) Method and circuit for monitoring microcomputer for onboard electronic control device
JP2978820B2 (en) Information processing device activation method
JP2629382B2 (en) Programmable controller system
US20040015741A1 (en) Watchdog device operation
KR0125945B1 (en) Method of operating monitoring for processor
JP3082806B2 (en) Fault diagnosis device
JP2731386B2 (en) Control device
JPH09222938A (en) Power source controller
JP3009238B2 (en) Register failure detection device for microcomputer addition
JP3130858B2 (en) Remote control signal receiving device and receiving method thereof
JPH09237205A (en) Program runaway detection device
JP3593768B2 (en) Input signal processing device
JP3406418B2 (en) Power failure interrupt signal detection circuit
JPH0667755A (en) Circuit board mounting/dismounting detecting system
JPH0635757A (en) Abnormality detector of cpu