JP2844624B2 - Data processing device - Google Patents

Data processing device

Info

Publication number
JP2844624B2
JP2844624B2 JP63331527A JP33152788A JP2844624B2 JP 2844624 B2 JP2844624 B2 JP 2844624B2 JP 63331527 A JP63331527 A JP 63331527A JP 33152788 A JP33152788 A JP 33152788A JP 2844624 B2 JP2844624 B2 JP 2844624B2
Authority
JP
Japan
Prior art keywords
processing
data
interrupt
register
timer
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
JP63331527A
Other languages
Japanese (ja)
Other versions
JPH02178802A (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.)
NEC Corp
Original Assignee
Nippon Electric 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 Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP63331527A priority Critical patent/JP2844624B2/en
Publication of JPH02178802A publication Critical patent/JPH02178802A/en
Application granted granted Critical
Publication of JP2844624B2 publication Critical patent/JP2844624B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、機械制御におけるパルス出力において、特
にパルスを連続的に出力する方法に関する。
Description: TECHNICAL FIELD The present invention relates to a pulse output in machine control, and more particularly to a method of continuously outputting pulses.

〔従来の技術〕[Conventional technology]

昨今、機械制御においては、マイコンが利用されてい
る。基本的には、マイコンから出力されるPWM出力パル
スによって弁の開閉や、モータの駆動などを直接行なっ
ているのが一般的である。
Recently, microcomputers are used in machine control. Basically, it is common to directly open / close a valve or drive a motor by a PWM output pulse output from a microcomputer.

第5図は、従来の技術によるパルス出力を行なう場合
のパルス出力パターン例を示している。
FIG. 5 shows an example of a pulse output pattern in the case of performing a pulse output according to the prior art.

以下、第6図と第7図を参照しながら従来のパルス発
生装置を説明する。第6図は従来のパルス発生装置のブ
ロック図、第7図は従来の周辺ハードウェアのブロック
図である。第8図の装置は、CPU800,データバス110,ア
ドレスバス111,INTC(割込み発生要求回路)112,プログ
ラムメモリ113,データメモリ114,周辺ハードウェア115
から構成されている。
Hereinafter, a conventional pulse generator will be described with reference to FIGS. 6 and 7. FIG. FIG. 6 is a block diagram of a conventional pulse generator, and FIG. 7 is a block diagram of conventional peripheral hardware. 8 includes a CPU 800, a data bus 110, an address bus 111, an INTC (interrupt request circuit) 112, a program memory 113, a data memory 114, and peripheral hardware 115.
It is composed of

CPU800は、算術論理演算ユニット(以下ALUと記す)1
01,テンポラリレジスタ102,汎用レジスタ103,アドレス
バッファ104(図ではABで表現されている),マイクロ
アドレス(以下μアドレスと記す)生成部105,μROM10
6,PC(プログラムカウンタ)107,PSW(プログラム実行
状態保持レジスタ)108,タイミング制御部109から構成
される。
The CPU 800 is an arithmetic logic unit (hereinafter referred to as ALU) 1
01, temporary register 102, general-purpose register 103, address buffer 104 (represented by AB in the figure), micro address (hereinafter referred to as μ address) generation unit 105, μ ROM 10
6, a PC (program counter) 107, a PSW (program execution state holding register) 108, and a timing control unit 109.

またINTC112は、割り込み要求フラグ116があり、タイ
ミング制御部109に対し、割り込み要求信号117を出力す
る。タイミング制御部109は、割り込み要求を受け付け
ると、INTC112に対し割り込み要求クリア信号118を出力
する。
The INTC 112 has an interrupt request flag 116 and outputs an interrupt request signal 117 to the timing control unit 109. Upon receiving the interrupt request, the timing control unit 109 outputs an interrupt request clear signal 118 to the INTC 112.

INTC112は、外部のハードウェアから幾つかの割り込
み信号を受け付け、各割り込みソースに割当てられた優
先順位を判別し、最も高い優先順位をもった割り込みソ
ースを一つ選択し、その割り込みソースに対応した割り
込み要求フラグ116をセットする。割り込み要求フラグ1
16は、割り込み要求がn個あるときには、n個設定され
ているが、図中には1個だけ記載されている。また、外
部のハードウェアからの割り込み信号や、優先順位判別
部などは、特に図示していない。
The INTC112 accepts several interrupt signals from external hardware, determines the priority assigned to each interrupt source, selects one interrupt source with the highest priority, and responds to that interrupt source The interrupt request flag 116 is set. Interrupt request flag 1
16 is set when there are n interrupt requests, but only one is shown in the figure. Further, an interrupt signal from external hardware, a priority determination unit, and the like are not particularly illustrated.

従来からの割り込み処理は、通常ベクタ割り込みと呼
ばれ、メモリ空間中にベクタテーブル空間が予め設定さ
れ、この空間には各割り込みソースに対応した、割り込
み処理プログラムのエントリアドレスが格納されてい
る。ベクタ割り込みが発生すると、割り込みソースに対
応したエントリアドレスへ分岐する。
Conventional interrupt processing is usually called vector interrupt, and a vector table space is previously set in a memory space, and an entry address of an interrupt processing program corresponding to each interrupt source is stored in this space. When a vector interrupt occurs, the process branches to an entry address corresponding to the interrupt source.

次に第7図を用いて、周辺ハードウェア115の構成を
説明する。
Next, the configuration of the peripheral hardware 115 will be described with reference to FIG.

周辺ハードウェア115は、クロックφをカウントする
タイマ901,タイマ901の値と比較動作を行い、出力パル
スを制御する3つのコンペアレジスタ(以下COMPT,COMP
S,COMPR)902,903,904、出力パルスのレベルを保持する
セット・リセット型フリップフロップ(以下出力F/F)9
05、および出力F/Fの値を外部に出力するポートPから
構成されている。
The peripheral hardware 115 compares the value of the timer 901 counting the clock φ with the value of the timer 901, and controls the output pulses by using three compare registers (hereinafter referred to as COMPT and COMP).
S, COMPR) 902, 903, 904, set / reset flip-flops that hold the output pulse level (hereinafter referred to as output F / F) 9
05 and a port P for outputting the value of the output F / F to the outside.

COMPT902は、出力パルスの周期を規定するコンペアレ
ジスタで、出力パルスの周期T0に相当する値がCPU800に
よりあらかじめ設定してある。また、COMPT902は、常に
タイマ901と比較動作を行い、タイマ901の値のレジスタ
の保持値が一致すると、一致信号912を出力する。同様
に、COMPS903,COMPR904は、それぞれ出力パルスのパル
ス出力開始タイミングと、パルス出力終了タイミングを
規定するコンペアレジスタで、常にタイマ901と比較動
作を行い、タイマ901の値とそれぞれのレジスタの保持
値が一致すると、それぞれ一致信号913,914を出力す
る。これらのコンペアレジスタはすべてCPU800からリー
ド,ライトが可能である。
COMPT 902 is a compare register that defines the cycle of the output pulse, and a value corresponding to the cycle T0 of the output pulse is set in advance by the CPU 800. The COMPT 902 always performs a comparison operation with the timer 901 and outputs a match signal 912 when the value of the timer 901 held in the register matches. Similarly, COMPS903 and COMPR904 are compare registers that specify the pulse output start timing and the pulse output end timing of the output pulse, respectively, and always perform a comparison operation with the timer 901 to determine whether the value of the timer 901 and the value held in each register are equal. When they match, match signals 913 and 914 are output, respectively. All of these compare registers can be read and written from the CPU 800.

一致信号912はタイマ901に入力され、タイマ901はこ
の信号が入力されるとオール“0"にクリアされる。これ
により、タイマ901は、カウント値0からT0までを継続
的にカウントするインターバルタイマとしての機能を果
たす。
The coincidence signal 912 is input to the timer 901, and when this signal is input, the timer 901 is cleared to all "0". Thereby, the timer 901 functions as an interval timer that continuously counts from the count value 0 to T0.

次に、本例におけるパルス出力の制御動作を、第5図
乃至第7図を参照しながら、パルス出力の制御動作説明
をする。ただし、出力F/F905はリセットされていて、ポ
ートPからの出力がロウレベルである時から説明を行
う。
Next, the control operation of the pulse output in this example will be described with reference to FIGS. 5 to 7. FIG. However, the output F / F 905 is reset, and the description will be made from the time when the output from the port P is at a low level.

通常の命令処理では、PC107に格納されたプログラム
アドレスが、アドレスバッファ104に転送され、アドレ
スバス111をドライブし、プログラムメモリ113から次に
実行すべき命令がフェッチされる。
In normal instruction processing, the program address stored in the PC 107 is transferred to the address buffer 104, drives the address bus 111, and the next instruction to be executed is fetched from the program memory 113.

