JPS60247745A - Interruption control circuit - Google Patents

Interruption control circuit

Info

Publication number
JPS60247745A
JPS60247745A JP10527984A JP10527984A JPS60247745A JP S60247745 A JPS60247745 A JP S60247745A JP 10527984 A JP10527984 A JP 10527984A JP 10527984 A JP10527984 A JP 10527984A JP S60247745 A JPS60247745 A JP S60247745A
Authority
JP
Japan
Prior art keywords
interrupt
interruption
instruction
acceptance
output
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
JP10527984A
Other languages
Japanese (ja)
Inventor
Toshiaki Suzuki
敏明 鈴木
Takayuki Sugiura
杉浦 孝行
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP10527984A priority Critical patent/JPS60247745A/en
Publication of JPS60247745A publication Critical patent/JPS60247745A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To make a response time constant and improve timing accuracy, and expand an application range by performing counting operation in every instruction cycle at a request for interruption and accepting the interruption when the counted value attains to a specific value. CONSTITUTION:A request flag 2 is set in synchronism with the rising of an interruption request signal IRQ and its output signal IF goes up to ''1'', and a counter 3 in the reset state is actuated to count up by one for every machine cycle. When the specific number of machine cycles from the start of counting to the acceptance of interruption is set to ''8'', instructions being executed at present are executed continuously and automatically up to a final state even if an input for an instruction decoder 9 varies. Then when the counter counts up to the specific value ''8'', the output CMP of a comparator 5 goes up to ''1'' and a gate 7 is opened to output an interruption acceptance request signal IN=1, so that a decoder 9 starts accepting the interruption. At this time, any instruction code is disregarded even if inputted to the decoder 9, and an interruption ACK signal is generated to reset the flag 2, thus completing a series of interruption processes.

Description

【発明の詳細な説明】 産業上の利用分野 本発明は、シングルチップマイクロコンピュータの割込
み制御回路に関するものである○従来例の構成とその問
題点 シングルチップマイクロコンピュータ(以下マイコンと
記す)の応用分野中で、マイクロコントローラとして用
いられる場合は、リアルタイム応答性が重視される。
[Detailed Description of the Invention] Industrial Field of Application The present invention relates to an interrupt control circuit for a single-chip microcomputer. ○Conventional configuration and its problems Field of application of a single-chip microcomputer (hereinafter referred to as microcomputer) Among these, when used as a microcontroller, real-time responsiveness is important.

リアルタイム応答性を良くするために割込み処理機能が
設けられている。割込み機能の本来の目的からして、速
やかに現在実行中の仕事を中断して、割込み処理プログ
ラム実行に制御を移さなければならない。速やかにと言
っても、現在実行中の命令を中断することは難しい。従
って、現在実行中の命令を実行した後に割込み受理を行
なうようなマイコンが一般的である。
An interrupt processing function is provided to improve real-time responsiveness. Considering the original purpose of the interrupt function, it is necessary to immediately interrupt the work currently being executed and transfer control to the execution of the interrupt processing program. Even if it is called prompt, it is difficult to interrupt a command currently being executed. Therefore, microcomputers that accept interrupts after executing the currently executing instruction are common.

リアルタイム制御をマイコンで行なう場合、制御の許容
誤差が、マイクロ秒単位で要求される場合もある。例え
ば商用電源のゼロクロス信号で割込みを発生させ、負荷
電流をパルス幅制御する場合、割込み応答時間のバラツ
キが制御精度に直接影響してくる。命令単位で割込み受
理を行なうマイコンの場合、命令実行時間の変動が、割
込み受理応答時間のバラツキに反映する。
When real-time control is performed using a microcomputer, control tolerances may be required in microsecond units. For example, when generating an interrupt using a zero-crossing signal from a commercial power source and controlling the pulse width of a load current, variations in interrupt response time directly affect control accuracy. In the case of a microcomputer that accepts interrupts on an instruction-by-instruction basis, variations in instruction execution time are reflected in variations in interrupt acceptance response times.

第1図は従来のマイコン割込み受理タイミングを示した
ものである。
FIG. 1 shows the conventional microcomputer interrupt acceptance timing.

IRQは割込み要求信号、aとbは命令実行の様子を示
したものであり、MOV (データ転送)。
IRQ is an interrupt request signal, a and b indicate instruction execution, and MOV (data transfer).

