JPS63169826A - Counter circuit - Google Patents

Counter circuit

Info

Publication number
JPS63169826A
JPS63169826A JP230587A JP230587A JPS63169826A JP S63169826 A JPS63169826 A JP S63169826A JP 230587 A JP230587 A JP 230587A JP 230587 A JP230587 A JP 230587A JP S63169826 A JPS63169826 A JP S63169826A
Authority
JP
Japan
Prior art keywords
circuit
counter
signal
input signal
edge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP230587A
Other languages
Japanese (ja)
Inventor
Masaki Sugimoto
正樹 杉本
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP230587A priority Critical patent/JPS63169826A/en
Publication of JPS63169826A publication Critical patent/JPS63169826A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To relieve the software load of a CPU by using a reset signal produced by retarding a timing signal generated by the edge detection of a 1st input signal so as to reset a counter, thereby eliminating the need for the subtraction processing of the CPU in measuring the pulse width or the pulse period of the 1st input signal. CONSTITUTION:A binary up-counter 2 repeats up-count successively by using an input signal phi. An edge detection circuit 1 detects the edge of an input signal (x) and its timing signal L latches a saving latch circuit 3 by counting of the counter 2. Simultaneously, an interruption generating circuit 5 is started. Moreover, a detection circuit 1 sends a signal L to a delay circuit 7 after edge detection and the delay circuit 7 uses a reset signal R to initialize the counter 2. A CPU 6 uses the circuit 5 to recognize the edge detection and the execution of latch, reads the value of the circuit 3 through a data bus 4 to recognize the pulse period or pulse width of the signal (x).

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、入力信号のパルスの幅又はパルスの周期を正
確に測定するカウンタ回路に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a counter circuit that accurately measures the pulse width or pulse period of an input signal.

〔従来の技術〕[Conventional technology]

従来のカウンタ回路を第3図に示す。第3図において、
1は第1の入力信号Xのパルスの立上り若しくは立下り
又は立上りおよび立下りを検出するエツジ検出回路、2
は第2の入力信号φによってカウントアツプされるバイ
ナリアップカウンタ、3はエツジ検出回路1によって検
出された入力信号Xのパルスエツジでバイナリアップカ
ウンタ2の値を待避保持する待避用ラッチ回路、4は待
避用ラッチ回路3にラッチされたデータをCPU6に送
るデータバス、5はランチされたことをCPU6に通知
する割込み発生回路である。
A conventional counter circuit is shown in FIG. In Figure 3,
1 is an edge detection circuit that detects the rise or fall of the pulse of the first input signal X, or the rise and fall of the pulse; 2
is a binary up counter that is incremented by the second input signal φ, 3 is a latch circuit for saving and holding the value of the binary up counter 2 at the pulse edge of the input signal X detected by the edge detection circuit 1, and 4 is a saving latch circuit. A data bus 5 sends the data latched in the latch circuit 3 to the CPU 6, and an interrupt generating circuit 5 notifies the CPU 6 that the data has been launched.

次に動作について説明する。バイナリアップカウンタ2
は入力信号φ(第4図(a)参照)で絶えずアップカウ
ントしている。エツジ検出回路1は、入力信号Xのパル
スの立上り若しくは立下り又は立上りおよび立下りにお
いて入力信号Xのエツジを検出し、このタイミングでパ
イナリアップカウンタ2の値を待避用ランチ回路3にラ
ッチする。
Next, the operation will be explained. binary up counter 2
is constantly incremented by the input signal φ (see FIG. 4(a)). The edge detection circuit 1 detects the edge of the input signal X at the rise or fall of the pulse of the input signal X, or the rise and fall of the pulse of the input signal X, and latches the value of the pinary up counter 2 in the evacuation launch circuit 3 at this timing.

同時に、ラッチされたことをCPU6に通知するため、
割込み発生回路5を起動する。
At the same time, in order to notify the CPU 6 that it has been latched,
Activate the interrupt generation circuit 5.