取り込まれた命令は、データバス110を経由し、μア
ドレス生成部105に転送される。μアドレス生成部105
は、命令コードからμROM106のアドレスを生成する。以
降、μROM106に格納されている該命令に対するμプログ
ラムの指令に従い、ALU101,テンポラリレジスタ102,汎
用レジスタ103などを操作することで命令の処理を行な
う。
The fetched instruction is transferred to the μ address generation unit 105 via the data bus 110. μ address generator 105
Generates the address of the μROM 106 from the instruction code. Thereafter, the instruction is processed by operating the ALU 101, the temporary register 102, the general-purpose register 103, and the like in accordance with the instruction of the μ program corresponding to the instruction stored in the μ ROM 106.

INTC112は、CPU800の処理とは独立に、周辺ハードウ
ェアから割り込み要求が発生しているか否かを絶えずサ
ンプルし、要求が発生していれば要求を1つ選択し、そ
のソースに対応する割り込み要求フラグ116をセットす
る。
The INTC112 continuously samples whether or not an interrupt request has been generated from peripheral hardware, independently of the processing of the CPU 800. If a request has been generated, the INTC112 selects one request and the interrupt request corresponding to the source. The flag 116 is set.

さて、COMPS903の値とタイマ901の値が一致すると、C
OMPS903は一致信号913を出力し、この信号により出力F/
F905をセットすることでポートPからの出力をハイレベ
ルにする。(第5図−タイミングt1,t4,t7) また、一致信号913はINTC112に入力され、INTC112に
対し割込み要求を発生し、INTC112が要求を受け付け、
割れ込み要求フラグ116がセットされれば、割り込み要
求信号117がタイミング制御部109に対して出力される。
By the way, when the value of COMPS903 matches the value of timer 901, C
The OMPS 903 outputs a match signal 913, and the output F /
The output from port P is set to high level by setting F905. (FIG. 5—timing t1, t4, t7) Further, the coincidence signal 913 is input to the INTC 112, which generates an interrupt request to the INTC 112, and the INTC 112 receives the request.
If the break request flag 116 is set, an interrupt request signal 117 is output to the timing control unit 109.

各命令実行の最後のタイミングでは、通常割り込みが
発生しているかいないかを検知するためのタイミング
で、このタイミングでは、タイミング制御部109は、割
り込み要求信号117の有無をサンプルする。割り込み要
求信号117がアクティブであれば、割り込み要求を受け
付け、割り込み要求クリア信号118をINTC112に対し出力
し、割り込み要求フラグ116をクリアする。
At the last timing of execution of each instruction, it is a timing for detecting whether or not the normal interrupt has occurred. At this timing, the timing control unit 109 samples the presence or absence of the interrupt request signal 117. If the interrupt request signal 117 is active, the interrupt request is accepted, an interrupt request clear signal 118 is output to the INTC 112, and the interrupt request flag 116 is cleared.

次にPC107とPSW108をスタックポインタ(CPU800中に
設定されているレジスタであるが図示はしていない)が
指し示すスタック空間に退避し、データメモリ114中の
特定のアドレスに設定されているベクタテーブルに格納
されている割り込みソースに対応する割り込み処理プロ
グラムのエントリアドレスを読み出し、データバス110
経由でPC107に設定する。PC107に新たに設定されたプロ
グラムアドレスから割り込み処理プログラムの実行が開
始される。
Next, the PC 107 and the PSW 108 are saved in a stack space indicated by a stack pointer (a register set in the CPU 800 but not shown), and stored in a vector table set at a specific address in the data memory 114. The entry address of the interrupt processing program corresponding to the stored interrupt source is read, and the data bus 110 is read.
Set to PC107 via The execution of the interrupt processing program is started from the program address newly set in the PC 107.

この一致信号913による割り込み処理要求に基づく割
り込み処理プログラムは、ポートPから次の周期に出力
されるパルスの、パルス出力開始タイミングを設定する
ための割り込み処理で、例えば、第5図において、周期
S1のタイミングt1で起動される割り込み処理では、次周
期S2のタイミングt4を設定するというように、順次、次
周期のパルス出力開始タイミングを設定するもので、こ
のときCPU800は、タイマ901がオール“0"にクリアされ
てから、パルス出力をアクティブにするまでの期間に相
当するデータをCOMPS903に設定する。
The interrupt processing program based on the interrupt processing request by the coincidence signal 913 is an interrupt processing for setting the pulse output start timing of the pulse output from the port P in the next cycle.
In the interrupt processing started at the timing t1 of S1, the pulse output start timing of the next cycle is sequentially set, such as setting the timing t4 of the next cycle S2. At this time, the CPU 901 sets the timer 901 to all “ The data corresponding to the period from when the signal is cleared to "0" until the pulse output is activated is set in the COMPS903.

割り込み処理プログラムを終了する命名の処理では、
スタック空間に退避しあったPC値,PSW値をそれぞれPC10
7,PSW108へ復帰することで、割り込みが発生した時点の
次の命令から処理を再開する。
In the naming process that terminates the interrupt processing program,
The PC value and PSW value saved in the stack space are stored in PC10, respectively.
7. By returning to PSW108, processing is restarted from the next instruction at the time when the interrupt occurred.

次に、COMPR904の値とタイマ901の値が一致すると、C
OMPR904は一致信号914を出力し、この信号により、出力
F/F905をリセットすることで、ポートPからのパルス出
力をロウレベルにする。(第5図−タイミングt2,t5,t
8) また、一致信号914はINTC112に入力され、INTC112に
対し割り込み要求を発生し、INTC112が要求を受け付
け、割り込み要求フラグ116がセットされれば、割り込
み要求信号117がタイミング制御部109に対して出力され
る。
Next, when the value of COMPR904 matches the value of timer 901, C
The OMPR904 outputs the coincidence signal 914, and the output
By resetting the F / F 905, the pulse output from the port P is set to a low level. (Fig. 5-Timing t2, t5, t
8) Also, the match signal 914 is input to the INTC 112, generates an interrupt request to the INTC 112, the INTC 112 accepts the request, and if the interrupt request flag 116 is set, the interrupt request signal 117 is sent to the timing control unit 109. Is output.

命令実行の最後のタイミングでは、タイミング制御部
109は、割り込み要求信号117の有無をサンプルする。
At the last timing of instruction execution, the timing controller
109 samples the presence or absence of the interrupt request signal 117.

割り込み要求信号117がアクティブであれば、前記一
致信号913により起動される割り込み処理と同様に、割
り込み要求クリア信号117をINTC112に対し出力し、割り
込み要求フラグ116をクリアする。
If the interrupt request signal 117 is active, an interrupt request clear signal 117 is output to the INTC 112 to clear the interrupt request flag 116, similarly to the interrupt processing started by the coincidence signal 913.

次にPC107とPSW108のスタック空間に退避し、データ
メモリ114中の特定のアドレスに設定されているベクタ
テーブルに格納されている割り込みソースに対応する割
り込み処理プログラムのエントリアドレスに分岐し、割
り込み処理プログラムは実行開始する。
Next, the stack is saved in the stack space of the PC 107 and the PSW 108, and a branch is made to an entry address of an interrupt processing program corresponding to the interrupt source stored in the vector table set at a specific address in the data memory 114. Starts execution.

この一致信号914による割り込み処理要求に基づく割
込み処理プログラムは、ポートPから次の周期に出力さ
れるパルスの、パルス出力終了タイミングを設定するた
めの割り込み処理で、例えば、第5図において、周期S1
のタイミングt2で起動される割り込み処理で、次周期S2
のタイミングt5を設定するというように、順次、次周期
のパルス出力終了タイミングを設定する。このときCPU8
00は、COMPR904にタイマ901がオール“0"にクリアされ
てから、パルス出力をリセットするまでの期間に相当す
るデータをCOMPR904に設定することにより、出力パルス
のパルス幅を設定することになる。
The interrupt processing program based on the interrupt processing request by the coincidence signal 914 is an interrupt processing for setting the pulse output end timing of the pulse output from the port P in the next cycle. For example, in FIG.
In the interrupt process started at the timing t2, the next cycle S2
As in the case of setting the timing t5, the pulse output end timing of the next cycle is sequentially set. At this time, CPU8
In the case of 00, the pulse width of the output pulse is set by setting the data corresponding to the period from when the timer 901 is all cleared to “0” in the COMPR 904 to when the pulse output is reset to the COMPR 904.

割り込み処理プログラムを終了する命令の処理では、
スタック空間に退避してあったPC値,PSW値をそれぞれPC
107,PSW108へ復帰することで、割り込みが発生した時点
の次の命令から処理を再開する。
In the processing of the instruction to end the interrupt processing program,
The PC value and PSW value saved in the stack space are
By returning to 107 and PSW 108, the processing is restarted from the next instruction at the time when the interrupt occurred.