MUL(乗算)、AND(論理積)命令などが実行され
るタイミングを示す。
It shows the timing at which MUL (multiplication), AND (logical product) instructions, etc. are executed.

aの例では、割込み発生時にMUL命令を実行中であり
、bの例では、AND命令を実行中である。a、bの例
からも明らかなように、命令の種類、あるいは同じ命令
でも命令の実行ステート位置の差によって、割込み発生
から割込み受理までの時間が変化する。
In the example a, the MUL instruction is being executed when the interrupt occurs, and in the example b, the AND instruction is being executed. As is clear from the examples a and b, the time from interrupt generation to interrupt acceptance changes depending on the type of instruction or the difference in execution state position of the same instruction.

マイコンの命令はレジスタ間演算々どの様に1命令サイ
クルで実行可能なものから10命令サイクル程度必要な
ものまであり、命令ごとの実行時間の違いが割込み受理
時間のバラツキに影響してくるといった欠点があった。
Microcontroller instructions range from those that can be executed in one instruction cycle to those that require about 10 instruction cycles, such as operations between registers, and the disadvantage is that the difference in execution time for each instruction affects the variation in interrupt acceptance time. was there.

発明の目的 そこで本発明は、命令毎に異なる実行速度をもつマイコ
ンの割込み発生から受理までの時間が一定になるような
回路を提供し、割込み駆動のプログラムによりタイミン
グ制御をするマイコン応用の制御精度を上げることを目
的とする。
Purpose of the Invention Therefore, the present invention provides a circuit that makes the time from interrupt generation to acceptance constant in a microcomputer, which has a different execution speed for each instruction, and improves the control accuracy of microcomputer applications that perform timing control using interrupt-driven programs. The purpose is to raise the

発明の構成 本発明は、割込み発生から受理までの時間を一定時間に
するために1割込み要求が発生すると各命令サイクル毎
にカウントを行なうカウンタを起動し、とのカウンタの
出力値が規定値に達したか否かを各サイクル毎にチェッ
クし、規定値になったら割込み受理を実行するように構
成した割込み制御回路であり、割込み発生時に実行中で
あった命令実行終了後は、CPUは割込み受理のウェイ
トサイクルを繰り返し行ない、カウンタが規定値になる
まで待機する。このカウンタの規定値は、最も長い実行
時間を必要とする命令サイクル数に設定する。
Structure of the Invention In order to make the time from interrupt generation to acceptance a constant time, when one interrupt request occurs, a counter that counts every instruction cycle is started, and the output value of the counter is set to a specified value. This is an interrupt control circuit configured to check whether the specified value has been reached every cycle, and to accept the interrupt when the specified value is reached.After the execution of the instruction that was being executed when the interrupt occurred, the CPU The acceptance wait cycle is repeated until the counter reaches the specified value. The specified value of this counter is set to the number of instruction cycles that require the longest execution time.

実施例の説明 以下、本発明の一実施例にもとづき、詳細を説明する。Description of examples Hereinafter, details will be explained based on one embodiment of the present invention.

第2図は本実施例における割込み受理タイミング図であ
る。同図において、IRQは割込み要求信号、a、bは
命令実行の様子を示したもノテある。MOv(転送)、
MUL(乗算)。
FIG. 2 is an interrupt acceptance timing diagram in this embodiment. Note that in the figure, IRQ is an interrupt request signal, and a and b indicate instruction execution. MOv (transfer),
MUL (multiplication).

AND(論理積)、W(ウェイトサイクル)1割込み受
理などが実行される状態が示されている。
A state in which AND (logical product), W (wait cycle) 1 interrupt acceptance, etc. are executed is shown.

本実施例におけるマイコンは、MUL命令に8マシンサ
イクル、AND命令に3マシンサイクル。
The microcontroller in this embodiment takes 8 machine cycles for the MUL instruction and 3 machine cycles for the AND instruction.

MOV命令1c2マシンサイクルの実行時間を必要とす
る。
The MOV instruction requires an execution time of 1c2 machine cycles.

