Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3068317B2 - Microcomputer - Google Patents
[go: Go Back, main page]

JP3068317B2 - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JP3068317B2
JP3068317B2 JP4086335A JP8633592A JP3068317B2 JP 3068317 B2 JP3068317 B2 JP 3068317B2 JP 4086335 A JP4086335 A JP 4086335A JP 8633592 A JP8633592 A JP 8633592A JP 3068317 B2 JP3068317 B2 JP 3068317B2
Authority
JP
Japan
Prior art keywords
circuit
input
latch
capture
capture register
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 - Lifetime
Application number
JP4086335A
Other languages
Japanese (ja)
Other versions
JPH05249261A (en
Inventor
光充 西村
Original Assignee
日本電気アイシーマイコンシステム株式会社
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 日本電気アイシーマイコンシステム株式会社 filed Critical 日本電気アイシーマイコンシステム株式会社
Priority to JP4086335A priority Critical patent/JP3068317B2/en
Publication of JPH05249261A publication Critical patent/JPH05249261A/en
Application granted granted Critical
Publication of JP3068317B2 publication Critical patent/JP3068317B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Measurement Of Unknown Time Intervals (AREA)
  • Microcomputers (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明はマイクロコンピュータに
関し、特に、そのトリガ信号入力によってカウンタの内
容をラッチするキャプチャ機能に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer, and more particularly, to a capture function for latching the contents of a counter by inputting a trigger signal.

【0002】[0002]

【従来の技術】近年マイクロコンピュータの応用分野は
急速に拡大し、多方面で用いられている 。特に、最近
はOA化,FA化などで物体を動かすモータの制御にマ
イクロコンピュータを使用することが多くなってきてい
る。モータ制御には、モータ制御に適したハードウェア
を備えたマイクロコンピュータが必要である。一般にマ
イクロコンピュータは図5に示すような構成である。マ
イクロコンピュータ1においては、メモリ2内に記憶さ
れている命令に従い、CPU3が演算処理を行い、周辺
機能4が制御される。周辺機能4は、マイクロコンピュ
ータ1の外部に接続される外付け機器に対して、制御信
号を出力したり、外付け機器からステータス信号を入力
したりして、外付け機器を制御する。上記モータの制御
に適したハードウェアはこの周辺機能4に属する。
2. Description of the Related Art In recent years, the application fields of microcomputers have been rapidly expanding and are being used in various fields. In particular, recently, microcomputers are increasingly used for controlling motors for moving objects in OA, FA, and the like. Motor control requires a microcomputer equipped with hardware suitable for motor control. Generally, a microcomputer has a configuration as shown in FIG. In the microcomputer 1, the CPU 3 performs arithmetic processing according to the instructions stored in the memory 2, and the peripheral functions 4 are controlled. The peripheral function 4 controls the external device by outputting a control signal to an external device connected to the outside of the microcomputer 1 or inputting a status signal from the external device. Hardware suitable for controlling the motor belongs to the peripheral function 4.

【0003】次に、図7にキャプチャ回路の構成図、図
6にキャプチャレジスタの1ビットの詳細な構成図を示
し、図8のタイミングチャートを用いて外部機器から発
生するパルスの時間間隔の計測方法について説明する。
図7において、トリガ信号は他の周辺機能、例えばマイ
クロコンピュータの外部から入力されたパルスを、マン
クロコンピュータ内部のシステムクロックに同期化した
信号である。トリガ信号はキャプチャレジスタ110に
接続され、CPUへの割込み要求信号にもなっている。
Next, FIG. 7 shows a configuration diagram of a capture circuit, FIG. 6 shows a detailed configuration diagram of one bit of a capture register, and measurement of a time interval of a pulse generated from an external device using a timing chart of FIG. The method will be described.
In FIG. 7, the trigger signal is a signal obtained by synchronizing a pulse input from another peripheral function, for example, from the outside of the microcomputer, to a system clock in the man-computer. The trigger signal is connected to the capture register 110 and also serves as an interrupt request signal to the CPU.

【0004】カウンタ(CNT)150は、カウントク
ロックが入力される毎にカウントアップする。カウント
クロックは、一定時間間隔で入力される。図7におい
て、キャプチャレジスタはCTOによって図示されてい
る。CPUがキャプチャレジスタ110のアドレスをア
ドレスバス100に入力し、読み出し信号(RD)10
2を信号線102から入力することにより、RDCTO
信号がリード制御回路104から出力される。同時にバ
ス接続回路106によってデータバス107とキャプチ
ャレジスタ110を接続しているバス108とが接続さ
れる。従って、キャプチャレジスタ110の値がデータ
バス100に読み出される。
A counter (CNT) 150 counts up each time a count clock is input. The count clock is input at fixed time intervals. In FIG. 7, the capture register is illustrated by CTO. The CPU inputs the address of the capture register 110 to the address bus 100, and the read signal (RD) 10
2 from the signal line 102, the RDCTO
A signal is output from the read control circuit 104. At the same time, the data bus 107 and the bus 108 connecting the capture register 110 are connected by the bus connection circuit 106. Therefore, the value of the capture register 110 is read onto the data bus 100.

【0005】カウンタ150のカウンタバス109は、
バス接続回路152を介してキャプチャレジスタ110
の各ビットラッチ202のデータ入力に接続されてい
る。従って、トリガ入力はラッチ202のラッチクロッ
クとなっている。このため、トリガ入力があると、カウ
ンタバス109を介してカウンタ150の内容がキャプ
チャレジスタ110にラッチされる。
[0005] The counter bus 109 of the counter 150 is
Capture register 110 via bus connection circuit 152
Is connected to the data input of each bit latch 202. Therefore, the trigger input is the latch clock of the latch 202. Therefore, when there is a trigger input, the content of the counter 150 is latched in the capture register 110 via the counter bus 109.

【0006】図8において、ステージCでトリガ入力が
あったと仮定する。トリガ入力はCPUへの割込み要求
信号として出力されるとともに、キャプチャレジスタ1
10に入力される。そこで、キャプチャレジスタ110
はカウンタ150の内容“01H”をラッチする。CP
Uでは、割込み要求信号を受け付けると実行中の処理を
中断し、ステージGにおいてキャプチャレジスタ110
の内容“01H”を読み出して記憶しておく。
[0008] In FIG. 8, it is assumed that there is a trigger input at stage C. The trigger input is output as an interrupt request signal to the CPU and the capture register 1
10 is input. Therefore, the capture register 110
Latches the content "01H" of the counter 150. CP
In U, when the interrupt request signal is received, the processing being executed is interrupted, and in the stage G, the capture register 110
Is read out and stored.

【0007】次に、ステージLにおいてトリガ入力があ
ったとする。キャプチャレジスタ110は同様に、カウ
ンタ150の内容“0AH”をラッチする。CPUで
は、割込み要求信号を受け付けると実行中の処理を中断
し、ステージPにおいてキャプチャレジスタ110の内
容“0AH”を読み出し前回の割込み処理で記憶してい
たキャプチャレジスタ110の内容“01H”と、今回
のキャプチャレジスタ110の内容“0AH”との差
“09H”を演算により求める。
Next, it is assumed that there is a trigger input at stage L. Similarly, the capture register 110 latches the content "0AH" of the counter 150. When the CPU accepts the interrupt request signal, the CPU interrupts the processing being executed, reads out the content “0AH” of the capture register 110 at stage P, and reads the content “01H” of the capture register 110 stored in the previous interrupt processing, and this time. The difference "09H" from the content "0AH" of the capture register 110 is obtained by calculation.

【0008】カウンタ150のカウントクロックは一定
時間間隔で入力されているため、キャプチャレジスタ1
10の内容の差“09H”と、カウントクロックの入力
時間間隔との積を演算することにより、外部機器から発
するパルスの時間間隔は容易に求めることができる。C
PUは、求められたパルスの時間間隔を判定し、外部機
器に対する制御、例えばモータをより早く回す等を行
う。
Since the count clock of the counter 150 is input at regular time intervals, the capture register 1
By calculating the product of the difference “09H” of the content of 10 and the input time interval of the count clock, the time interval of the pulse emitted from the external device can be easily obtained. C
The PU determines the time interval between the obtained pulses and performs control on the external device, for example, turning the motor faster.

【0009】近年、マイクロコンピュータは急速に高速
化されてきているため、上述した外部機器から発生する
パルスの時間間隔の計測にも高速化が要求される。しか
し、従来のマイクロコンピュータでは、トリガ入力が接
続されているキャプチャレジスタは固定されている。し
たがって、トリガを入力するごとにキャプチャレジスタ
でラッチしたカウンタの内容をCPUで読み出す場合、
トリガを入力してからCPUでキャプチャレジスタの内
容を読み出すまでの間に次のトリガ入力があると、キャ
プチャレジスタはカウンタの内容をラッチし直す。この
ため、1度目にキャプチャレジスタでラッチしたカウン
タの内容は消えてしまう。よって、トリガ入力の時間間
隔は、CPUが割込みを受け付け、CPUがキャプチャ
レジスタの内容を読み出す動作が完了するまでの時間以
上でなければならない。
In recent years, since the speed of microcomputers has been rapidly increased, the speed of measuring the time interval of the pulse generated from the above-mentioned external device is also required to be increased. However, in the conventional microcomputer, the capture register to which the trigger input is connected is fixed. Therefore, when the CPU reads the contents of the counter latched by the capture register every time a trigger is input,
If there is a next trigger input before the CPU reads the contents of the capture register after the input of the trigger, the capture register re-latches the contents of the counter. Therefore, the contents of the counter latched by the capture register for the first time are erased. Therefore, the time interval of the trigger input must be equal to or longer than the time from when the CPU accepts the interrupt and when the CPU completes the operation of reading the contents of the capture register.

【0010】[0010]

【発明が解決しようとする課題】解決しようとする問題
は、マイクロコンピュータで計測できるパルスの時間間
隔には限界があり、外部機器の制御を高速化できない点
である。
The problem to be solved is that there is a limit to the time interval of the pulse which can be measured by the microcomputer, and the control of the external device cannot be speeded up.

【0011】前記課題を解決するために本発明によるマ
イクロコンピュータは、プログラムまたはデータを記憶
するメモリと、前記プログラムに従って演算処理を実行
するCPUとを備えたマイクロコンピュータにおいて、
供給されるクロックにもとづいて内容を更新する単数ま
たは複数個のカウンタと、前記カウンタの内容をラッチ
する複数個のキャプチャレジスタと、前記キャプチャレ
ジスタが前記カウンタの内容をラッチするタイミングを
指定するトリガ信号入力毎に、前記カウンタの内容を
ッチするキャプチャレジスタを選択し、同一キャプチャ
レジスタが連続して前記カウンタの内容をラッチするこ
とを禁止するとともに、前記CPUにキャプチャレジス
タにラッチされた内容を読みだす割り込み要求信号を出
力するキャプチャレジスタ選択回路とを備えている。ま
た、本発明における前記キャプチャレジスタ選択回路
は、前記各トリガ信号をラッチする複数のラッチ手段
と、前記各トリガ信号が何番目のものであるかを判別
トリガ判定手段とラッチ条件を判定する複数のラッ
チ条件判定手段とから構成されている。さらに本発明に
おける前記各ラッチ手段は、Dラッチ回路およびRSラ
ッチ回路の組み合わせにより構成し、且つ、前記トリガ
判定手段はAND回路により構成し、且つ、前記各ラッ
チ条件判定手段はインバータおよび他のAND回路によ
り構成されている。
[0011] In order to solve the above-mentioned problems, a mask according to the present invention is used.
Microcomputer stores programs or data
DoExecutes arithmetic processing according to the memory and the program
DoIn a microcomputer including a CPU,
Update content based on supplied clockDoSingular
Or a plurality of counters and latch the contents of the counters
DoA plurality of capture registers;
The timing at which the register latches the contents of the counter
DesignationDoTrigger signal inputEvery,The contents of the counterLa
SwitchSelect the capture register to
A register can continuously latch the contents of the counter.
And banWith the CPU
An interrupt request signal to read out the contents latched by the
EmpowerA capture register selection circuit. Ma
The capture register according to the present inventionSelection circuit
Latches each of the trigger signalsDoMultiple latch means
And the order of each trigger signalYou
ToTrigger judgment means and,Determine latch conditionDoMore than one
And a switch condition determining means. Further according to the invention
Each of the latch means in the D-latch circuit and the RS latch
Switch and a trigger circuit.
The determination means is constituted by an AND circuit, and
The switch condition determination means uses an inverter and another AND circuit.
It is configured.

【0012】[0012]

【実施例】次に本発明について図面を参照して説明す
る。図1は、本発明によるマイクロコンピュータの一実
施例におけるキャプチャ回路を示すブロックである。図
1において、10はキャプチャレジスタ選択回路,10
4は読み出し制御回路,150はカウンタ,110,1
20はそれぞれキャプチャレジスタ,131,133,
134,137,161,162,163,164はそ
れぞれラッチ回路、112,122,136,166は
それぞれAND回路,130,135,138,15
1,160はインバータ、105,165はそれぞれO
Rゲートである。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a capture circuit in a microcomputer according to an embodiment of the present invention. In FIG. 1, reference numeral 10 denotes a capture register selection circuit;
4 is a read control circuit, 150 is a counter, 110, 1
20 is a capture register, 131, 133,
134, 137, 161, 162, 163, and 164 are latch circuits, 112, 122, 136, and 166 are AND circuits, 130, 135, 138, and 15, respectively.
1 and 160 are inverters and 105 and 165 are O
R gate.

【0013】カウンタ150およびキャプチャレジスタ
110(CT0)は従来例と同様の動作をする。キャプ
チャレジスタ(CT1)も従来例で説明したキャプチャ
レジスタ110(CT0)と同様の動作をするので説明
を省略する。また,従来例と同符号のものは従来例と同
様の動作をするので説明は省略する。他の周辺機能から
入力されるトリガ入力信号は、Dラッチ回路131を介
しRSラッチ回路133のセット入力端子に入力され、
RSラッチ回路133の出力は、他の入力端子がトリガ
入力信号端子であるAND回路136およびDラッチ回
路134を介しRSラッチ回路137のセット入力端子
に入力されている。
The counter 150 and the capture register 110 (CT0) operate in the same manner as in the conventional example. The capture register (CT1) operates in the same manner as the capture register 110 (CT0) described in the conventional example, and a description thereof will be omitted. Also, the components having the same reference numerals as those in the conventional example perform the same operations as those in the conventional example, and the description thereof is omitted. A trigger input signal input from another peripheral function is input to the set input terminal of the RS latch circuit 133 via the D latch circuit 131,
The output of the RS latch circuit 133 is input to the set input terminal of the RS latch circuit 137 via the AND circuit 136 and the D latch circuit 134 whose other input terminals are trigger input signal terminals.

【0014】トリガ入力信号は、他の入力端子替えイン
バータ135およびインバータ130での出力に接続さ
れているAND回路112を介し、キャプチャレジスタ
110(CT0)のトリガ入力となっている。AND回
路112の出力は、CPUへの割込み要求信号となって
いる。インバータ135およびインバータ130はそれ
ぞれラッチ回路133の出力およびシステムクロックが
入力されている。トリガ入力信号は、他入力端子がイン
バータ138,Dラッチ回路133およびインバータ1
30に接続されているAND回路122を介しキャプチ
ャレジスタ120のトリガ入力となっている。AND回
路122の出力は、CPUへの割込み要求信号となって
いる。インバータ138には、Dラッチ回路137が入
力されている。
The trigger input signal is a trigger input to the capture register 110 (CT0) via the AND circuit 112 connected to the other input terminal changing inverter 135 and the output of the inverter 130. The output of the AND circuit 112 is an interrupt request signal to the CPU. The output of the latch circuit 133 and the system clock are input to the inverters 135 and 130, respectively. The other input terminals of the trigger input signal are the inverter 138, the D latch circuit 133, and the inverter 1
A trigger input of the capture register 120 is provided through an AND circuit 122 connected to the input terminal 30. The output of the AND circuit 122 is an interrupt request signal to the CPU. The D latch circuit 137 is input to the inverter 138.

【0015】CPUからリードアクセスが発生したと
き、読み出し制御回路104で生成するRDCT0,R
DCT1信号は、それぞれキャプチャレジスタ110,
120の読み出し信号として入力されている。また、R
DCT0,RDCT1信号は、それぞれRSラッチ回路
161,163のセット入力端子に加えられている。R
Sラッチ回路161,163のクロック入力端子には、
システムクロックを入力とするインバータ160が接続
されているRSラッチ回路161,163の出力端子
は、それぞれDラッチ回路162,164のデータ入力
端子に接続されている。Dラッチ回路162,164の
クロック入力端子には、システムクロックが接続されて
いる。Dラッチ回路162,164の出力端子はAND
回路166に接続され、AND回路166の出力端子は
他の入力端子システムリセットに接続されたOR回路1
65に接続されている。OR回路165の出力端子は、
RSラッチ回路133,137,161,163それぞ
れのリセット入力端子に接続されている。
When a read access occurs from the CPU, RDCT0, RDT0 generated by the read control circuit 104
The DCT1 signal is supplied to the capture register 110,
120 as a read signal. Also, R
The DCT0 and RDCT1 signals are applied to set input terminals of RS latch circuits 161 and 163, respectively. R
The clock input terminals of the S latch circuits 161, 163
The output terminals of the RS latch circuits 161 and 163 to which the inverter 160 receiving the system clock is connected are connected to the data input terminals of the D latch circuits 162 and 164, respectively. A system clock is connected to clock input terminals of the D latch circuits 162 and 164. The output terminals of the D latch circuits 162 and 164 are AND
The OR circuit 1 connected to the circuit 166 and the output terminal of the AND circuit 166 is connected to another input terminal system reset.
65. The output terminal of the OR circuit 165 is
The RS latch circuits 133, 137, 161 and 163 are connected to respective reset input terminals.

【0016】次に、トリガ入力信号が連続して入力され
た場合の動作を図1の構成図および図2のタイミングチ
ャートを参照して下に説明する。ステージAにおいて,
システムリセットは“1”である。システムリセットは
OR回路165を介し、RSラッチ回路133,13
7,161,163のリセット入力端子に入力され、R
Sラッチ回路133,137,161,163の出力は
“0”となる。次にステージBにおいて、システムリセ
ットが“1”から“0”になり、カウンタ150は“0
0H”からカウントアップを開始する。
Next, the operation when the trigger input signal is continuously input will be described below with reference to the configuration diagram of FIG. 1 and the timing chart of FIG. In stage A,
The system reset is "1". The system reset is performed via the OR circuit 165 and the RS latch circuits 133, 13
7, 161 and 163 are input to the reset input terminals.
The outputs of the S latch circuits 133, 137, 161 and 163 become "0". Next, in stage B, the system reset changes from “1” to “0”, and the counter 150 sets “0”.
0H ”starts counting up.

【0017】ステージCにおいて、トリガ入力信号が入
力されたとする。トリガ入力“1”はAND回路112
に入力される。このときAND回路112の他の入力端
子であるインバータ135の出力は“1”である。従っ
て、システムクロックが“0”となったとき、いま一方
の入力として加えられるインバータ130の出力も
“1”となり、AND回路112の出力は“1”とな
る。AND回路112の出力“1”はキャプチャレジス
タ110の各ビットのラッチクロックに入力され、カウ
ンタバス108の“01H”をラッチする。
It is assumed that a trigger input signal is input at stage C. The trigger input “1” is input to the AND circuit 112
Is input to At this time, the output of the inverter 135, which is another input terminal of the AND circuit 112, is "1". Therefore, when the system clock becomes "0", the output of the inverter 130 applied as the other input also becomes "1", and the output of the AND circuit 112 becomes "1". The output “1” of the AND circuit 112 is input to the latch clock of each bit of the capture register 110, and latches “01H” of the counter bus.

【0018】システムクロックが“0”となったとき、
トリガ入力信号はDラッチ回路131にラッチされ、ス
テージCの2度目のシステムクロックが“1”のときト
リガ入力信号はRSラッチ回路133のセット側に入力
され、RSラッチ回路133の出力は“1”となる。R
Sラッチ回路133の出力“1”はAND回路136に
入力されるが、トリガ入力信号は“0”となっているた
め、AND回路136,Dラッチ回路134,およびR
Sラッチ回路137は“0”のままである。
When the system clock becomes "0",
The trigger input signal is latched by the D latch circuit 131. When the second system clock of the stage C is “1”, the trigger input signal is input to the set side of the RS latch circuit 133, and the output of the RS latch circuit 133 is “1”. ". R
The output “1” of the S latch circuit 133 is input to the AND circuit 136, but the trigger input signal is “0”, so that the AND circuit 136, the D latch circuit 134, and the R
The S latch circuit 137 remains “0”.

【0019】一方、ステージCにおいてトリガ入力信号
が入力されたとき、トリガ入力“1”はAND回路12
2に入力される。AND回路122の他の入力端子に接
続されているRSラッチ回路133の出力は“0”であ
るため、AND回路122の出力は“0”となる。AN
D回路122の出力はキャプチャレジスタ120のラッ
チクロックとなるため、キャプチャレジスタ120はカ
ウンタバス108上のの値をラッチできない。
On the other hand, when a trigger input signal is input at stage C, the trigger input "1"
2 is input. Since the output of the RS latch circuit 133 connected to the other input terminal of the AND circuit 122 is “0”, the output of the AND circuit 122 is “0”. AN
Since the output of the D circuit 122 serves as a latch clock for the capture register 120, the capture register 120 cannot latch the value on the counter bus 108.

【0020】次に、ステージGにおいて、トリガ入力信
号が入力されたとする。トリガ入力“1”はAND回路
112に入力される。AND回路112の他の入力端子
に接続されているインバータ135の出力は“0”であ
るため、AND回路112の出力は“0”となり、キャ
プチャレジスタ110はカウンタバス108上の値をラ
ッチできない。
Next, it is assumed that a trigger input signal is input at stage G. The trigger input “1” is input to the AND circuit 112. Since the output of the inverter 135 connected to the other input terminal of the AND circuit 112 is "0", the output of the AND circuit 112 is "0", and the capture register 110 cannot latch the value on the counter bus 108.

【0021】一方、トリガ入力“1”はAND回路12
2に入力される。AND回路122の他の入力端子に接
続されているRSラッチ回路133の出力は“1”であ
って、いま一つのAND回路122の他の入力端子に接
続されているインバータ138の出力は“1”であるた
め、システムクロックが“0”となったとき、いま一つ
の他の入力端子に接続されているインバータ130の出
力も“1”となり、AND回路122の出力は“1”と
なる。AND回路122の出力“1”はキャプチャレジ
スタ120の各ビットのラッチクロックに入力され、カ
ウンタバス108上の“05H”をラッチする。
On the other hand, the trigger input "1" is
2 is input. The output of the RS latch circuit 133 connected to another input terminal of the AND circuit 122 is “1”, and the output of the inverter 138 connected to another input terminal of another AND circuit 122 is “1”. Therefore, when the system clock becomes “0”, the output of the inverter 130 connected to another input terminal also becomes “1”, and the output of the AND circuit 122 becomes “1”. The output “1” of the AND circuit 122 is input to the latch clock of each bit of the capture register 120, and latches “05H” on the counter bus.

【0022】CPUでは割込み要求信号を受け付けると
実行中の処理を中断し、ステージKにおいてキャプチャ
レジスタ110の内容“01H”を読みだし、引き続き
ステージOにおいてキャプチャレジスタ120の内容
“05H”を読みだす。つづいて、CPUではキャプチ
ャレジスタ110の内容“01H”と今回のキャプチャ
レジスタ110の内容“05H”との差“04H”を演
算により得る。
When the CPU accepts the interrupt request signal, the CPU interrupts the processing being executed, reads the content "01H" of the capture register 110 at stage K, and subsequently reads the content "05H" of the capture register 120 at stage O. Subsequently, the CPU obtains the difference “04H” between the content “01H” of the capture register 110 and the content “05H” of the current capture register 110 by calculation.

【0023】カウンタ150のカウントクロックは一定
時間間隔で入力されているため、キャプチャレジスタの
内容の差“04H”とカウントクロックの入力時間間隔
との積を演算することにより、外部機器から発生するパ
ルスの時間間隔は容易に求めることができる。CPU
は、上記により求められたパルスの時間間隔を判定し、
外部機器に対する制御、例えばモータをより速く回す等
の制御を行う。ステージKでは読み出し制御回路からR
DCT0が出力され、RSラッチ回路161のリセット
と入力端子に入力される。そこで、システムクロックの
立ち下がりでRSラッチ回路161は“0”にリセット
される。RSラッチ回路161の出力は、次のシステム
クロックの立ち上がりでDラッチ回路162にラッチさ
れ、AND回路166に“1”が入力される。
Since the count clock of the counter 150 is input at fixed time intervals, the pulse generated from the external device is calculated by calculating the product of the difference “04H” of the content of the capture register and the input time interval of the count clock. Can be easily obtained. CPU
Determines the time interval of the pulse determined above,
Control of the external device, for example, control of rotating the motor faster is performed. In stage K, the read control circuit
DCT0 is output and input to the reset and input terminals of the RS latch circuit 161. Therefore, the RS latch circuit 161 is reset to “0” at the fall of the system clock. The output of the RS latch circuit 161 is latched by the D latch circuit 162 at the next rise of the system clock, and “1” is input to the AND circuit 166.

【0024】同様に、ステージOでは、読み出し制御回
路からRDCT1が出力され、RSラッチ回路163お
よびDラッチ回路164を介してAND回路166に
“1”が入力される。このとき、AND回路166の他
の入力端子162の値は既に“1”となっているため、
AND回路166から“1”が出力され、OR回路16
5を介して、RSラッチ回路133,137,161,
163のリセット入力端子に入力される。そこで、RS
ラッチ回路133,137,161,163の出力は
“0”となり、次のトリガが入力された場合、上記と同
様にキャプチャレジスタ110からのラッチが可能とな
る。
Similarly, at stage O, RDCT 1 is output from the read control circuit, and “1” is input to AND circuit 166 via RS latch circuit 163 and D latch circuit 164. At this time, since the value of the other input terminal 162 of the AND circuit 166 is already “1”,
“1” is output from the AND circuit 166 and the OR circuit 16
5, the RS latch circuits 133, 137, 161,
163 is input to a reset input terminal. So RS
The outputs of the latch circuits 133, 137, 161 and 163 become "0", and when the next trigger is input, latching from the capture register 110 becomes possible as described above.

【0025】以上のように、本キャプチャ回路にトリガ
信号が入力された場合、ラッチさせるキャプチャレジス
タはトリガ信号の入力毎とに1つに限定される。しか
し、他のキャプチャレジスタを変化させないため、パル
スの時間間隔はカウントクロックの入力時間間隔まで計
測できる。従って、外部機器を高速に制御することがで
きる。
As described above, when a trigger signal is input to the present capture circuit, the number of capture registers to be latched is limited to one for each input of the trigger signal. However, since the other capture registers are not changed, the pulse time interval can be measured up to the count clock input time interval. Therefore, external devices can be controlled at high speed.

【0026】図3は、本発明によるマイクロコンピュー
タの第2の実施例を示すブロック図である。また、図4
は図3に関連した動作のタイミングチャートである。図
3において、図1に示す符号と同じ符号は同様の要素を
示す。また、510,520はそれぞれキャプチャレジ
スタ、531,533,534,537,561〜56
4はそれぞれラッチ回路、512,522,536,5
39,566はそれぞれAND回路、535,538は
それぞれインバータ、565はORゲートである。
FIG. 3 is a block diagram showing a second embodiment of the microcomputer according to the present invention. FIG.
4 is a timing chart of the operation related to FIG. 3, the same reference numerals as those shown in FIG. 1 indicate the same elements. Reference numerals 510 and 520 denote capture registers, respectively 531, 533, 534, 537, 561 to 56.
4 is a latch circuit, 512, 522, 536, 5
39 and 566 are AND circuits, 535 and 538 are inverters, and 565 is an OR gate.

【0027】次に、本発明の第2の実施例を図3のブロ
ック構成図および図4のタイミングチャートを用いて説
明する。図3では、図1と同一の符号,名称の回路は図
1のものと同一の動作を行う。図3において、RSラッ
チ回路137の出力は、Dラッチ回路531およびRS
ラッチ回路533のセット入力端子に入力される。RS
ラッチ回路533の出力は、他の入力端子がトリガ入力
信号端子であるAND回路536およびDラッチ回路5
34を介してRSラッチ回路537のセット入力端子に
入力されている。
Next, a second embodiment of the present invention will be described with reference to the block diagram of FIG. 3 and the timing chart of FIG. In FIG. 3, circuits having the same reference numerals and names as those in FIG. 1 perform the same operations as those in FIG. In FIG. 3, the output of the RS latch circuit 137 is connected to the D latch circuit 531 and the RS latch circuit 137.
The signal is input to the set input terminal of the latch circuit 533. RS
The output of the latch circuit 533 is provided by the AND circuit 536 and the D latch circuit 5 whose other input terminals are trigger input signal terminals.
The signal is input to the set input terminal of the RS latch circuit 537 via the line 34.

【0028】トリガ入力信号は、他の入力端子がインバ
ータ535,インバータ130およびRSラッチ回路1
33,137に接続されているAND回路512を介
し、第3のキャプチャレジスタ510(CT2)のトリ
ガ入力端子に加えられている。AND回路512の出力
はCPUへの割込み要求信号となっている。インバータ
535には、Dラッチ回路533の出力が入力されてい
る。
The other input terminals of the trigger input signal are the inverter 535, the inverter 130 and the RS latch circuit 1.
The signal is applied to a trigger input terminal of a third capture register 510 (CT2) via an AND circuit 512 connected to 33, 137. The output of the AND circuit 512 is an interrupt request signal to the CPU. The output of the D latch circuit 533 is input to the inverter 535.

【0029】トリガ入力信号は他の入力端子がインバー
タ538,Dラッチ回路533,インバータ130およ
びRSラッチ回路133,137に接続されているAN
D回路522を介し、第4のキャプチャレジスタ520
(CT3)のトリガ入力端子に加えられている。AND
回路522の出力は、CPUへの割込み要求信号となっ
ている。インバータ538には、Dラッチ回路537の
出力が入力されている。
The other input terminal of the trigger input signal is connected to the inverter 538, the D latch circuit 533, the inverter 130, and the RS latch circuits 133 and 137.
Via the D circuit 522, the fourth capture register 520
(CT3) is applied to the trigger input terminal. AND
The output of the circuit 522 is an interrupt request signal to the CPU. The output of the D latch circuit 537 is input to the inverter 538.

【0030】CPUから読み出し、アクセスが発生した
とき、読み出し制御回路で生成されたRDCT2,RD
CT3信号は,それぞれ第3のキャプチャレジスタ51
0の読み出し信号として入力されている。また、RDC
T2,RDCT3信号は,それぞれRSラッチ回路56
1,563のリセット入力端子に入力されている。RS
ラッチ回路561,563のクロック入力端子には、シ
ステムクロックを入力とするインバータ160の出力が
接続されている。RSラッチ回路561,563の出力
端子はそれぞれDラッチ回路562,564のデータ入
力端子に入力されている。
When a read is performed from the CPU and an access occurs, RDCT2 and RD generated by the read control circuit are generated.
The CT3 signal is supplied to the third capture register 51, respectively.
0 is input as a read signal. Also, RDC
The T2 and RDCT3 signals are supplied to the RS latch circuit 56, respectively.
1,563 reset input terminals. RS
The clock input terminals of the latch circuits 561 and 563 are connected to the output of the inverter 160 that receives the system clock. Output terminals of the RS latch circuits 561 and 563 are input to data input terminals of the D latch circuits 562 and 564, respectively.

【0031】Dラッチ回路562,564のクロック入
力端子にはシステムクロックが入力されている。Dラッ
チ回路562,564の出力端子は他の入力端子がDラ
ッチ回路162,164に接続されているAND回路5
66に接続されている。AND回路566の出力端子
は、他の入力端子がシステムリセットに接続されてい
る。OR回路565に入力されている。OR回路565
の出力端子は、RSラッチ回路133,137,16
1,163,561,563のそれぞれのリセット入力
端子に接続されている。
A system clock is input to clock input terminals of the D latch circuits 562 and 564. The output terminals of the D latch circuits 562 and 564 are connected to the AND circuit 5 whose other input terminals are connected to the D latch circuits 162 and 164.
66. The other input terminal of the output terminal of the AND circuit 566 is connected to the system reset. The signal is input to the OR circuit 565. OR circuit 565
Output terminals are RS latch circuits 133, 137, and 16
1, 163, 561 and 563 are connected to respective reset input terminals.

【0032】図4において、ステージC,F,G,Nで
トリガ入力信号が入力されたとすると、第1〜第4のキ
ャプチャレジスタ110,120,510,520には
それぞれ“01H”,“04H”,“05H”,“0C
H”がラッチされている。このときCPUが割込み要求
を受け付けると、割込み要求を発生した第1〜第4のキ
ャプチャレジスタ110,120,510,520のど
れかから内容を読み出し、キャプチャレジスタの内容の
差とカウントクロックの入力時間間隔との積を演算する
ことにより、外部機器から発生するパルスの時間間隔を
求め、外部機器に対する制御を行う。
In FIG. 4, assuming that a trigger input signal is input at stages C, F, G, and N, the first to fourth capture registers 110, 120, 510, and 520 have "01H" and "04H", respectively. , "05H", "0C
H "is latched. At this time, when the CPU accepts the interrupt request, the content is read out from one of the first to fourth capture registers 110, 120, 510, and 520 which generated the interrupt request, and the content of the capture register is read out. By calculating the product of the difference between the above and the input time interval of the count clock, the time interval of the pulse generated from the external device is obtained, and the external device is controlled.

【0033】以上のように本キャプチャ回路へトリガ信
号が入力された場合、ラッチさせるキャプチャレジスタ
はトリガ信号入力毎に1つに限定され、他のキャプチャ
レジスタの内容を変化させない。このため、パルスの時
間間隔はカウントクロックの入力時間間隔まで計測でき
るため、外部機器を高速に制御することができる。以上
の説明において、キャプチャレジスタ選択回路としてR
Sラッチ回路とDラッチ回路を組合せたが、シフトレジ
スタ等を用いても同様の効果が得られ、本発明の目的を
達成することができる。
As described above, when a trigger signal is input to the present capture circuit, the number of capture registers to be latched is limited to one for each trigger signal input, and the contents of other capture registers are not changed. Therefore, the time interval of the pulse can be measured up to the input time interval of the count clock, so that the external device can be controlled at high speed. In the above description, R is used as the capture register selection circuit.
Although the S-latch circuit and the D-latch circuit are combined, a similar effect can be obtained by using a shift register or the like, and the object of the present invention can be achieved.

【0034】[0034]

【発明の効果】以上説明したように本発明は、従来のキ
ャプチャ回路を備えたマイクロコンピュータに対し、ト
リガ信号入力時にカウンタの内容をラッチするためのキ
ャプチャレジスタを選択し、更に同一キャプチャレジス
タが連続して上記カウンタの内容をラッチすることが内
容に禁止するため、キャプチャレジスタ選択回路を付加
している。これによって、ハードウェアを有効に使用す
ることができるので、計測できるパルスの時間間隔に制
限はなくなる利点があり、しかも外部機器の制御を高速
化することができるため、応用分野の広いマイクロコン
ピュータを提供できる効果がある。
As described above, the present invention selects a capture register for latching the contents of a counter when a trigger signal is input to a microcomputer having a conventional capture circuit, and furthermore, the same capture register is continuously used. In order to prohibit latching the contents of the counter, the capture register selection circuit is added. As a result, the hardware can be used effectively, and there is an advantage that the time interval of the pulse that can be measured is not limited. In addition, since the control of the external device can be accelerated, a microcomputer having a wide application field can be used. There are effects that can be provided.

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

【図1】本発明によるキャプチャユニットの一実施例を
示すブロック図である。
FIG. 1 is a block diagram showing an embodiment of a capture unit according to the present invention.

【図2】図1に示すキャプチャユニットの動作を示すタ
イミング図である。
FIG. 2 is a timing chart showing an operation of the capture unit shown in FIG.

【図3】本発明によるキャプチャユニットの第2の実施
例を示すブロック図である。
FIG. 3 is a block diagram showing a second embodiment of the capture unit according to the present invention.

【図4】図3に示すキャプチャユニットの動作を示すタ
イミング図である。
FIG. 4 is a timing chart showing an operation of the capture unit shown in FIG. 3;

【図5】一般的なマイクロコンピュータの系統を示すブ
ロック図である。
FIG. 5 is a block diagram showing a system of a general microcomputer.

【図6】キャプチャ回路の1ビットを示すブロック図で
ある。
FIG. 6 is a block diagram showing one bit of a capture circuit.

【図7】従来のキャプチャユニットの一例を示すブロッ
ク図である。
FIG. 7 is a block diagram illustrating an example of a conventional capture unit.

【図8】図7に示すキャプチャユニットの動作を示すタ
イミング図である。
FIG. 8 is a timing chart showing an operation of the capture unit shown in FIG. 7;

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

1 マイクロコンピュータ 2 メモリ 3 CPU 4 周辺機器 10 キャプチャレジスタ選択回路 100 データバス 101 アドレスバス 104 読み出し制御回路 105,165,565 ORゲート 110,120,510,520 キャプチャレジスタ 112,122,136,166,512,522,5
36,539,566AND回路 130,135,138,151,160,535,5
38 インバータ 131,133,134,137,161〜164,5
31,533,534,537,561〜564 ラッ
チ回路 150 カウンタ
DESCRIPTION OF SYMBOLS 1 Microcomputer 2 Memory 3 CPU 4 Peripheral device 10 Capture register selection circuit 100 Data bus 101 Address bus 104 Read control circuit 105,165,565 OR gate 110,120,510,520 Capture register 112,122,136,166,512 , 522, 5
36,539,566 AND circuit 130,135,138,151,160,535,5
38 Inverters 131, 133, 134, 137, 161-164, 5
31, 533, 534, 537, 561 to 564 Latch circuit 150 Counter

フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G04F 10/04 G06F 1/14 Continuation of front page (58) Fields surveyed (Int.Cl. 7 , DB name) G04F 10/04 G06F 1/14

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 プログラムまたはデータを記憶するメモ
リと、前記プログラムに従って演算処理を実行するCP
Uとを備えたマイクロコンピュータにおいて、 供給されるクロックにもとづいて内容を更新する単数ま
たは複数個のカウンタと、 前記カウンタの内容をラッチする複数個のキャプチャレ
ジスタと、 前記キャプチャレジスタが前記カウンタの内容をラッチ
するタイミングを指定するトリガ信号入力毎に、前記カ
ウンタの内容をラッチするキャプチャレジスタを選択
し、同一キャプチャレジスタが連続して前記カウンタの
内容をラッチすることを禁止するとともに、前記CPU
にキャプチャレジスタにラッチされた内容を読みだす割
り込み要求信号を出力するキャプチャレジスタ選択回路
とを、 備えたマイクロコンピュータ。
1. A memory for storing a program or data, and a CP for executing arithmetic processing according to the program.
U, a single or a plurality of counters for updating the content based on a supplied clock, a plurality of capture registers for latching the content of the counter, and the capture register for storing the content of the counter. each trigger signal input specifying timing to latch to highlight capture register for latching the contents of the counter, along with prohibiting latching the contents of the counter the same capture register in succession, the CPU
Read the contents latched in the capture register
And a capture register selection circuit that outputs a capture request signal .
【請求項2】 前記キャプチャレジスタ選択回路は、前
記各トリガ信号をラッチする複数のラッチ手段と、前記
各トリガ信号が何番目のものであるかを判別するトリガ
判定手段とラッチ条件を判定する複数のラッチ条件判
定手段とから成る請求項1のマイクロコンピュータ。
Wherein said capture register selection circuit determines a plurality of latch means for latching the respective trigger signal, a trigger determination unit that the respective trigger signals to determine whether there are many th ones, a latch condition 2. The microcomputer according to claim 1, comprising a plurality of latch condition determination means.
【請求項3】 前記各ラッチ手段はDラッチ回路および
RSラッチ回路の組み合わせにより構成し、且つ、前記
トリガ判定手段はAND回路により構成し、且つ、前記
各ラッチ条件判定手段はインバータおよび他のAND回
路により構成した請求項2のマイクロコンピュータ。
3. Each of the latch means is constituted by a combination of a D latch circuit and an RS latch circuit, the trigger judgment means is constituted by an AND circuit, and each of the latch condition judgment means is constituted by an inverter and another AND. 3. The microcomputer according to claim 2, comprising a circuit.
JP4086335A 1992-03-10 1992-03-10 Microcomputer Expired - Lifetime JP3068317B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4086335A JP3068317B2 (en) 1992-03-10 1992-03-10 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4086335A JP3068317B2 (en) 1992-03-10 1992-03-10 Microcomputer

Publications (2)

Publication Number Publication Date
JPH05249261A JPH05249261A (en) 1993-09-28
JP3068317B2 true JP3068317B2 (en) 2000-07-24

Family

ID=13883977

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4086335A Expired - Lifetime JP3068317B2 (en) 1992-03-10 1992-03-10 Microcomputer

Country Status (1)

Country Link
JP (1) JP3068317B2 (en)

Also Published As

Publication number Publication date
JPH05249261A (en) 1993-09-28

Similar Documents

Publication Publication Date Title
JPH0743653B2 (en) Interrupt controller
JPH0635993B2 (en) Data acquisition device
JPH04121085A (en) Digital pulse processor
US5233573A (en) Digital data processor including apparatus for collecting time-related information
US5325341A (en) Digital timer apparatus and method
JP3068317B2 (en) Microcomputer
JP2600598B2 (en) Pulse width judgment circuit
JPH06348507A (en) Microcomputer
JPH0748647B2 (en) Duty ratio discrimination circuit
JP2812610B2 (en) Pipeline control method
JPH06188872A (en) Sync protection circuit
JP2604562B2 (en) Pulse interval measuring device
JP3308670B2 (en) Event-driven processing equipment failure detection device
JPS62156738A (en) program control device
JP2990111B2 (en) Timer circuit
JP3466116B2 (en) Programmable controller
JP3186137B2 (en) Information processing method
JPH04192037A (en) Semiconductor integrated circuit
JPS6017131B2 (en) memory control circuit
JPS6411977B2 (en)
JPS63120336A (en) Switching system for memory access mode
JPS58222348A (en) Information processor
JPH0695304B2 (en) Data processing device
JPH01316826A (en) Register file address circuit
JPH10312279A (en) Bit search circuit and microprocessor having the same