以上の様に、COMPS903,COMPR904から出力される一致
信号913,914によって、ポートPからのパルス出力を直
接制御するとともに、これらの信号によって起動される
割り込み処理によって、次の周期に出力されるパルス出
力のパルス出力開始タイミングとパルス出力終了タイミ
ングを設定している。従って、この動作を繰り返して行
うことにより、ポートPからのパルス出力およびパルス
出力の制御を継続的に行うことができる。なお、以上の
説明は、種々あるパルス出力制御方法の1例を示したも
のであるが、基本的には同様の処理方法で制御が行なわ
れる。
As described above, the pulse output from the port P is directly controlled by the coincidence signals 913 and 914 output from the COMPS903 and COMPR904, and the pulse output output in the next cycle is performed by the interrupt processing started by these signals. The pulse output start timing and the pulse output end timing are set. Therefore, by repeating this operation, the pulse output from the port P and the control of the pulse output can be continuously performed. Although the above description shows one example of various pulse output control methods, control is basically performed by a similar processing method.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

前述したように、従来のパルス発生装置は、パルス出
力を開始させる信号とパルス出力を終了させる信号と
を、割り込み信号として受け付け、割り込み処理プログ
ラムによって、次の周期に出力するパルス出力の開始タ
イミングと終了タイミングの設定を行っているため、そ
の際のPC,PSWのスタック空間への退避や、割り込み処理
プログラムからメイン処理へ戻る時に、スタックの内容
をPC,PSWへ復帰する処理が頻繁に発生するため、出力す
るパルスの周波数が高くなる程、退避、復帰に分かれる
CPU時間の比率が膨大なものになる。
As described above, the conventional pulse generator receives the signal for starting the pulse output and the signal for terminating the pulse output as an interrupt signal, and according to the interrupt processing program, the timing of starting the pulse output to be output in the next cycle. Since the end timing is set, when the PC and PSW are saved to the stack space at that time and when returning from the interrupt processing program to the main processing, the processing of returning the contents of the stack to the PC and PSW frequently occurs. Therefore, the higher the frequency of the output pulse, the more it is divided into evacuation and return
The ratio of CPU time becomes huge.

しかも、CPUはパルスの制御の他に、その他のデータ
処理など種々のプログラムの実行を行なっており、パル
ス出力制御のための割り込み処理に多大な時間がかかる
と、これらのメイン処理に分かれるCPU時間が少なくな
り、場合によっては全くできない処理が発生することも
起こり得る。
In addition, the CPU executes various programs such as other data processing in addition to controlling the pulse. If a long time is required for the interrupt processing for controlling the pulse output, the CPU time is divided into the main processing. Is reduced, and in some cases, processing that cannot be performed at all may occur.

さらに、第5図において、S2の周期の割り込み処理に
よって、次周期S3のパルス出力開始タイミング(タイミ
ングt7)として設定される値が、現在のタイマのカウン
ト値に対して大きい場合、S3の周期のパルス出力タイミ
ングを指定する意図で設定を行っても、現周期S2内でパ
ルス出力開始のための一致信号が再び発生することにな
る(タイミングtX)。したがって、現周期S2のパルス出
力が終了していた場合、次周期S3を待たずにパルスの出
力を開始してしまうという事象が生ずる。このときのパ
ルス出力は、タイミングtX〜t6〜t7〜t8の期間をもつ、
2周期にまたがったパルス出力になってしまう。
Further, in FIG. 5, if the value set as the pulse output start timing (timing t7) of the next cycle S3 by the interrupt processing of the cycle of S2 is larger than the current timer count value, Even if the setting is performed with the intention of designating the pulse output timing, a coincidence signal for starting pulse output is generated again in the current cycle S2 (timing tX). Therefore, when the pulse output of the current cycle S2 has been completed, an event occurs that the pulse output is started without waiting for the next cycle S3. The pulse output at this time has a period of timing tX to t6 to t7 to t8,
The pulse output will be over two cycles.

上記の様なパルス出力は、本来意図したパルス出力の
開始と終了タイミングとは異なり、意図しないパルス幅
を持ったパルスが出力されてしまうため、例えば、パル
スの出力幅が制御量そのものであるような場合には、制
御対象に対して誤った制御を実行してしまうという重大
な問題となる。しかも、これを防止、補正するために
は、専用のプログラム処理が必要となり、この処理を、
パルス出力の開始と終了タイミングを設定する割り込み
処理に付加すると、パルス出力制御の割り込み処理に要
する時間が、全体としてますます増大してしまう。
Since the pulse output as described above is different from the originally intended start and end timings of the pulse output and a pulse having an unintended pulse width is output, for example, the output width of the pulse is the control amount itself. In such a case, there is a serious problem that erroneous control is performed on the control target. Moreover, in order to prevent or correct this, a dedicated program process is required.
When added to the interrupt processing for setting the start and end timings of the pulse output, the time required for the interrupt processing of the pulse output control is further increased as a whole.

〔課題を解決するための手段〕[Means for solving the problem]

本発明のデータ処理装置は、命令の実行アドレスを保
持するプログラムカウンタ、プログラムの実行状態を保
持する手段、汎用レジスタ及びマイクロプログラムROM
を含む中央処理装置と、前記中央処理装置へ非同期に割
り込み処理要求を発生する割り込み要求発生回路と、プ
ログラムメモリと、データメモリと、周辺回路とを有す
るデータ処理装置において、前記周辺回路は、タイマ
と、前記タイマとの比較を行う複数の比較レジスタと、
パルス出力用の出力ポートとを有し、前記割り込み要求
発生回路は、割り込み処理要求の発生に加え、所定のデ
ータ処理の要求を発生する手段と、前記割り込み処理要
求と前記所定のデータ処理の要求を識別するための形態
指示手段とを備え、前記データメモリ内には前記所定の
データ処理の処理形態を指定する処理形態情報が格納さ
れ、前記割り込み要求発生回路から前記所定のデータ処
理の要求が前記中央処理装置に対して発生されると、前
記中央処理装置は前記形態指示手段が前記所定のデータ
処理を指示していることを検出した場合には、命令実行
処理を中断し、前記処理形態情報に従い、前記データメ
モリ内の所定のデータと、当該タイミングにおける前記
タイマの値または前記比較レジスタの値とを比較し、比
較結果が所定の条件のとき前記所定の比較レジスタへの
データ転送を行う手段を有し、前記出力ポートからのパ
ルス発生を制御すると共に前記比較結果が所定の条件で
ないときには前記割り込み発生回路から前記中央処理装
置へ割り込み要求を発生することを特徴とする。
A data processing apparatus according to the present invention includes a program counter for holding an instruction execution address, a unit for holding a program execution state, a general-purpose register, and a microprogram ROM.
A data processing device having a central processing unit, an interrupt request generating circuit that asynchronously generates an interrupt processing request to the central processing device, a program memory, a data memory, and a peripheral circuit. And a plurality of comparison registers for comparing with the timer,
An output port for outputting a pulse, wherein the interrupt request generating circuit generates a request for a predetermined data processing in addition to the generation of the interrupt processing request, and outputs the interrupt processing request and the request for the predetermined data processing. Processing instruction information for specifying a processing mode of the predetermined data processing, and the interrupt request generating circuit receives a request for the predetermined data processing from the interrupt request generation circuit. When issued to the central processing unit, the central processing unit interrupts the instruction execution process when detecting that the configuration instruction means is instructing the predetermined data processing, and According to the information, predetermined data in the data memory is compared with the value of the timer or the value of the comparison register at the timing, and the comparison result is determined by a predetermined condition. Means for transferring data to the predetermined comparison register at the time of controlling the generation of a pulse from the output port, and when the comparison result is not a predetermined condition, an interrupt request from the interrupt generation circuit to the central processing unit. Is generated.

また、本発明のデータ処理装置は、クロックによって
インクリメント動作を行うタイマ、第1のワードデータ
が記憶される第1のレジスタ、前記第1のワードデータ
よりも大きい第2のワードデータが記憶される第2のレ
ジスタ、前記タイマのカウント値が前記第1のレジスタ
に記憶された第1のワードデータと一致したことを検出
して第1の制御信号をアクティブにする第1の比較回
路、前記タイマのカウント値が前記第2のレジスタに記
憶された前記第2のワードデータと一致したことを検出
して前記第1の制御信号をインアクティブにする第2の
比較回路を備える周辺回路と、前記第1の制御信号がア
クティブになったことに応答し、かつ、書き込むべき第
3のワードデータが前記第1のワードデータ以下の時に
は前記第1のレジスタに前記第3のワードデータを書き
込み、前記第3のワードデータが前記第1のワードデー
タよりも大きい時には前記第3のワードデータの前記第
1のレジスタへの書き込みを中止すると共に書き込みが
未完了であるデータを記憶し、前記第1の制御信号がイ
ンアクティブになったことに応答して前記第2のレジス
タに第4のワードデータを書き込む書き込み手段とを備
えることを特徴とする。
Further, in the data processing device of the present invention, a timer that performs an increment operation by a clock, a first register that stores first word data, and a second word data that is larger than the first word data are stored. A second register, a first comparison circuit for detecting that the count value of the timer matches the first word data stored in the first register and activating a first control signal, the timer A peripheral circuit including a second comparison circuit that detects that the count value of the second control signal matches the second word data stored in the second register and inactivates the first control signal; The first register is responsive to a first control signal being activated and when the third word data to be written is less than or equal to the first word data. When the third word data is written, and when the third word data is larger than the first word data, the writing of the third word data to the first register is stopped and the writing is not completed. And writing means for storing certain data and writing fourth word data to the second register in response to the first control signal becoming inactive.