まずaの実行例では、MUL命令実行開始後、2マシン
サイクル目で割込み要求信号IRQが発生した場合を示
す。割込み発生とともにカウンタが起動し、カウンタ値
が7を示すとき、今まで実行途中であったMUL命令を
終了する。この後直−ちに割込み受理を始めずに、カウ
ント値が8になるまでCPUウェイトサイクルを繰り返
す。
First, in the execution example a, a case is shown in which the interrupt request signal IRQ is generated in the second machine cycle after the start of execution of the MUL instruction. A counter is activated upon occurrence of an interrupt, and when the counter value indicates 7, the MUL instruction that has been in the middle of execution is completed. After this, the CPU wait cycle is repeated until the count value reaches 8 without starting to accept the interrupt immediately.

次にbの実行例では、AND命令の2マシンサイクル目
で割込み発生の場合を示す。aの場合とは違ってカウン
ト値が2〜8までの間、6マシンサイクルのウェイトを
繰り返す。
Next, in the execution example b, a case is shown in which an interrupt occurs in the second machine cycle of an AND instruction. Unlike case a, the wait for 6 machine cycles is repeated while the count value is between 2 and 8.

すなわち、早く実行を終了した命令の場合は、多くのウ
ェイトサイクルを繰り返すことによってどの様なタイプ
の命令実行途中でも割込み受理までの遅れ時間が一定に
制御される。
That is, in the case of an instruction that finishes execution early, the delay time until interrupt acceptance is controlled to be constant during execution of any type of instruction by repeating many wait cycles.

第3図は、実施例のブロック構成図である。FIG. 3 is a block diagram of the embodiment.

1は割込み要求信号をマイコン外部から与えるための端
子である。2は割込み検知用のフラグであり、前記端子
1からの割込み要求信号IRQの立上りエツジに同期し
てセットされ、出方信号IF−1に設定する。3はカウ
ンタであり、1命令サイクルで1個カウントする。カウ
ンタ3は前記フラグ2の出力信号IF−〇の時、リセッ
トされている。4は規定値を格納するレジスタであり、
命令によって設定できる。この説明では8を設定してい
た場合の動作を示す。5はコンパレータであり、前記カ
ウンタ3の出力Qと、前記レジスタ4の出力Pを比較し
、PとQが一致した時、一致信号CMPを出力する。6
はゲートであり、前記フラグ2の出力IF=1で、かつ
前記コンパレータ出力CMP=Oの時に開き、割込み受
理の待機要求信号WAIT=1に設定する。7はゲート
であリ、前記フラグ2の出力IF=1で、かつ前記コン
パレータ出力CMP=1の時に開き、割込み受理要求信
号INT=1に設定する。8は2→1マルチプレクサで
あ°す、通常の命令を実行する時は口側か開き、命令レ
ジスタの値が命令デコーダに入力される。割込み受理待
機の時は前記ゲート6出力WAIT、=1なので、イ側
が開き、ウェイトコードが命令デコーダに入力される。
1 is a terminal for applying an interrupt request signal from outside the microcomputer. 2 is a flag for detecting an interrupt, which is set in synchronization with the rising edge of the interrupt request signal IRQ from the terminal 1, and is set in the output signal IF-1. 3 is a counter, which counts one in one instruction cycle. The counter 3 is reset when the output signal of the flag 2 is IF-0. 4 is a register that stores a specified value;
Can be set by command. In this explanation, the operation when 8 is set is shown. A comparator 5 compares the output Q of the counter 3 and the output P of the register 4, and outputs a match signal CMP when P and Q match. 6
is a gate, which opens when the output IF of the flag 2 is 1 and the comparator output CMP is 0, and is set to the interrupt acceptance wait request signal WAIT=1. A gate 7 is opened when the output IF of the flag 2 is 1 and the output CMP of the comparator is 1, and the interrupt acceptance request signal INT is set to 1. 8 is a 2→1 multiplexer. When executing a normal instruction, the mouth side is opened and the value of the instruction register is input to the instruction decoder. When waiting for interrupt acceptance, the output WAIT of the gate 6 is 1, so the A side is opened and the wait code is input to the instruction decoder.

9は命令デコーダであり、命令および割込み受理コード
の解読を行なう。命令デコーダの出力信号の1本ACK
信号により、前記フラグ2をクリアする。
Reference numeral 9 denotes an instruction decoder, which decodes instructions and interrupt acceptance codes. One ACK of the instruction decoder output signal
The flag 2 is cleared by the signal.