CPU6は、データバス4を通じて待避用ラッチ回路3
の値を読み取り、入力信号Xのエツジの発生した時刻を
バイナリアップカウンタ2の値として知ることができる
。従って、入力信号Xのパルスの立上りから立上りまで
の時間を測定する場合はt3−tl (第4図(b)、
第4図(+31参照)、立下りから立下りまでの時間を
測定する場合はt4−t2(第4図(C)、第4図(e
)参照)をCPU6で計算して求める。また、入力信号
Xのパルスの「1」の幅であればt2−tl  (第4
図cd)、第4図(e)参照)、「0」の幅であればt
3−t2 (第4図(d)、第4図(e)参照)を同様
にCPU6で計算して求めることができる。ただし、t
l、t2.t3、t4はパルスエツジ検出してラッチし
た待避用ラッチ回路3のシーケンシャルな値である。
The CPU 6 connects to the backup latch circuit 3 via the data bus 4.
By reading the value of , the time at which the edge of the input signal X occurs can be known as the value of the binary up counter 2. Therefore, when measuring the time from the rise to the rise of the pulse of the input signal X, t3-tl (Figure 4(b),
Figure 4 (see +31), when measuring the time from fall to fall, t4-t2 (Figure 4 (C), Figure 4 (e)
) is calculated and obtained by the CPU 6. Furthermore, if the width of the pulse of input signal X is "1", t2-tl (fourth
(see Figure cd), Figure 4 (e)), if the width is "0", t
3-t2 (see FIGS. 4(d) and 4(e)) can be similarly calculated by the CPU 6. However, t
l, t2. t3 and t4 are sequential values of the evacuation latch circuit 3 which detects and latches the pulse edge.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

従来のパルス幅又はパルス周期を測定するカウンタ回路
は以上のように構成されているので、パルス幅、パルス
周期いずれの測定においても、CPU6で減算処理をす
る必要があり、ソフトウェア負荷上問題があった。
Since the conventional counter circuit for measuring pulse width or pulse period is configured as described above, it is necessary to perform subtraction processing in the CPU 6 when measuring either pulse width or pulse period, which causes problems in terms of software load. Ta.

本発明はこのような点に鑑みてなされたものであり、そ
の目的とするところは、CPU6で減算処理を施すこと
なく、入力信号Xのパルス周期又はパルス幅を測定する
ことができるカウンタ回路を得ることにある。
The present invention has been made in view of these points, and its purpose is to provide a counter circuit that can measure the pulse period or pulse width of the input signal X without performing subtraction processing in the CPU 6. It's about getting.

〔問題点を解決するための手段〕[Means for solving problems]

このような目的を達成するために本発明は、第1の入力
信号の立上り若しくは立下り、又は立上りおよび立下り
を検出してタイミング信号を出力するエツジ検出回路と
、第2の入力信号のパルス数を計測するカウンタと、第
1の入力信号のエツジ検出時にカウンタに保持するカウ
ント値を待避する待避ラッチ回路と、タイミング信号を
入力して生じたリセット信号によりカウンタをリセット
する遅延回路と、エツジ検出回路によって起動され割込
み信号を発生する割込み発生回路と、割込み信号により
処理をするCPUと、待避用ラッチ回路の値を転送する
データバスとを設けるようにしたものである。
In order to achieve such an object, the present invention provides an edge detection circuit that detects the rising edge or falling edge, or the rising edge and the falling edge, of a first input signal and outputs a timing signal; a counter that counts the number of edges; a save latch circuit that saves the count value held in the counter when an edge of the first input signal is detected; a delay circuit that resets the counter with a reset signal generated by inputting a timing signal; This system includes an interrupt generation circuit that is activated by a detection circuit and generates an interrupt signal, a CPU that performs processing in response to the interrupt signal, and a data bus that transfers the value of the save latch circuit.

〔作用〕[Effect]

本発明に係わるカウンタ回路においては、パルス幅又は
パルス周期の測定において、CPUによる減算は不要と
なる。
In the counter circuit according to the present invention, there is no need for subtraction by the CPU in measuring the pulse width or pulse period.

〔実施例〕〔Example〕

本発明に係わるカウンタ回路の一実施例を第1図に示す
。第1図において、1は第1の入力信号Xの立上り若し
くは立下り又は立上りおよび立下りを検出するエツジ検
出回路、2は第2の入力信号φによってカウントアツプ
され一定周期で更新されるバイナリアップカウンタ、3
は入力信号Xのエツジが検出された際にエツジ検出回路
1から出力されるタイミング信号りによりバイナリアッ
プカウンタ2の値を待避保持する待避用ランチ回路、4
はCPU6に待避用ランチ回路3でラッチされた値を送
るためのデータバス、5はエツジ検出されたタイミング
をCPU6に通知する割込み発生回路、7は入力信号X
のエツジが検出された際にバイナリアップカウンタ2を
リセットするためのリセット信号Rを発生する遅延回路
である。
An embodiment of a counter circuit according to the present invention is shown in FIG. In FIG. 1, 1 is an edge detection circuit that detects the rise or fall of the first input signal X, or the rise and fall of the first input signal counter, 3
4 is a save launch circuit that saves and holds the value of the binary up counter 2 according to a timing signal output from the edge detection circuit 1 when an edge of the input signal X is detected;
is a data bus for sending the value latched by the evacuation launch circuit 3 to the CPU 6, 5 is an interrupt generation circuit that notifies the CPU 6 of the edge detection timing, and 7 is an input signal X.
This is a delay circuit that generates a reset signal R for resetting the binary up counter 2 when an edge of is detected.

次に動作について説明する。バイナリアップカウンタ2
は入力信号φで絶えずアップカウントしている。エツジ
検出回路1は、入力信号Xのパルスの立上り若しくは立
下り又は立上りおよび立下りにおいて入力信号Xのエツ
ジを検出し、エツジ検出のタイミング信号してバイナリ
アップカウンタ2のカウント値を待避用ラッチ回路3に
ラッチする。同時に、上記カウント値がラッチされたこ
とをCPU6に通知するため、割込み発生回路5を起動
する。
Next, the operation will be explained. binary up counter 2
is constantly incremented by the input signal φ. The edge detection circuit 1 is a latch circuit for detecting the edges of the input signal X at the rising edge or falling edge or the rising edge and the falling edge of the pulse of the input signal Latch to 3. At the same time, the interrupt generation circuit 5 is activated to notify the CPU 6 that the count value has been latched.

また、エツジ検出回路1は、エツジ検出後、エツジ検出
信号すなわちタイミング信号りを遅延回路7に送る。こ
の遅延回路7で、バイナリアップカウンタ2をリセット
するためのリセット信号Rを発生する。従って、エツジ
検出後、バイナリアップカウンタ2は「0」に初期化さ
れる。
Further, after detecting an edge, the edge detection circuit 1 sends an edge detection signal, that is, a timing signal, to the delay circuit 7. This delay circuit 7 generates a reset signal R for resetting the binary up counter 2. Therefore, after the edge is detected, the binary up counter 2 is initialized to "0".

CPU6は、割込み発生回路5により、エッジが検出さ
れランチが行なわれたことを知り、待避用ラッチ回路3
の値をデータバス4を通じて読み込むことにより、入力
信号Xのパルス周期又はパルス幅を知ることができる。
The CPU 6 learns from the interrupt generation circuit 5 that the edge has been detected and launch has been performed, and then activates the evacuation latch circuit 3.
By reading the value of through the data bus 4, the pulse period or pulse width of the input signal X can be known.

入力信号Xのパルスの立上りから立上りまでの周期を測
定する様子を第2図に示す。第2図においては、第2図
(a)に示す時刻t1の直後に第2図(′b)に示す入
力信号Xの立上りが発生し、このエツジをエツジ検出回
路1で検出し、第2図(C1に示すタイミング信号りを
発生する。このタイミング信号りによりバイナリアップ
カウンタ2のカウント値すなわち時刻tl(第2図(e
)参照)を待避用ラッチ回路3に保持すると共にCPU
6への割込み動作を行ない、CPU6はデータバス4を
介して上記カウント値を読み込む。また、遅延回路7は
上記タイミング信号りにより第2図(d)に示すリセッ
ト信号Rを発生し、これにより第2図(a)に示すよう
にバイナリアップカウンタ2をリセットする。
FIG. 2 shows how the period from the rise to the rise of the pulse of the input signal X is measured. In FIG. 2, a rising edge of the input signal X shown in FIG. 2('b) occurs immediately after time t1 shown in FIG. 2(a), this edge is detected by the edge detection circuit 1, and the second A timing signal shown in Fig. 2 (C1) is generated. This timing signal causes the count value of the binary up counter 2, that is, the time tl (Fig. 2 (e)
)) is held in the evacuation latch circuit 3, and the CPU
6, and the CPU 6 reads the count value via the data bus 4. Further, the delay circuit 7 generates a reset signal R shown in FIG. 2(d) based on the timing signal, thereby resetting the binary up counter 2 as shown in FIG. 2(a).

次に、時刻t2のタイミングで2回目のラッチを行なう
。この場合の動作は時刻t1における1回目のラッチ動
作と同様であるので、その説明は省略する。このように
して、入力信号Xの立上りから立上りまでのパルス周期
を時刻t1と無関係に時刻t2のみにより測定すること
ができる。
Next, a second latch is performed at time t2. The operation in this case is similar to the first latch operation at time t1, so the explanation thereof will be omitted. In this way, the pulse period from rise to rise of the input signal X can be measured only at time t2, regardless of time t1.

なお、上記実施例では、入力信号Xの立上りから立上り
までの場合の動作について説明したが、立下りから立下
りまで、立上りから立下りまで、立下りから立上りまで
を測定する場合も、同様の動作となる。
In the above embodiment, the operation was explained from the rising edge to the rising edge of the input signal It becomes an action.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、第1の入力信号のエツジ
検出により発生したタイミング信号を遅延することによ
り生じたリセット信号でカウンタをリセットすることに
より、第1の入力信号のパルス幅又はパルス周期を測定
する際のCPUの減算処理が不要となるので、CPUの
ソフトウェア負荷が軽減される効果がある。
As explained above, the present invention resets the pulse width or pulse period of the first input signal by resetting the counter with the reset signal generated by delaying the timing signal generated by edge detection of the first input signal. Since there is no need for CPU subtraction processing when measuring , there is an effect that the software load on the CPU is reduced.

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

第1図は本発明に係わるカウンタ回路の一実施例を示す
系統図、第2図はその動作を説明するためのタイムチャ
ート、第3図は従来のカウンタ回路を示す系統図、第4
図はその動作を説明するためのタイムチャートである。 l・・・エツジ検出回路、2・・・バイナリアップカウ
ンタ、3・・・待避用ランチ回路、4・・・データバス
、5・・・割込み発生回路、6・−CP U、7・・・
待避回路。
FIG. 1 is a system diagram showing one embodiment of a counter circuit according to the present invention, FIG. 2 is a time chart for explaining its operation, FIG. 3 is a system diagram showing a conventional counter circuit, and FIG.
The figure is a time chart for explaining the operation. l...Edge detection circuit, 2...Binary up counter, 3...Evacuation launch circuit, 4...Data bus, 5...Interrupt generation circuit, 6...-CPU, 7...
Evacuation circuit.

Claims (1)

【特許請求の範囲】[Claims] (1)第1の入力信号の立上り若しくは立下り、又は立
上りおよび立下りを検出してタイミング信号を出力する
エッジ検出回路と、第2の入力信号のパルス数を計測す
るカウンタと、第1の入力信号のエッジ検出時に前記カ
ウンタに保持するカウント値を待避する待避ラッチ回路
と、前記タイミング信号を入力して生じたリセット信号
により前記カウンタをリセットする遅延回路と、前記エ
ッジ検出回路によって起動され割込み信号を発生する割
込み発生回路と、前記割込み信号により処理をするCP
Uと、前記待避用ラッチ回路の値を転送するデータバス
とを備えたことを特徴とするカウンタ回路。
(1) An edge detection circuit that detects a rising edge or a falling edge, or a rising edge and a falling edge, of a first input signal and outputs a timing signal; a counter that measures the number of pulses of a second input signal; a save latch circuit that saves the count value held in the counter when an edge of the input signal is detected; a delay circuit that resets the counter with a reset signal generated by inputting the timing signal; and an interrupt activated by the edge detection circuit. An interrupt generation circuit that generates a signal, and a CP that processes according to the interrupt signal.
1. A counter circuit comprising: a data bus for transferring a value of the save latch circuit;
JP230587A 1987-01-07 1987-01-07 Counter circuit Pending JPS63169826A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP230587A JPS63169826A (en) 1987-01-07 1987-01-07 Counter circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP230587A JPS63169826A (en) 1987-01-07 1987-01-07 Counter circuit

Publications (1)

Publication Number Publication Date
JPS63169826A true JPS63169826A (en) 1988-07-13

Family

ID=11525644

Family Applications (1)

Application Number Title Priority Date Filing Date
JP230587A Pending JPS63169826A (en) 1987-01-07 1987-01-07 Counter circuit

Country Status (1)

Country Link
JP (1) JPS63169826A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5494380A (en) * 1978-01-10 1979-07-26 Yokogawa Hokushin Electric Corp Counter using microprocessor
JPS59155766A (en) * 1983-02-25 1984-09-04 Nec Home Electronics Ltd Pulse cycle measuring circuit
JPS6031062A (en) * 1983-07-31 1985-02-16 Nec Home Electronics Ltd Pulse cycle measuring circuit
JPS6074818A (en) * 1983-09-30 1985-04-27 Yokogawa Hokushin Electric Corp Pulse counter

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5494380A (en) * 1978-01-10 1979-07-26 Yokogawa Hokushin Electric Corp Counter using microprocessor
JPS59155766A (en) * 1983-02-25 1984-09-04 Nec Home Electronics Ltd Pulse cycle measuring circuit
JPS6031062A (en) * 1983-07-31 1985-02-16 Nec Home Electronics Ltd Pulse cycle measuring circuit
JPS6074818A (en) * 1983-09-30 1985-04-27 Yokogawa Hokushin Electric Corp Pulse counter

Similar Documents

Publication Publication Date Title
JPS63169826A (en) Counter circuit
JP3099927B2 (en) Microcomputer
JP4222254B2 (en) Microcomputer
JPH0658386B2 (en) Counter device
JP2804406B2 (en) Pulse measuring device
JP2906850B2 (en) Time-division switch monitoring circuit
JP2613916B2 (en) Data aperiodic readout circuit
JP2638337B2 (en) Error counter circuit
JPH0744399A (en) Interruption control circuit
JPH0631727B2 (en) Pulse measurement circuit with noise removal capability
JPH0340116A (en) Timer circuit
JPH0474244A (en) Latch circuit
JPH05134749A (en) Steering angle detection device
JPH02135914A (en) Differentiation circuit
JP2000259526A (en) Serial interface circuit
JPH04291654A (en) Interruption control circuit
JPH0120393B2 (en)
JPH0540140A (en) Pulse input circuit
JPH04304548A (en) Microprocessor device
JPH1041804A (en) Register read/reset circuit
JPH03270508A (en) Pulse detection circuit
JPH0460263B2 (en)
JPH0568749B2 (en)
JPH03136516A (en) Phase comparison circuit
JPS63174131A (en) Interruption controller