このように、本発明は、パルス出力の開始と終了のタ
イミング信号を割り込み要求信号として受付けた際、P
C,PSWをスタック空間に退避する事なしに、事前に所定
のアドレスに設定されたデータに基づき、次周期のパル
ス出力の開始と終了タイミングを設定する事で、連続し
た、ポートからのパルス出力制御を行ない、 さらに、パルス出力の開始と終了を規定するコンペア
レジスタに設定するデータが、誤ったパルス出力を発生
させてしまう可能性のある場合には、これを検出してベ
クタ割り込みを発生させ、CPUに対して特殊処理の必要
を通知している。
As described above, according to the present invention, when the start and end timing signals of the pulse output are received as the interrupt request signal,
Continuous pulse output from ports by setting the start and end timing of pulse output in the next cycle based on data set in advance at a predetermined address without saving C and PSW to the stack space If the data set in the compare register that defines the start and end of pulse output may cause erroneous pulse output, this is detected and a vector interrupt is generated. Is notified to the CPU that special processing is required.

〔実施例〕〔Example〕

以下、本発明を図面を参照して説明する。 Hereinafter, the present invention will be described with reference to the drawings.

第1図は、第1の実施例を示すパルス発生装置のブロ
ック図である。
FIG. 1 is a block diagram of a pulse generator showing a first embodiment.

本発明のパルス発生装置は、CPU100,データバス110,
アドレスバス111,INTC112,プログラムメモリ113,データ
メモリ114,周辺ハードウェア115から構成されている。
The pulse generator of the present invention includes a CPU 100, a data bus 110,
It comprises an address bus 111, an INTC 112, a program memory 113, a data memory 114, and peripheral hardware 115.

CPU100は、ALU101,テンポラリレジスタ102,汎用レジ
スタ103,アドレスバッファ104(図ではABで表現されて
いる),μアドレス生成部105,μROM106,PC107,PSW108,
タイミング制御部109から構成される。
The CPU 100 includes an ALU 101, a temporary register 102, a general-purpose register 103, an address buffer 104 (represented by AB in the figure), a μ address generator 105, a μROM 106, a PC 107, a PSW 108,
It comprises a timing control unit 109.

またINTC112は、割り込み要求フラグ116と形態指定フ
ラグ119から構成され、タイミング制御部109に対し、割
り込み要求信号117と形態指定信号120を出力する。タイ
ミング制御部109は、INTC112に対し割り込み要求クリア
信号118の形態変更信号121を出力する。
The INTC 112 includes an interrupt request flag 116 and a form designation flag 119, and outputs an interrupt request signal 117 and a form designation signal 120 to the timing control unit 109. The timing control unit 109 outputs a form change signal 121 of the interrupt request clear signal 118 to the INTC 112.

INTC112は、外部のハードウェアから幾つかの割り込
み信号を受け付け、各割り込みソースに割当てられた優
先順位を判別し、最も高い優先順位をもった割り込みソ
ースを一つ選択し、その割り込みソースに対応した割り
込み要求フラグ116をセットする。割り込み要求フラグ1
16と形態指定フラグ119は、割込み要求がn個あるとき
には、それぞれn個設定されているが、図中には1組だ
け記載されている。また、外部のハードウェアからの割
り込み信号や、優先順位判別部などは、本発明の主旨に
直接関係ないため、特に図示はしていない。
The INTC112 accepts several interrupt signals from external hardware, determines the priority assigned to each interrupt source, selects one interrupt source with the highest priority, and responds to that interrupt source The interrupt request flag 116 is set. Interrupt request flag 1
When there are n interrupt requests, n and 16 are set for each of the type designation flags 119, but only one set is shown in the figure. Further, an interrupt signal from external hardware, a priority determination unit, and the like are not particularly illustrated because they are not directly related to the gist of the present invention.

INTC112からの割り込み要求を、CPU100は2通りの形
態で処理することができる。1つは従来からのベクタ割
り込み処理で、もう1つは、本発明の主旨であるところ
の処理形態で、割り込みが発生すると、ベクタテーブル
は参照せず、データメモリ114中の特定アドレスに予め
設定されている処理形態情報に基づき、所定のデータ処
理を実行する形態である。以下、この所定のデータ処理
のことをマイクロサービスと記す。
The CPU 100 can process an interrupt request from the INTC 112 in two forms. One is the conventional vector interrupt processing, and the other is the processing mode which is the gist of the present invention. When an interrupt occurs, the vector table is not referred to but is set to a specific address in the data memory 114 in advance. This is a mode in which predetermined data processing is executed based on the processed processing mode information. Hereinafter, this predetermined data processing is referred to as a micro service.

ベクタ割り込みがマイクロサービスかの指定は、形態
指定フラグ119で行ない、CPU100から形態指定フラグ119
に“0"が設定されている時にはベクタ割り込みとして、
“1"が設定された時にはマイクロサービスとして指定さ
れる。
Whether or not the vector interrupt is a micro service is specified by the configuration specifying flag 119, and the CPU 100 specifies the configuration specifying flag 119.
Is set to “0” as a vector interrupt,
When "1" is set, it is designated as a microservice.

なお、本実施例における周辺ハードウェア構成とその
動作は、従来例における図9に示す周辺ハードウェア構
成および前述の動作説明と同様であるため、ここでの説
明は省略する。
The peripheral hardware configuration and the operation in the present embodiment are the same as the peripheral hardware configuration shown in FIG. 9 in the conventional example and the above-described operation description, and thus description thereof will be omitted.

次に、本発明のマイクロサービスの処理形態を指定す
る処理形態情報について説明する。第2図は処理形態情
報の構成を示す。処理形態情報はデータメモリ114中の
特定のアドレスに配置され、本例の処理形態情報は、チ
ャネルポインタを有する1バイトのヘッダ部と、チャネ
ルポインタによって指し示される2ワードのマイクロサ
ービスチャネルによって構成される。
Next, processing mode information for specifying the processing mode of the micro service of the present invention will be described. FIG. 2 shows the configuration of the processing mode information. The processing mode information is arranged at a specific address in the data memory 114, and the processing mode information of this example is constituted by a 1-byte header section having a channel pointer and a 2-word microservice channel pointed to by the channel pointer. You.

本例のマイクロサービスチャネルは1本のパルス出力
を想定した構成となっており、出力パルスの出力開始タ
イミングを指定するワードデータ1と、出力パルスの出
力終了タイミングを指定するワードデータ2から構成さ
れている。
The micro service channel of this example has a configuration assuming one pulse output, and is composed of word data 1 specifying an output start timing of an output pulse and word data 2 specifying an output end timing of an output pulse. ing.

ワードデータ1はポートPから出力されるパルス出力
の、タイマ901のカウント値0からパルス出力を開始す
るカウント値までの期間に相当するワードデータが、ま
たワードデータ2は、タイマ901のカウント値0から、
パルス出力を終了するカウント値までの期間に相当する
ワードデータ、すなわち出力パルスのパルス幅を規定す
るためのワードデータが、CPU100によって格納される。
Word data 1 is word data corresponding to a period from the count value 0 of the timer 901 to the count value at which pulse output is started, of the pulse output output from the port P, and word data 2 is the count value 0 of the timer 901. From
The CPU 100 stores word data corresponding to a period up to the count value at which the pulse output ends, that is, word data for defining the pulse width of the output pulse.

本例のマイクロサービスは、COMPS903,COMPR904から
の一致信号913,914によって起動される。マイクロサー
ビスが起動される以前に、CPU100はマイクロサービスチ
ャネルやハードウェアに対し初期化を行なう。
The micro service of this example is activated by the coincidence signals 913 and 914 from the COMPS903 and COMPR904. Before the micro service is started, the CPU 100 initializes a micro service channel and hardware.

第3図(a),(b)は、本例のマイクロサービスを
フローチャートで示したもので、実際にはμプログラム
制御となっている。また、第4図は本実施例におけるパ
ルス出力パターン例である。
FIGS. 3A and 3B are flow charts showing the microservices of the present embodiment, and are actually controlled by the μ program. FIG. 4 shows an example of a pulse output pattern in this embodiment.

以下、第1図乃至第4図を参照しながら、マイクロサ
ービスおよびパルス出力の制御動作の説明を行なう。た
だし、出力F/F905はリセットされていて、ポートPから
のパルス出力がロウレベルである時から説明を行う。
Hereinafter, the control operation of the micro service and the pulse output will be described with reference to FIG. 1 to FIG. However, the output F / F 905 is reset, and the description starts from the time when the pulse output from the port P is at a low level.