以上の様に構成された本実施例の割込み制御回路につい
て以下その動作を説明する。
The operation of the interrupt control circuit of this embodiment configured as described above will be explained below.

第4図は本実施例の動作の詳細を説明するためのタイミ
ング図である。
FIG. 4 is a timing diagram for explaining the details of the operation of this embodiment.

割込み要求信号IRQの立上りエツジに同期して割込み
要求フラグ2がセットされ、工F=1になる。すると、
今までずっとリセット状態にあったカウンダ3が起動さ
れ、1マシンサイクルあたり1個のカウントを行なう。
Interrupt request flag 2 is set in synchronization with the rising edge of interrupt request signal IRQ, and F=1. Then,
Counter 3, which has been in a reset state until now, is activated and performs one count per machine cycle.

カウントを始めてから割込み受理までの規定マシンサイ
クルを8に設定しておくと、コンパレータ6の出力WA
IT信号は初め0である。この間、マルチプレクサ8は
イ側を選択することにより、命令デコーダ9はウェイト
サイクルを実行するよう指示される。従って、現在実行
中の命令が終了すると、ウェイトサイクルの実行を行な
う。現在すでに実行中の命令については、命令デコーダ
9の入力が変化しても命令最終ステートまで自動継続す
る。
If the specified machine cycle from the start of counting to the acceptance of an interrupt is set to 8, the output WA of comparator 6
The IT signal is initially 0. During this time, the multiplexer 8 selects the i side, thereby instructing the instruction decoder 9 to execute a wait cycle. Therefore, when the currently executed instruction ends, a wait cycle is executed. An instruction that is currently being executed is automatically continued to the final state of the instruction even if the input to the instruction decoder 9 changes.

カウンタが規定値の8になると、コンパレータ5の出力
CMP=1・になり、ゲート7が開き、割込み受理要求
信号工NT=1を出力し、命令デコーダ9は割込み受理
を開始する。この時、命令デコーダに入力される命令コ
ードは何が入力されていても無視される。割込み受理サ
イクル内では、割込みACK信号を生成し、フラグ2を
クリアし、一連の割込み処理を完了する。
When the counter reaches the specified value of 8, the output of the comparator 5 becomes CMP=1, the gate 7 opens, an interrupt acceptance request signal NT=1 is output, and the instruction decoder 9 starts accepting the interrupt. At this time, any instruction code input to the instruction decoder is ignored. In the interrupt acceptance cycle, an interrupt ACK signal is generated, flag 2 is cleared, and a series of interrupt processing is completed.

以上の説明では、最も時間のかかる命令がMUL命令な
ので、規定値を8に決めてレジスタ4に書込んでいる。
In the above explanation, since the instruction that takes the most time is the MUL instruction, the specified value is determined to be 8 and written to the register 4.

しかし、応用プログラムで使用する範囲の命令では最長
5マシンサイクルになる場合には、レジスタ4には6を
設定する。
However, if the maximum number of instructions used in an application program is 5 machine cycles, register 4 is set to 6.

また、割込み発生から受理までの時間が一定でなくても
良い場合には、レジスタ4に0を書込むことによって従
来のマイコンと同じ動作をさせることもできる。
Furthermore, if the time from generation to acceptance of an interrupt does not need to be constant, writing 0 to the register 4 can cause the microcomputer to operate in the same way as a conventional microcomputer.

発明の効果 本発明は以上説明したように構成することにより、割込
み発生から受理までの応答時間を一定にすることが出来
、割込み駆動のプログラムによりマイコン応用システム
のタイミングを制御するような用途に対し、タイミング
精度の向上や今捷でにマイコンで実現出来なかった領域
に対しても適用範囲の拡大などの効果を得ることができ
、その実用的価値は大きいものである。
Effects of the Invention By having the configuration as described above, the present invention can make the response time from interrupt occurrence to acceptance constant, and is suitable for applications where the timing of a microcomputer application system is controlled by an interrupt-driven program. It has great practical value, as it can improve timing accuracy and expand the scope of application to areas that could not be achieved with modern microcontrollers.

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