まずタイマ901はCOMPT902の一致信号912によりオール
“0"にクリアされ、初期値0よりカウント動作を開始す
る。(第4図−タイミングt0,t3,t6,t9) 次に、COMPS903の保持値がタイマ901のカウント値と
一致すると、一致信号913を出力する。また一致信号913
は、出力F/F905に入力され、出力F/F905をセットするこ
とで、ポートPからのパルス出力をハイレベルにする。
さらに、一致信号913は上記の動作を行うとともに、割
り込み要求をINTC112に対し発生する。(第4図−タイ
ミングt1,t4,t7) INTC112が一致信号913の割り込み要求を受け付ける
と、このソースに対応する割り込み要求フラグ116をセ
ットし、割り込み要求信号117をアクティブにする。
First, the timer 901 is cleared to all “0” by the coincidence signal 912 of the COMPT 902 and starts counting from the initial value 0. (FIG. 4—timings t0, t3, t6, t9) Next, when the value held in the COMPS 903 matches the count value of the timer 901, a match signal 913 is output. Also match signal 913
Is input to the output F / F 905, and by setting the output F / F 905, the pulse output from the port P is set to a high level.
Further, the coincidence signal 913 performs the above operation and generates an interrupt request to the INTC 112. (FIG. 4—Timings t1, t4, t7) When the INTC 112 receives the interrupt request of the coincidence signal 913, the interrupt request flag 116 corresponding to this source is set and the interrupt request signal 117 is activated.

タイミング制御部109は、命令処理の終りで割り込み
要求信号117をサンプルし、アクティブであるため、形
態指示手段120をサンプルする。形態指示手段120がマイ
クロサービスを示す“1"であることを検知すると、PC10
7,PSW108の情報を保持したまま、μROM106のマイクロサ
ービス処理エントリアドレスを生成し、マイクロサービ
スを開始する。
The timing control unit 109 samples the interrupt request signal 117 at the end of the instruction processing, and samples the configuration instruction means 120 because it is active. When the form instruction unit 120 detects that the value is “1” indicating the micro service, the PC 10
7. The micro service processing entry address of the μROM 106 is generated while holding the information of the PSW 108, and the micro service is started.

以降、マイクロサービスのμプログラム指令に従って
処理される処理フローの説明を第3図(a)のフローチ
ャートにそって進める。
Hereinafter, the description of the processing flow processed in accordance with the microprogram command of the microservice will proceed with the flowchart of FIG.

まず最初に、一致信号913を割込みソースとするマイ
クロサービスのヘッダを、データメモリ114中の特定ア
ドレスから読み出し、マイクロサービスチャネルのアド
レスを検出する。
First, the header of the micro service using the coincidence signal 913 as an interrupt source is read from a specific address in the data memory 114, and the address of the micro service channel is detected.

次に、タイマ901の内容を読み込み、このとき読み込
んだタイマのカウント値と、このマイクロサービス処理
に対応するマイクロサービスチャネル中のワードデータ
1とを比較する。(以下、この読み込みデータをTMOと
いう。) 比較の結果、TMOよりワードデータ1が小なる場合に
は、ワードデータ1をCOMPS903に設定する。
Next, the content of the timer 901 is read, and the count value of the timer read at this time is compared with the word data 1 in the micro service channel corresponding to the micro service processing. (Hereinafter, this read data is referred to as TMO.) As a result of comparison, if word data 1 is smaller than TMO, word data 1 is set to COMPS903.

次にμプログラムの指令で、タイミング制御部109
は、割込み要求クリア信号118をINTC112に対し出力し、
割込み要求フラグ116をリセットしたマイクロサービス
処理を終了する。
Next, the timing control unit 109
Outputs the interrupt request clear signal 118 to the INTC 112,
The micro service processing in which the interrupt request flag 116 has been reset ends.

マイクロサービス処理が終了すれば、タイミング制御
部109は保持していたPC107,PSW108の値から通常の命令
処理を再開する。
When the micro service processing is completed, the timing control unit 109 restarts the normal instruction processing from the values of the PC 107 and PSW 108 held.

あるいは、比較の結果、TMOよりワードデータ1の方
が大なる場合には、COMPS903へのワードデータ1の設定
は行わずに、μプログラムの指令で、タイミング制御部
109は、形態変更信号121をINTC112に対し出力し、形態
指定フラグ119をリセットし、マイクロサービスを終了
する。
Alternatively, as a result of the comparison, if the word data 1 is larger than the TMO, the word control 1 is not set in the COMPS903, and the timing control unit is instructed by the μ program command.
109 outputs the form change signal 121 to the INTC 112, resets the form designation flag 119, and ends the micro service.

INTC112は、割り込み要求116フラグがセット状態で、
形態指定フラグ119がリセット状態であるため、今度は
通常のベクタ割り込み要求をCPU100に対し発生し、前述
したベクタ割り込み処理を起動する。
INTC112 has the interrupt request 116 flag set,
Since the mode designation flag 119 is in the reset state, a normal vector interrupt request is issued to the CPU 100, and the above-described vector interrupt process is started.

ここで実行される割り込み処理では、COMPS903へのワ
ードデータ1の設定(更新)の処理が行われなかった場
合の処理で、COMPS903へのワードデータ1の設定が未完
了であることを記憶する等の特殊処理を行う。
In the interrupt processing executed here, the processing of setting (updating) the word data 1 to the COMPS 903 is not performed, and the fact that the setting of the word data 1 to the COMPS 903 is not completed is stored. Perform special processing of

この後、タイマ901はカウント動作を続け、COMPR904
の保持値がタイマ901のカウント値と一致すると、一致
信号914を出力する。一致信号914は、出力F/F905に入力
され、出力F/F905をリセットすることで、ポートPから
のパルス出力をロウレベルにする。さらに、一致信号91
4は上記の動作を行うとともに、割り込み要求INTC112に
対し発生する。(第4図−タイミングt2,t5,t8) INTC112が一致信号914の割り込み要求を受け付ける
と、このソースに対応する割り込み要求フラグ116をセ
ットし、割り込み要求信号117をアクティブにする。
After this, the timer 901 continues counting and the COMPR904
When the value held by the timer 901 matches the count value of the timer 901, the matching signal 914 is output. The coincidence signal 914 is input to the output F / F 905, and resetting the output F / F 905 changes the pulse output from the port P to low level. Further, the match signal 91
No. 4 performs the above operation and is generated in response to the interrupt request INTC112. (FIG. 4—Timings t2, t5, t8) When the INTC 112 receives the interrupt request of the coincidence signal 914, the interrupt request flag 116 corresponding to this source is set and the interrupt request signal 117 is activated.

タイミング制御部109は、命令処理の終りで割り込み
要求信号117をサンプルし、アクティブであるため、形
態指示手段120をサンプルする。形態指示手段120がマイ
クロサービスを示す“1"であることを検知すると、PC10
7,PSW108を保持したまま、μROM106のマイクロサービス
処理エントリアドレスを生成し、マイクロサービスを開
始する。
The timing control unit 109 samples the interrupt request signal 117 at the end of the instruction processing, and samples the configuration instruction means 120 because it is active. When the form instruction unit 120 detects that the value is “1” indicating the micro service, the PC 10
7. While maintaining the PSW 108, the micro service processing entry address of the μROM 106 is generated, and the micro service is started.

以降、マイクロサービスのμプログラム指令に従って
処理される。処理フローの説明を第2図(b)のフロー
チャートにそって進める。
Thereafter, processing is performed in accordance with the microservice μ program command. The description of the processing flow proceeds according to the flowchart of FIG.

まず最初に、一致信号914を割り込みソースとするマ
イクロサービスのヘッダを、データメモリ114中の特定
アドレスから読み出し、マイクロサービスチャネルの位
置を検出した後、このマイクロサービス処理に対応する
マイクロサービスチャネル中のワードデータ2をCOMPR9
04に格納する。
First, the header of the micro service having the coincidence signal 914 as an interrupt source is read from a specific address in the data memory 114, and the position of the micro service channel is detected. COMPR9 word data 2
Store in 04.

次にμプログラムの指令で、タイミング制御部109
は、割込み要求クリア信号118をINTC112に対し出力し、
割込み要求フラグ116をリセットしてマイクロサービス
処理を終了する。
Next, the timing control unit 109
Outputs the interrupt request clear signal 118 to the INTC 112,
The interrupt request flag 116 is reset and the micro service processing ends.

マイクロサービス処理が終了すれば、タイミング制御
部109は保持していたPC107,PSW108の値から通常の命令
処理を再開する。
When the micro service processing is completed, the timing control unit 109 restarts the normal instruction processing from the values of the PC 107 and PSW 108 held.

この後、タイマ901がさらにカウントをつづけ、COMPT
902の保持値がタイマ901のカウント値と一致すると、CO
MPT901は一致信号912を出力する。この一致信号912は、
タイマ901に入力され、タイマ901のカウント値をオール
“0"に初期化する。さらに、一致信号912は、INTC112に
入力され、INTC112に対して、割り込み処理を要求する
(第4図−タイミングt3,t6,t9) INTC112が一致信号912の割込み要求を受け付けると、
このソースに対応する割込み要求フラグ116をセット
し、割込み要求信号117をアクティブにする。
After this, the timer 901 continues counting and the COMPT
When the held value of 902 matches the count value of timer 901, CO
MPT 901 outputs match signal 912. This match signal 912 is
The count value is input to the timer 901 and the count value of the timer 901 is initialized to all “0”. Further, the match signal 912 is input to the INTC 112 and requests an interrupt process to the INTC 112 (FIG. 4—timing t3, t6, t9). When the INTC 112 receives the interrupt request of the match signal 912,
The interrupt request flag 116 corresponding to this source is set, and the interrupt request signal 117 is activated.

タイミング制御部109は、命令処理の終りで割込み要
求信号117をサンプルし、アクティブであるため、形態
指示手段120をサンプルする。ここでは、形態指示手段1
20は“0"であるので、前述のベクタ割り込み処理が起動
される。
The timing control unit 109 samples the interrupt request signal 117 at the end of the instruction processing, and samples the configuration instruction unit 120 because it is active. Here, the form instructing means 1
Since 20 is "0", the above-described vector interrupt processing is started.

ここで起動される割り込み処理では、まず、先の一致
信号913によるマイクロサービスによる割り込み処理の
情報に基づいて、COMPS903へのデータ更新が未完了の場
合には、この処理を実行する。
In the interrupt processing started here, first, if the data update to the COMPS 903 is not completed based on the information on the interrupt processing by the micro service based on the coincidence signal 913, this processing is executed.

次に、一致信号913,914によって起動されるマイクロ
サービス実行の際に、COMPS903,COMPR904に設定するデ
ータを、ワードデータ1とワードデータ2に設定し、割
り込み処理を終了する。
Next, at the time of executing the micro service activated by the coincidence signals 913 and 914, the data set in the COMPS 903 and COMPR 904 are set in the word data 1 and the word data 2, and the interrupt processing is terminated.

この割り込み処理と一致信号913,914による割り込み
処理の実行により、1周期についてのパルス出力の制御
が完了する。従って、これをくり返し行うと、連続した
パルス出力制御を行うことができる。
By executing the interrupt process and the interrupt process using the coincidence signals 913 and 914, the control of the pulse output for one cycle is completed. Therefore, if this operation is repeated, continuous pulse output control can be performed.

また、COMPS903に設定した値が、そのときのタイマの
カウント値より大きい場合に生じていた、次周期のパル
ス出力を現周期内で出力を開始してしまうという不具合
に対しては、マイクロサービスでこれを判別し、ベクタ
割り込みを発生させて、ソフトウェア処理により、常に
正しいパルス出力開始タイミングに補正することが可能
である。
In addition, if the value set in the COMPS903 is larger than the count value of the timer at that time, the problem that the pulse output of the next cycle starts to be output within the current cycle will be This can be determined, a vector interrupt can be generated, and the pulse output start timing can always be corrected by software processing.

このため、従来のパルス出力パターン例の第7図にお
ける、周期S2+S3に示す様なパターンの誤発生部分、す
わちタイミングtX〜t6〜t7〜t8の期間は現れず、本来意
図した通りのパルス波形である図4の周期S2に示す様な
パルス出力波形が得られる。
For this reason, in FIG. 7 of the conventional pulse output pattern example, the erroneous portion of the pattern as shown by the cycle S2 + S3, that is, the period of the timings tX to t6 to t7 to t8 does not appear, and the originally intended pulse waveform Thus, a pulse output waveform as shown in a cycle S2 of FIG. 4 is obtained.

以上説明した様に、本発明のパルス発生装置は、現周
期のCPMPS903,COMPR904の一致によって起動される割り
込み処理により、次周期に出力しようとする出力パルス
の、出力開始タイミングと出力終了タイミングを設定す
ることにより、継続的にパルス出力を行うことが可能で
ある。
As described above, the pulse generator of the present invention sets the output start timing and output end timing of the output pulse to be output in the next cycle by the interrupt processing started by the coincidence of the current cycle CPMPS 903 and COMPR904. By doing so, it is possible to continuously output pulses.

なお本実施例では、出力パルスの周期に関する制御、
すなわちCOMPT902の設定データの更新は行っていない
が、COMPT902が出力する一致信号912による割り込み処
理の際に、COMPT902を逐次、所定のワードデータに更新
する処理を実行すれば、1周期毎に、異なる周期のパル
ス出力を発生することが可能となるため、応用にあわせ
てより高精度のパルス出力の制御が実現できる。
In this embodiment, the control related to the cycle of the output pulse,
In other words, although the setting data of the COMPT 902 is not updated, if the process of updating the COMPT 902 to predetermined word data is executed successively at the time of the interrupt processing by the coincidence signal 912 output from the COMPT 902, the setting is different for each cycle. Since pulse output with a period can be generated, pulse output control with higher precision can be realized according to the application.

次に、本発明の第2の実施例をしめす。 Next, a second embodiment of the present invention will be described.

なお本実施例では、パルス発生装置の構成と基本的動
作は、前実施例と同様であるため、ここでは詳細な説明
は省略する。
In this embodiment, the configuration and the basic operation of the pulse generator are the same as those of the previous embodiment, and therefore, detailed description is omitted here.

以下に、第3図(a),(c),第4図を参照しなが
ら本実施例における、マイクロサービスおよびパルス出
力の制御動作の説明を行なう。ただし、タイマ901は、
カウント動作を行っていて、また出力F/F905はリセット
されていて、ポートPからのパルス出力はロウレベルで
あるとする。
Hereinafter, the control operation of the micro service and the pulse output in this embodiment will be described with reference to FIGS. 3 (a), (c) and FIG. However, timer 901
It is assumed that the counting operation is performed, the output F / F 905 is reset, and the pulse output from the port P is at a low level.

なお、本例のマイクロサービスチャネルの構成は、実
施例1と同様であるので、説明は省略する。
The configuration of the micro service channel of this example is the same as that of the first embodiment, and a description thereof will not be repeated.

第3図(a),(c)は、本例のマイクロサービスを
フローチャートで示したもので、実際にはμプログラム
制御となっている。また、第4図は、本実施例における
パルス出力パターン例である。
FIGS. 3 (a) and 3 (c) show a flowchart of the micro service of the present embodiment, and are actually μ program control. FIG. 4 shows an example of a pulse output pattern in this embodiment.

さて、COMPS903は、その保持値がタイマ901のカウン
ト値と一致すると、一致信号913を出力し、この一致信
号913は、出力F/F905をセットすることで、ポートPか
らのパルス出力をハイレベルにするとともに、INTC112
に対し割り込み要求を発生する。この要求によってINTC
112は、割り込み要求信号117をタイミング制御部109に
対し出力し、タイミング制御部109がこの要求を受け付
けると、割り込み処理が起動され、COMPS903の設定デー
タ更新のための処理が行なわれる。(第4図−タイミン
グt1,t4,t7) ただし、この割り込み処理は、実施例1において、一
致信号913によって起動される割り込み処理と同様であ
るので、ここで説明は省略する。(処理フローは第3図
(a)を参照) 一方、一致信号913によって起動された割り込み処理
の間も、タイマ904はカウントを続け、COMPR904の保持
値がタイマ904のカウント値と一致すると、COMPR904は
一致信号914を出力し、出力F/F905をリセットすること
で、ポートPからのパルス出力をロウレベルにするとと
もに、INTC112に対して割り込み要求を発生する。この
要求によってINTC112は、割り込み要求信号117をタイミ
ング制御部109に対し出力し、タイミング制御部109がこ
の要求を受け付けると、割り込み処理が起動され、COMP
R904の設定データ更新のための処理が行なわれる。(第
4図−タイミングt2,t5,t8) ここで起動される割り込み処理では、まずマイクロサ
ービスが起動される。以降、マイクロサービスの処理フ
ローの説明を第3図(c)のフローチャートにそって進
める。
When the held value matches the count value of the timer 901, the COMPS 903 outputs a match signal 913. The match signal 913 sets the output F / F 905 to change the pulse output from the port P to a high level. And INTC112
Generates an interrupt request. This request causes the INTC
The 112 outputs an interrupt request signal 117 to the timing control unit 109. When the timing control unit 109 receives this request, an interrupt process is started and a process for updating the setting data of the COMPS 903 is performed. (FIG. 4—timing t1, t4, t7) However, since this interrupt processing is the same as the interrupt processing started by the coincidence signal 913 in the first embodiment, the description is omitted here. (See FIG. 3 (a) for the processing flow.) On the other hand, the timer 904 continues counting even during the interrupt processing started by the coincidence signal 913, and when the value held in the COMPR904 matches the count value of the timer 904, the COMPR904 Outputs a coincidence signal 914 and resets the output F / F 905, thereby making the pulse output from the port P low level and generating an interrupt request to the INTC 112. In response to this request, the INTC 112 outputs an interrupt request signal 117 to the timing control unit 109. When the timing control unit 109 receives this request, the interrupt processing is started and the COMP
Processing for updating the setting data of R904 is performed. (FIG. 4—timing t2, t5, t8) In the interrupt processing started here, first, the micro service is started. Hereinafter, the description of the processing flow of the micro service proceeds according to the flowchart of FIG.