第1図は従来の割込み受理タイミング図、第2図は本発
明における一実施例の割込み受理タイミング図、第3図
は同実施例の構成を示すブロック図、第4図は同実施例
の動作の詳細を説明するためのタイミング図である。 1・・・・・・割込み端子、2・・・・・・割込み要求
フラグ、3・・・・・・カウンタ、4,5・・・・・・
ゲート、6・・・・・・マルチプレクサ、7・・・・・
・命令デコーダ。 代理人の氏名 弁理士 中 尾 敏 男 ほか1名第1
図 第2図 第3図
Figure 1 is a conventional interrupt reception timing diagram, Figure 2 is an interrupt reception timing diagram of an embodiment of the present invention, Figure 3 is a block diagram showing the configuration of the embodiment, and Figure 4 is the operation of the embodiment. FIG. 1... Interrupt terminal, 2... Interrupt request flag, 3... Counter, 4, 5...
Gate, 6...Multiplexer, 7...
・Instruction decoder. Name of agent: Patent attorney Toshio Nakao and 1 other person No. 1
Figure 2 Figure 3

Claims (1)

【特許請求の範囲】[Claims] 割込み要求信号を与える端子と、前記端子に与えられる
パルス信号によりセットされる割込検知用のフラグと、
前記フラグがセットされて以後に計数を開始するカウン
タと、前記カウンタの出力値が規定値に達していない状
態を検知し、割込み受理の待機要求信号を出力する比較
検知手段と、命令コードおよび割込み受理コードを解読
する命令デコーダと、前記比較検知手段の出力によって
、前記命令デコーダに対し割込み受理を待機させるウェ
イトサイクルを挿入する手段とを備えた割込み制御回路
a terminal for providing an interrupt request signal; a flag for interrupt detection that is set by a pulse signal applied to the terminal;
A counter that starts counting after the flag is set, a comparison detection means that detects a state in which the output value of the counter has not reached a specified value and outputs a standby request signal for accepting an interrupt, and an instruction code and an interrupt. An interrupt control circuit comprising: an instruction decoder for decoding an acceptance code; and means for inserting a wait cycle for causing the instruction decoder to wait for interrupt acceptance based on the output of the comparison detection means.
JP10527984A 1984-05-24 1984-05-24 Interruption control circuit Pending JPS60247745A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10527984A JPS60247745A (en) 1984-05-24 1984-05-24 Interruption control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10527984A JPS60247745A (en) 1984-05-24 1984-05-24 Interruption control circuit

Publications (1)

Publication Number Publication Date
JPS60247745A true JPS60247745A (en) 1985-12-07

Family

ID=14403229

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10527984A Pending JPS60247745A (en) 1984-05-24 1984-05-24 Interruption control circuit

Country Status (1)

Country Link
JP (1) JPS60247745A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR19980013834A (en) * 1996-08-03 1998-05-15 구자홍 The program execution time detection circuit of the microprocessor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR19980013834A (en) * 1996-08-03 1998-05-15 구자홍 The program execution time detection circuit of the microprocessor

Similar Documents

Publication Publication Date Title
JPS63163912A (en) Microcomputer system
KR960035262A (en) Method and apparatus for selective control of interrupt wait in data processing system
JPS60247745A (en) Interruption control circuit
JPS5916054A (en) Microprocessor
JPH01136251A (en) Self-diagnosing system
JPH0814779B2 (en) Initialization method for arithmetic and control unit
JP4156148B2 (en) Task scheduling device
KR930009798B1 (en) Reset-ready counter of numeric co-processor
JPS6230452B2 (en)
JPS6269352A (en) Microprocessor
JP2557785Y2 (en) Single chip microcomputer
JPH05257751A (en) Microcomputer
WO1990013071A1 (en) Programmable controller
JPS62296236A (en) Interruption processor for microprocessor
JPS63316146A (en) Microcomputer
JPH0462093B2 (en)
JPH01216626A (en) Pulse count circuit
JPS5935250A (en) Program controller
JPS6114548B2 (en)
JPS61154491A (en) Motor controller
JPH0222743A (en) Processor with clock counter
JPS6214235A (en) Information processor
JPS6220013A (en) Disconnecting device for power supply of microcomputer applied equipment
JPH04107792A (en) Microcomputer
JPS58172761A (en) Watchdog circuit