まず最初に、一致信号914を割込みソースとするマイ
クロサービスへのヘッダを、データメモリ114中の特定
アドレスから読み出し、マイクロサービスチャネルの位
置を検出し、このマイクロサービス処理に、ワードデー
タ2が対応していることを認知する。
First, a header to the micro service using the coincidence signal 914 as an interrupt source is read from a specific address in the data memory 114, the position of the micro service channel is detected, and the word data 2 corresponds to the micro service processing. Recognize that

次に、COMPS903の内容を読み出し、この読み出し値と
ワードデータ2とを比較する。
Next, the content of the COMPS 903 is read, and the read value is compared with the word data 2.

比較の結果、ワードデータ2の値がCOMPS903からの読
み出し値より、小なる場合には、ワードデータ2をCOMP
R904に格納したのち、マイクロサービス処理を終了す
る。(第4図の周期S1のタイミングt1とt2の関係に相
当) マイクロサービス処理が終了すれば、タイミング制御
部109は保持していたPC107,PSW108の値から通常の命令
処理を再開する。
If the result of the comparison indicates that the value of word data 2 is smaller than the read value from COMPS903, word data 2 is COMP
After storing in R904, the micro service processing ends. (Corresponding to the relationship between the timings t1 and t2 of the cycle S1 in FIG. 4) When the microservice processing ends, the timing control unit 109 restarts the normal instruction processing from the values of the PCs 107 and PSW 108 held.

あるいは、比較の結果、ワードデータ2の値がCOMPS9
03からの読み出し値より、大なる場合には、COMPR904へ
のデータ更新は行なわずに、マイクロサービスを終了
し、今度は通常のベクタ割り込み処理を起動する。
Alternatively, as a result of comparison, the value of word data 2 is COMPS9
If the value is larger than the read value from 03, the micro service is terminated without updating the data to the COMPR904, and the normal vector interrupt processing is started this time.

ここで起動されるベクタ割り込み処理は、設定しよう
とする次周期のパルス出力終了タイミングが、(先の一
致信号913によって起動された割り込み処理ですでに設
定済みの)次周期のパルス出力開始タイミングより前の
タイミングになっている場合の特殊処理で、ワードデー
タ2の内容の補正および補正後のデータのCOMPR904への
設定、または場合によっては、COMPS903へのデータ再設
定等の処理を実行する。
In the vector interrupt processing started here, the pulse output end timing of the next cycle to be set is set to be shorter than the pulse output start timing of the next cycle (already set in the interrupt processing started by the previous match signal 913). In the special processing at the previous timing, processing such as correction of the contents of the word data 2 and setting of the corrected data in the COMPR 904 or, in some cases, resetting of the data in the COMPS 903 is executed.

上記の処理実行後、ベクタ割り込み処理は終了し、一
致信号914によって起動される全ての割り込み処理を終
了する。
After the execution of the above processing, the vector interrupt processing ends, and all the interrupt processing started by the coincidence signal 914 ends.

この後、COMPT902の保持値と、タイマ901のカウント
値が一致すると、COMPT902は一致信号912を出力し、割
り込み処理を要求するが、ここで行われる割り込み処理
は、実施例1と同様であるので、ここでの説明は省略す
る。
Thereafter, when the value held by the COMPT 902 matches the count value of the timer 901, the COMPT 902 outputs a match signal 912 and requests an interrupt process. Since the interrupt process performed here is the same as in the first embodiment, The description here is omitted.

以上の、一致信号912,913,914によって起動される割
り込み処理によって1周期におけるパルス出力が制御で
きる。したがって、この動作を繰り返し実行することに
より、連続したパルス出力の制御を実行することができ
る。
The pulse output in one cycle can be controlled by the interrupt processing started by the coincidence signals 912, 913, 914 described above. Therefore, by repeatedly performing this operation, control of continuous pulse output can be performed.

また、通常ワードデータ1およびワードデータ2とし
て設定されるデータは、データメモリ114内にあらかじ
め用意した基本データを基に、他の周辺ハードウェア等
からの情報を加味したプログラム処理によって生成され
る場合が多いが、基本データやワードデータ生成過程の
プログラム等に誤りがあると、タイマ901のカウント値
に対して、パルス出力を開始するタイミングすなわちワ
ードデータ1より、パルス出力を終了するタイミングす
なわちワードデータ2のほうが、小さい値を持つような
組合せのワードデータの設定を行ってしまうことが考え
られる。このような場合、パルス出力を終了するタイミ
ングが、パルス出力を開始するタイミングより先に来て
しまうと、パルス出力開始タイミングで出力を開始した
パルスは、同じ周期内では、パルス出力を終了するタイ
ミングが来ないことにより、次の周期のパルス出力終了
タイミングまで継続したパルス出力になってしまうこと
になる。このような、パルス出力は、実施例1でも述べ
た通り、制御対象に対して重大な問題を引き起こすこと
が考えられる。
Also, the data normally set as the word data 1 and the word data 2 is generated by a program process based on basic data prepared in advance in the data memory 114 and taking into account information from other peripheral hardware and the like. However, if there is an error in the program of the basic data or word data generation process, the timing of starting pulse output, that is, the word data 1 is changed to the timing of terminating pulse output, It is conceivable that 2 sets the combination of word data having a smaller value. In such a case, if the pulse output end timing comes before the pulse output start timing, the pulse output start timing at the pulse output start timing becomes the pulse output end timing within the same cycle. Does not come, the pulse output continues until the pulse output end timing of the next cycle. Such a pulse output may cause a serious problem for the control target as described in the first embodiment.

このような場合に対し、本実施例では、COMPR904が出
力する一致信号414によって起動される割り込み処理
で、上記のようなパルスの発生が予想される場合には、
次周期のパルス出力終了タイミングとして設定しようと
するワードデータ2の値を補正することで対処し、不具
合パルスの発生を防止している。
In such a case, in the present embodiment, in the interrupt processing started by the coincidence signal 414 output from the COMPR904, when the occurrence of the above-described pulse is expected,
The countermeasure is made by correcting the value of the word data 2 to be set as the pulse output end timing of the next cycle, thereby preventing the occurrence of a defective pulse.

〔発明の効果〕〔The invention's effect〕

以上説明した通り本発明のパルス発生装置は、パルス
出力の開始と終了タイミングの設定(更新)のための割
り込みを、マイクロサービスによって処理し、ベクタ割
り込み要求を発生しないため、パルス出力の周波数が増
加しても、割込み処理プログラムへ移行する際のPC,PSW
のスタックへの退避や、割り込み処理プログラムからメ
イン処理へ戻る時、スタックの内容をPC,PSWへ復帰する
処理でCPU時間を占めることがない。
As described above, the pulse generator of the present invention processes the interrupt for setting (updating) the start and end timings of the pulse output by the microservice and does not generate a vector interrupt request, so that the frequency of the pulse output increases. PC, PSW when switching to the interrupt processing program
When saving to the stack or returning to the main process from the interrupt processing program, the process of restoring the contents of the stack to the PC and PSW does not take up CPU time.

また、タイマのカウント値に対して、マイクロサービ
スにより、パルス出力の開始と終了を制御するコンペア
レジスタに設定しようとするデータが、誤ったパルスを
発生させてしまう可能性がある場合には、これを検出し
て、その結果により、ベクタ割り込みを起動し、特殊処
理を行うことで、常に正常なパルスを発生することがで
きる。
Also, if there is a possibility that the data to be set in the compare register that controls the start and end of pulse output by the microservice with respect to the count value of the timer may cause an erroneous pulse, Is detected, a vector interrupt is activated according to the result, and special processing is performed, so that a normal pulse can always be generated.

さらに、パルス発生装置において、ポート数の増加、
すなわち制御するパルス出力の本数が増加した場合に
も、1周期の間についてみれば、すべてのポートに対し
ての割り込み処理を、マイクロサービスによって対処す
ることができる。このため、ポート数の増加に伴う割り
込み処理時間の増加という点に関しては、これをすべて
ベクタ割り込み処理で実行する場合に比して、より短時
間で割り込み処理を実行できる。
Furthermore, in the pulse generator, the number of ports is increased,
That is, even when the number of pulse outputs to be controlled increases, the interrupt processing for all the ports can be dealt with by the micro service in one cycle. For this reason, regarding the increase in the interrupt processing time accompanying the increase in the number of ports, the interrupt processing can be executed in a shorter time than in the case where all the processing is executed by the vector interrupt processing.

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

第1図は本発明の第1の実施例におけるシステム構成
図、第2図は実施例におけるマイクロサービスの処理形
態情報構成図、第3図は実施例における割り込み処理フ
ローチャート、第4図は実施例におけるポートPからの
パルス出力パターン図、第5図は従来例におけるポート
Pからのパルス出力パターン図、第6図は従来例におけ
るシステム構成図、第7図は従来例における周辺ハード
ウェア構成図である。 100,800……CPU、101……ALU、102……テンポラリレジ
スタ、103……汎用レジスタ、104……アドレスバッフ
ァ、105……μアドレス生成部、106……μROM、107……
PC、108……PSW、109……タイミング制御部、110……デ
ータバス、111……アドレスバス、112……INTC、113…
…プログラムメモリ、114……データメモリ、115……周
辺ハードウェア、116……割込み要求フラグ、117……割
込み要求信号、118……割込み要求クリア信号、119……
形態指定フラグ、120……形態指定信号、121……形態変
更信号、901……タイマ、902,903,904……コンペアレジ
スタ、912,913,914……一致信号、905……出力F/F。
FIG. 1 is a system configuration diagram of a first embodiment of the present invention, FIG. 2 is a configuration diagram of processing form information of a micro service in the embodiment, FIG. 5, a pulse output pattern diagram from a port P in a conventional example, FIG. 6 is a system configuration diagram in a conventional example, and FIG. 7 is a peripheral hardware configuration diagram in a conventional example. is there. 100, 800 CPU, 101 ALU, 102 temporary register, 103 general-purpose register, 104 address buffer, 105 μ address generator, 106 μROM, 107
PC, 108 ... PSW, 109 ... Timing control unit, 110 ... Data bus, 111 ... Address bus, 112 ... INTC, 113 ...
... program memory, 114 ... data memory, 115 ... peripheral hardware, 116 ... interrupt request flag, 117 ... interrupt request signal, 118 ... interrupt request clear signal, 119 ...
Form designation flag, 120 Form designation signal, 121 Form change signal, 901 Timer, 902,903,904 Compare register, 912,913,914 Match signal, 905 Output F / F.

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】命令の実行アドレスを保持するプログラム
カウンタ、プログラムの実行状態を保持する手段、汎用
レジスタ及びマイクロプログラムROMを含む中央処理装
置と、前記中央処理装置へ非同期に割り込み処理要求を
発生する割り込み要求発生回路と、プログラムメモリ
と、データメモリと、周辺回路とを有するデータ処理装
置において、前記周辺回路は、タイマと、前記タイマと
の比較を行う複数の比較レジスタと、パルス出力用の出
力ポートとを有し、前記割り込み要求発生回路は、割れ
込み処理要求の発生に加え、所定のデータ処理の要求を
発生する手段と、前記割り込み処理要求と前記所定のデ
ータ処理の要求を識別するための形態指示手段とを備
え、前記データメモリ内には前記所定のデータ処理の処
理形態を指定する処理形態情報が格納され、前記割り込
み要求発生回路から前記所定のデータ処理の要求が前記
中央処理装置に対して発生されると、前記中央処理装置
は前記形態指示手段が前記所定のデータ処理を指示して
いることを検出した場合には、命令実行処理を中断し、
前記処理形態情報に従い、前記データメモリ内の所定の
データと、当該タイミングにおける前記タイマの値また
は前記比較レジスタの値とを比較し、比較結果が所定の
条件のとき前記所定の比較レジスタへのデータ転送を行
う手段を有し、前記出力ポートからのパルス発生を制御
すると共に前記比較結果が所定の条件でないときに前記
割り込み発生回路から前記中央処理装置へ割り込み要求
を発生することを特徴とするデータ処理装置。
A central processing unit including a program counter for holding an execution address of an instruction, a means for holding an execution state of a program, a general-purpose register and a microprogram ROM, and an interrupt processing request generated asynchronously to the central processing unit. In a data processing device having an interrupt request generation circuit, a program memory, a data memory, and a peripheral circuit, the peripheral circuit includes a timer, a plurality of comparison registers for comparing the timer, and an output for pulse output. A port for generating a request for predetermined data processing in addition to generation of a crack processing request, and for identifying the interrupt processing request and the predetermined data processing request. And a processing form for designating a processing form of the predetermined data processing in the data memory. When information is stored and the request for the predetermined data processing is generated from the interrupt request generation circuit to the central processing unit, the central processing unit causes the configuration instruction unit to instruct the predetermined data processing. Instruction execution processing is interrupted,
According to the processing mode information, predetermined data in the data memory is compared with the value of the timer or the value of the comparison register at the timing, and when the comparison result is a predetermined condition, the data to the predetermined comparison register is Means for performing transfer, controlling generation of pulses from the output port and generating an interrupt request from the interrupt generation circuit to the central processing unit when the comparison result is not a predetermined condition. Processing equipment.
【請求項2】クロックによってインクリメント動作を行
うタイマ、第1のワードデータが記憶される第1のレジ
スタ、前記第1のワードデータよりも大きい第2のワー
ドデータが記憶される第2のレジスタ、前記タイマのカ
ウント値が前記第1のレジスタに記憶された第1のワー
ドデータと一致したことを検出して第1の制御信号をア
クティブにする第1の比較回路、前記タイマのカウント
値が前記第2のレジスタに記憶された前記第2のワード
データと一致したことを検出して前記第1の制御信号を
インアクティブにする第2の比較回路を備える周辺回路
と、前記第1の制御信号がアクティブになったことに応
答し、かつ、書き込むべき第3のワードデータが前記第
1のワードデータ以下の時には前記第1のレジスタに前
記第3のワードデータを書き込み、前記第3のワードデ
ータが前記第1のワードデータよりも大きい時には前記
第3のワードデータの前記第1のレジスタへの書き込み
を中止すると共に書き込みが未完了であるデータを記憶
し、前記第1の制御信号がインアクティブになったこと
に応答して前記第2のレジスタに第4のワードデータを
書き込む書き込み手段とを備えることを特徴とするデー
タ処理装置。
A timer for performing an increment operation by a clock; a first register for storing first word data; a second register for storing second word data larger than the first word data; A first comparison circuit that activates a first control signal by detecting that the count value of the timer matches the first word data stored in the first register, wherein the count value of the timer is A peripheral circuit including a second comparison circuit that detects a match with the second word data stored in a second register and inactivates the first control signal; and the first control signal Is activated, and when the third word data to be written is equal to or less than the first word data, the third word data is stored in the first register. When the third word data is larger than the first word data, the writing of the third word data to the first register is stopped, and the data whose writing is not completed is stored. And a writing means for writing fourth word data into the second register in response to the first control signal becoming inactive.
JP63331527A 1988-12-29 1988-12-29 Data processing device Expired - Fee Related JP2844624B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63331527A JP2844624B2 (en) 1988-12-29 1988-12-29 Data processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63331527A JP2844624B2 (en) 1988-12-29 1988-12-29 Data processing device

Publications (2)

Publication Number Publication Date
JPH02178802A JPH02178802A (en) 1990-07-11
JP2844624B2 true JP2844624B2 (en) 1999-01-06

Family

ID=18244652

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63331527A Expired - Fee Related JP2844624B2 (en) 1988-12-29 1988-12-29 Data processing device

Country Status (1)

Country Link
JP (1) JP2844624B2 (en)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS621058A (en) * 1985-06-26 1987-01-07 Nec Corp Information processor

Also Published As

Publication number Publication date
JPH02178802A (en) 1990-07-11

Similar Documents

Publication Publication Date Title
US5471595A (en) Asynchronous interrupt inhibit method and apparatus for avoiding interrupt of an inseparable operation
JP2655615B2 (en) Information processing device
JP2844624B2 (en) Data processing device
JP2003507815A (en) Interrupt service with save and return flags
JP2512119B2 (en) Microprocessor
JP2738141B2 (en) Single chip microcomputer
JPH0573296A (en) Microcomputer
JP2536102B2 (en) Data processing device
JP2536103B2 (en) Data processing device
JP4535663B2 (en) State machine control method and state machine
JP2720427B2 (en) Vector processing equipment
JPH02133833A (en) Controller for in-circuit emulator
JPS6128144A (en) Executing device of tracing
JPH01136251A (en) Self-diagnosing system
JPS5850367B2 (en) input/output control device
JPS6269352A (en) Microprocessor
JPS62296236A (en) Interruption processor for microprocessor
JPH0462093B2 (en)
JPH02287658A (en) Microprocessor
JPH0555895B2 (en)
JPS6349941A (en) Arithmetic processing unit
JPH02297221A (en) Executing speed control system for microprogram
JPH1124941A (en) Method and device for instruction execution control
JPH02287629A (en) Microprocessor
JPH02176143A (en) Pulse producing device

Legal Events

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