JPS63244207A - Pulse measuring instrument - Google Patents

Pulse measuring instrument

Info

Publication number
JPS63244207A
JPS63244207A JP62077934A JP7793487A JPS63244207A JP S63244207 A JPS63244207 A JP S63244207A JP 62077934 A JP62077934 A JP 62077934A JP 7793487 A JP7793487 A JP 7793487A JP S63244207 A JPS63244207 A JP S63244207A
Authority
JP
Japan
Prior art keywords
value
capture
bits
register
count clock
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.)
Granted
Application number
JP62077934A
Other languages
Japanese (ja)
Other versions
JP2504044B2 (en
Inventor
Hideo Abe
安部 秀夫
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
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP62077934A priority Critical patent/JP2504044B2/en
Publication of JPS63244207A publication Critical patent/JPS63244207A/en
Application granted granted Critical
Publication of JP2504044B2 publication Critical patent/JP2504044B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Combined Controls Of Internal Combustion Engines (AREA)
  • Control Of Velocity Or Acceleration (AREA)
  • Measuring Frequencies, Analyzing Spectra (AREA)

Abstract

PURPOSE:To simplify a capture interruption processing and to execute it at a high speed, and to improve the processing capacity of a central processing unit by allocating two addresses to a capture register, and executing independently an access to the upper and lower bit values. CONSTITUTION:A free running counter 100 counts a count clock phi. An 18 bit capture register 101 inputs and holds a value of the counter 100 by synchronizing with an input timing of an external signal 200. Also, each other address is allocated to the upper 16 bits and the lower 16 bits so that the upper 16 bits and the lower 16 bits can be read out independently, at the time of reading out a value which a central processing unit 010 has inputted. The central processing unit 010 executes an interruption processing for reading a value of the register 101, and in this case, a shifter 104 controls which 16 bits of the upper or the lower ones of the value of the register are to be read out. In such a way, a burden of a software can be reduced b7y eliminating a count clock switching operation.

Description

【発明の詳細な説明】 産業上の利用分野 本発明は、パルス計測装置に関するものであり、更に詳
述するならば、自動車エンジン、モータなどの周辺機器
の制御を行うタイマ/カウンタに関する。
DETAILED DESCRIPTION OF THE INVENTION Field of the Invention The present invention relates to a pulse measuring device, and more specifically, to a timer/counter for controlling peripheral devices such as automobile engines and motors.

従来の技術 今日、マイクロコンピュータは、LSI技術の進歩によ
り高集積化が進み、各種の周辺ハードウェアをワンチッ
プに搭載するようになってきた。
BACKGROUND OF THE INVENTION Today, microcomputers have become highly integrated due to advances in LSI technology, and various peripheral hardware has come to be mounted on a single chip.

この様な周辺ハードウェアのなかでも、タイマ/カウン
ト・ユニットは、自動車エンジン、モータなどの機器の
制御を行う際に、制御対象が発生する基準信号の周期、
位相等を計測し、計測値を用いて制御を行うなどのため
に不可欠なものである。
Among such peripheral hardware, the timer/count unit is used to control the period of the reference signal generated by the controlled object when controlling equipment such as automobile engines and motors.
It is essential for measuring the phase, etc., and performing control using the measured values.

通常のパルス計測装置は制御対象の発生する基準信号の
周期計測を行う為に1.制御対象の出力する基準信号の
発生タイミングに同期してタイマの値を取込み保持する
レジスタ(以下キャプチャレジスタと呼ぶ)を備えてい
る。
A normal pulse measuring device measures the period of a reference signal generated by a controlled object. It is provided with a register (hereinafter referred to as a capture register) that captures and holds the value of the timer in synchronization with the generation timing of the reference signal output by the controlled object.

通常自動車エンジン、モータなどの機器制御を行う場合
、制御対象の発生するパルス信号の周波数変化が広い範
囲に及ぶため、上記のタイマ/カウンタユニットはパル
スの周期や幅を高精度で計測するための周波数の高いカ
ウントクロックと、長い周期の計測に関してカウントを
行う為の周波数の低いカウントクロックを備え、カウン
トクロックを機器の動作状態に応じて、ソフトウェアで
選択してカウント動作を行う様にしている。
Normally, when controlling equipment such as automobile engines and motors, the frequency of the pulse signal generated by the controlled object varies over a wide range, so the timer/counter unit described above is used to measure the period and width of the pulse with high precision. It is equipped with a high-frequency count clock and a low-frequency count clock for counting long-cycle measurements, and the count clock can be selected by software to perform counting operations depending on the operating state of the device.

次に第7図、第8図及び第9図を参照して前述した制御
対象が発する基準信号の周波数変化が広い範囲に及ぶ場
合について従来の技術を説明する。
Next, with reference to FIGS. 7, 8, and 9, a conventional technique will be described for the case where the frequency of the reference signal emitted by the control object described above varies over a wide range.

第7図は、従来のパルス計測装置のブロック図である。FIG. 7 is a block diagram of a conventional pulse measuring device.

パルス計測装置003は、プログラムの実行/演算を行
う中央処理装置旧0、外部信号の発生タイミングを計測
するタイマ/カウンタユニット022、メモリ040、
タイマ/カウンタユニットと中央処理装置と各周辺ハー
ドウェアと間でデータを転送するための周辺バス030
から成るタイマ/カウンタユニット022は、2つの異
なるカウントクロックφΔ、φBを受けるフリーランニ
ングカウンタ110と、外部信号201の入力タイミン
グをキャプチャするキャプチャレジスタ111を有して
いる。フリーランニングカウンタ110 は、カウント
クロックφA1φBのいずれかをカウントクロックとし
て選択可能であり、システムセット後は、カウントクロ
ックφBをカウントクロックとして選択する。
The pulse measuring device 003 includes a central processing unit old 0 that executes programs/calculations, a timer/counter unit 022 that measures the timing of generation of external signals, a memory 040,
Peripheral bus 030 for transferring data between the timer/counter unit, central processing unit, and each peripheral hardware
The timer/counter unit 022 includes a free running counter 110 that receives two different count clocks φΔ and φB, and a capture register 111 that captures the input timing of the external signal 201. The free running counter 110 can select either one of the count clocks φA1φB as the count clock, and after the system is set, the count clock φB is selected as the count clock.

また、カウントクロックφAはカウントクロックφBよ
りも周波数が高い。従って、システムリセット後、フリ
ーランニングカウンタ110がφBをカウントすると、
フリーランニングカウンタ110のカウント周期は長く
なり、外部基準信号の入力周波数が低い場合に対応可能
である。また、カウントクロックφAに設定すると、フ
リーランニングカウンタ110のカウント周期は短くな
り、外部基準信号の入力周波数が高く、高い分解能の計
測値が必要な場合に対応する。
Further, the count clock φA has a higher frequency than the count clock φB. Therefore, after the system is reset, when the free running counter 110 counts φB,
The count period of the free-running counter 110 becomes longer, which can be used when the input frequency of the external reference signal is low. Furthermore, when the count clock φA is set, the count period of the free running counter 110 becomes short, which corresponds to the case where the input frequency of the external reference signal is high and a measurement value with high resolution is required.

また以下では、説明を簡単にするためにフリーランニン
グカウンタ110及び周辺バス030のピット長は、1
6ビツトとして説明する。
Further, in the following, to simplify the explanation, the pit length of the free running counter 110 and the peripheral bus 030 is 1.
This will be explained as 6 bits.

メモリ040は、中央処理装置010がキャプチャレジ
スタ111の値から外部信号2010入力周期を計測す
るためのデータ格納領域で、キャプチャ値格納エリア0
41.042、周期データ格納エリア043、割込み処
理カウントクロックを切り換えたことを示すカウントク
ロック切り換えフラグ044からなる。
The memory 040 is a data storage area for the central processing unit 010 to measure the input cycle of the external signal 2010 from the value of the capture register 111, and is a capture value storage area 0.
41.042, a periodic data storage area 043, and a count clock switching flag 044 indicating that the interrupt processing count clock has been switched.

メモリ040内のカウントクロック切り換えフラグ04
4は、中央処理装置010が割込み処理内でフリーラン
ニングカウンタ110のカウントクロックを切り換えた
ことを示す為のソフトウェアフラグである中央処理装置
010は割込み処理でカウントクロックを切り換えた場
合は、カウントクロック切り換えフラグを“1”にし、
カウントクロックを切り換えない場合、“0”にする。
Count clock switching flag 04 in memory 040
4 is a software flag to indicate that the central processing unit 010 has switched the count clock of the free-running counter 110 during interrupt processing.If the central processing unit 010 switches the count clock during interrupt processing, the central processing unit 010 switches the count clock. Set the flag to “1”,
Set to “0” if the count clock is not switched.

次に、第8図のタイミングチャートを参照して外部信号
201に同期してキャプチャする場合を説明する。
Next, the case of capturing in synchronization with the external signal 201 will be described with reference to the timing chart of FIG.

システムリセット後、前述のフリーランニングカウンタ
110は、カウントクロックφBが入力する度にカウン
ト動作を行う。
After the system is reset, the aforementioned free running counter 110 performs a counting operation every time the count clock φB is input.

キャプチャレジスタ111は、外部信号201がアクテ
ィブになるtlのタイミングに同期してフリーランニン
グカウンタ110の値を取込み保持する。
The capture register 111 captures and holds the value of the free running counter 110 in synchronization with the timing tl when the external signal 201 becomes active.

また、tlのタイミングで中央処理装置010は、割込
み処理を起動してキャプチャレジスタ111の値を取込
み、メモリ040内キヤプチヤ値格納エリア041に格
納する処理を行い、同時にキャプチャ値格納エリア04
2の値から外部信号201の周期を求め、外部信号20
1の入力周波数にあわせてカウントクロックを選択する
制御を行う。
Further, at the timing of tl, the central processing unit 010 activates an interrupt process, captures the value of the capture register 111, performs processing to store it in the capture value storage area 041 in the memory 040, and at the same time
The period of external signal 201 is determined from the value of 2, and external signal 20
Control is performed to select the count clock according to the input frequency of 1.

上記の動作は以降のt2、t3〜t12のタイミングに
於いても同様である。
The above operation is the same at the subsequent timings t2, t3 to t12.

以下では、上記の割込み処理を、第9図のフローチャー
トを用いて説明する。
The above interrupt processing will be explained below using the flowchart of FIG.

■ カウントクロック切り換えフラグ044 “1”で
あるか否かを判断し、前回のキャプチャから今回のキャ
プチャをするまでにカウントクロックを切り換えたか否
かを判別する。
■ Count clock switching flag 044 Determine whether it is "1" or not, and determine whether the count clock was switched from the previous capture to the current capture.

■−1i  ■に於いてカウントクロック切り換えフラ
グ力ぴ1′″であれば、カウントクロックを切り換えて
おり、前回のキャプチャ値は、切り換え前のカウントク
ロックでカウントしているフリーランニングカウンタを
キャプチャした値であり、今回のキャプチャ値は、カウ
ントクロック切り換え後のカウントクロックでカウント
しているフリーランニングカウンタをキャプチャした値
である。
■-1i If the count clock switching flag is 1''' in ■-1i, the count clock has been switched, and the previous capture value is the value captured from the free running counter counting with the count clock before switching. The current capture value is the value captured by the free running counter that is counting with the count clock after the count clock has been switched.

この場合、前記の2つのキャプチャ値を単純に減算する
と外部信号201の入力タイミング間隔は得られるが、
途中でカウントクロックの切り換え操作を行っているた
めに外部信号の周期は得られない。
In this case, the input timing interval of the external signal 201 can be obtained by simply subtracting the two captured values, but
Since the count clock is switched during the process, the period of the external signal cannot be obtained.

従って、この場合は前回のキャプチャ値から周期計算を
行わないものとし、単にキャプチャレジスタ111の値
を次のキャプチャ割込みのためのデータとしてキャプチ
ャ値格納エリア041 に格納し、カウントクロック切
り換えフラグ044”0’にして、割込み処理を完了す
る。
Therefore, in this case, the cycle is not calculated from the previous capture value, and the value of the capture register 111 is simply stored in the capture value storage area 041 as data for the next capture interrupt, and the count clock switching flag 044"0"' to complete interrupt processing.

この場合、割込み処理ではカウントクロック切り換え操
作のみを行い、周期計測は、行われないため、制御対象
に対する制御情報は、ユーザーの意図するべき補正処理
を行う。例えば、前回の周期データをそのまま制御パラ
メータとする等の処理を実行する。
In this case, in the interrupt processing, only the count clock switching operation is performed, and period measurement is not performed, so that the control information for the controlled object is subjected to the correction processing intended by the user. For example, a process such as using the previous cycle data as a control parameter is executed.

■−1i  ■に於いてカウントクロック切り換えフラ
グが“0″であればキャプチャレジスタ110の値をキ
ャプチャ値格納エリア042へ格納する。
(2)-1i If the count clock switching flag is "0" in (2), the value of the capture register 110 is stored in the capture value storage area 042.

■ 次に今回のキャプチャ値を格納しであるキャプチャ
値格納エリア042の値から前回のキャプチャ値を格納
しであるキャプチャ値格納エリア041の値を減算する
(2) Next, the value in the capture value storage area 041, which stores the previous capture value, is subtracted from the value in the capture value storage area 042, which stores the current capture value.

■ 演算結果を周期データ格納エリア043へ、格納す
る。
■ Store the calculation results in the periodic data storage area 043.

■ キャプチャ111の値をキャプチャ格納エリア04
1へ転送する。
■ Capture the value of capture 111 in storage area 04
Transfer to 1.

■ 周期データがFOOOHよりも大きいか判別する。■ Determine whether the periodic data is larger than FOOOH.

上記判別によって周期データがFOOOHよりも大きい
場合は、周期データがオーバーフローしないように、カ
ウントクロックの周波数を低くする処理を行うが、本説
明では説明を簡単にする為、以後カウントクロックの周
波数を低くするための周期データの比較値をFOOOH
として説明する。
If the periodic data is larger than FOOOH according to the above judgment, processing is performed to lower the frequency of the count clock so that the periodic data does not overflow. FOOOH the periodic data comparison value for
It will be explained as follows.

■=i 周期データがFOOOHより大きい場合は、カ
ウントクロックをφBに切り換えて、■の処理を行う。
■=i If the periodic data is greater than FOOOH, the count clock is switched to φB and the process of ■ is performed.

■−1i  周期データがFOOOHよりも小さい場合
は、次に周期データが0100Hよりも大きいか判別す
る。
-1i If the periodic data is smaller than FOOOH, then it is determined whether the periodic data is larger than 0100H.

■と同様に上記の判別によって周期データが0100よ
りも小さい場合は、周期データの有効数字が小さくなら
ないように、カウントクロックの周波数を高くする処理
を行うが、本説明では説明を簡単にする為、以後カウン
トクロックの周波数を高くするための周期データの比較
値を0100 Hとして説明する。
Similarly to ■, if the periodic data is smaller than 0100 according to the above judgment, processing is performed to increase the frequency of the count clock so that the significant figures of the periodic data do not become small. However, in this explanation, for the sake of simplicity, , hereinafter, the comparison value of periodic data for increasing the frequency of the count clock will be explained as 0100H.

■−1周期データが01008よりも大きい場合は、割
込み処理を完了する。
(2) If the -1 period data is greater than 01008, the interrupt processing is completed.

■−1i  周期データが0100 Hよりも小さい場
合は、カウントクロックをφAに切り換える。
-1i If the period data is smaller than 0100H, switch the count clock to φA.

■ カウントクロック切り換えフラグ044を“l″に
し、割込み処理を完了する。
(2) Set the count clock switching flag 044 to "l" and complete the interrupt processing.

以上の処理により、タイマ/カウンタユニット022は
、外部信号2010入力周波数のダイナミックレンジに
合わたカウントクロックによってカウント動作を行って
、外部信号201の周期計測を行う。
Through the above processing, the timer/counter unit 022 performs a counting operation using a count clock that matches the dynamic range of the input frequency of the external signal 2010, and measures the period of the external signal 201.

発明が解決しようとする問題点 従来のパルス計測装置は、外部基準信号の入力周波数の
ダイナミックレンジが広い場合は、カウンタに入力する
カウントクロックを切り換えて制御値を分解能を確保す
る操作を行うが、そのだめのソフトウェア処理として、 カウントクロック切り換えフラグのチェックカウントク
ロックの切り換え操作 カウントクロック切り換え後の補正処理といったソフト
ウェア処理を実行しなければならず、割込み処理の実行
時間が、長くなるだけでなく、外部基準信号人力周波数
が高くなるにつれて、割込み処理の実行時間が中央処理
装置の処理効率を低下させ、しいてはシステム全体の処
理効率の低下を招く、といった問題点がある。
Problems to be Solved by the Invention In conventional pulse measuring devices, when the dynamic range of the input frequency of the external reference signal is wide, the count clock input to the counter is switched to ensure resolution of the control value. In order to avoid this, it is necessary to perform software processing such as checking the count clock switching flag, switching the count clock, and correcting processing after switching the count clock, which not only increases the execution time of interrupt processing but also requires external As the reference signal input frequency becomes higher, there is a problem that the execution time of interrupt processing reduces the processing efficiency of the central processing unit, which in turn causes a reduction in the processing efficiency of the entire system.

また、従来のパルス計測装置は、外部基準信号の入力周
波数の変化に対して、カウントクロックを切り換えて対
応するが、カウントクロックの切り換え操作後の最初の
キャプチャでは、外部信号の入力周期の演算が不可能と
なって制御情報が欠如するばかりでなく、外部信号の入
力周波数の変化が非常に頻繁になって毎回のキャプチャ
割込み毎にカウントクロックを切り換える操作が必要に
なった場合は、外部信号の入力周期の演算が全く不可能
となり、制御対象の制御を行えなくなるといった問題点
がある。
In addition, conventional pulse measurement devices respond to changes in the input frequency of the external reference signal by switching the count clock, but in the first capture after switching the count clock, the input period of the external signal cannot be calculated. If this becomes impossible and control information is missing, and if the input frequency of the external signal changes so frequently that it becomes necessary to switch the count clock for each capture interrupt, There is a problem in that it becomes completely impossible to calculate the input cycle, making it impossible to control the controlled object.

そこで、本発明は、上記した従来のパルス計測装置の問
題を解消してパルス計測装置を提供せんとするものであ
る。
Therefore, the present invention aims to provide a pulse measuring device that solves the problems of the conventional pulse measuring device described above.

問題点を解決するための手段 本発明によるパルス計測装置は、少な(とも中央処理装
置と、単一のカウントクロックをカウントするカウンタ
と、外部信号に同期して前記カウンタの値を取込み保持
するレジスタと、前記レジスタの値をシフトするシフタ
とを具備し、前記レジスタは、異なるビット位置から始
る複数の単位部分からなり、前記複数の単位部分にそれ
ぞれ異なるアドレスが設定され、前記シフタは、前記の
単位部分からの読み出し値を最下位ビットに装置し、前
記中央処理装置は前記アドレスの指定により前記レジス
タの異なるビット位置から始る複数の単位部分を独立に
読み出す。
Means for Solving the Problems The pulse measuring device according to the present invention includes a central processing unit, a counter that counts a single count clock, and a register that captures and holds the value of the counter in synchronization with an external signal. and a shifter that shifts the value of the register, the register is made up of a plurality of unit parts starting from different bit positions, different addresses are set to the plurality of unit parts, and the shifter is configured to shift the value of the register. The central processing unit reads out a plurality of unit parts starting from different bit positions of the register independently according to the address designation.

作用 上記した本発明によるパルス計測装置は、カウンタの値
を敢込み、保持するレジスタに複数のアドレスを割り付
けているため、中央処理装置をキャプチャレジスタのア
クセスを行う際にキャプチャレジスタの値のうち制御情
報として有効なレンジのデータを単なるレジスタの読み
出し操作で実現できる。従って、カウントクロック切り
換え操作をなくしてソフトウェアの負担を軽減し、最小
限のハードウェアで、外部信号の入力周波数の変化に対
応した高精度の計測を行うことができる。
Effects The above-described pulse measuring device according to the present invention stores the value of the counter and assigns multiple addresses to the register to hold it, so when the central processing unit accesses the capture register, the central processing unit can control only one of the values in the capture register. A valid range of data can be obtained by simply reading registers. Therefore, the burden on the software is reduced by eliminating the count clock switching operation, and highly accurate measurement corresponding to changes in the input frequency of the external signal can be performed with a minimum amount of hardware.

実施例 以下、添付図面を参照して本発明によるパルス計測装置
の実施例を説明する。なお、以下の実施例を本発明によ
るパルス計測装置を例示するものに過ぎず、本発明は、
それら実施例に限定されるものではない。
Embodiments Hereinafter, embodiments of a pulse measuring device according to the present invention will be described with reference to the accompanying drawings. Note that the following examples are merely illustrative of the pulse measuring device according to the present invention, and the present invention
The present invention is not limited to these examples.

実施例1 次に、本発明の第1の実施例について第1図を参照して
説明する。
Example 1 Next, a first example of the present invention will be described with reference to FIG.

第1図は、本発明によるパルス計測装置の一実施例のブ
ロック図である。図示のパルス計測装置001は、中央
処理装置010、メモリ040、タイマカウンタユニッ
ト020.16ビツト幅の周辺バス030からなる。
FIG. 1 is a block diagram of an embodiment of a pulse measuring device according to the present invention. The illustrated pulse measuring device 001 comprises a central processing unit 010, a memory 040, a timer/counter unit 020, and a 16-bit wide peripheral bus 030.

タイマカウンタユニット020は、カウントクロックφ
をカウントする18ビツトフリーランニングカウンタ1
00と、制御対象が発する外部信号200の入力によっ
てフリーランニングカウンタ100の値を取込み保持す
る18ビツトキヤプチヤレジスタ101と、キャプチャ
レジスタ101の値を中央処理装置010が読み出す際
に、キャプチャレジスタ101の値の上位16ビツト、
下位16ビツトのいずれの16ビツトを読み出すかを制
御するシフタ104とからなる。
The timer counter unit 020 has a count clock φ
18-bit free running counter 1
00 and an 18-bit capture register 101 that captures and holds the value of the free running counter 100 in response to the input of an external signal 200 generated by the controlled object. The upper 16 bits of the value of
A shifter 104 controls which of the lower 16 bits are read out.

18ビツトフリーランニングカウンタ100 は、従来
例における16ピツトフリーランニングカウンタのカウ
ントクロックφBがφAの4倍の周期を持った場合に相
当する。
The 18-bit free running counter 100 corresponds to a conventional 16-bit free running counter in which the count clock φB has a period four times that of φA.

すなわち、本実施例の18ビツトの下位16ビツト分は
、従来例のフリーランニングカウンタがφAのカウント
を行っている場合に相当し、18ビツトの上位16ピツ
ト分は、従来例のフリーランニングカウンタがφBのカ
ウントを行っている場合に相当する。
That is, the lower 16 bits of the 18 bits in this embodiment correspond to the case where the conventional free running counter counts φA, and the upper 16 bits of the 18 bits correspond to the case where the conventional free running counter counts φA. This corresponds to the case where φB is counted.

本実施例では、フリーランニングカウンタ100、キャ
プチャレジスタ101のビット長は18ビツト、周辺バ
ス030のビット長は16ビツトとしているが、上記以
外のビット長でも同様の構成をとることができることは
言うまでもない。
In this embodiment, the free running counter 100 and capture register 101 have a bit length of 18 bits, and the peripheral bus 030 has a bit length of 16 bits, but it goes without saying that a similar configuration can be made with bit lengths other than those mentioned above. .

メモリ040 は、タイマカウンタユニット020が計
測した値を格納するキャプチャ値格納エリア041.0
42、キャプチャ値から求める周期データを格納する周
期データ格納エリア043からなる。
The memory 040 has a capture value storage area 041.0 that stores the values measured by the timer counter unit 020.
42, a periodic data storage area 043 for storing periodic data obtained from the captured values.

次にパルス計測装置001の各部の動作を説明する。Next, the operation of each part of the pulse measuring device 001 will be explained.

フリーランニングカウンタ100は、カウントクロック
φが入力する度にカウント動作を行う。
The free running counter 100 performs a counting operation every time the count clock φ is input.

キャプチャレジスタ101 は、外部信号200の人力
タイミングに同期して、フリーランニングカウンタ10
0の値を取込み保持する18ビツトのレジスタで中央処
理装置010が取込んだ値を読み出す際に、18ビツト
の上位16ビツトと、下位16ビツトのどちらも、独立
に読み出しができるように、キャプチャレジスタ101
の上位16ビツトと、下位16ビツトで別のアドレスを
割り付けている。
The capture register 101 synchronizes with the manual timing of the external signal 200 and controls the free running counter 10.
When reading the value captured by the central processing unit 010 using the 18-bit register that captures and holds a value of 0, the capture is performed so that both the upper 16 bits and lower 16 bits of the 18 bits can be read independently. register 101
Different addresses are assigned to the upper 16 bits and lower 16 bits.

18ビツトキヤプチヤレジスタの上位16ビツトの値は
、実質上カウントクロックφ/4のカウンタをキャプチ
ャした値に等しい。即ち、キャプチャレジスタ101の
下位ビットは、従来例において、カウンタのカウントク
ロックをφにしてキャプチャした値に等しく、キャプチ
ャレジスタ101の上位16ビツトは、従来例のカウン
タのカウントクロックをφ/4に切り換えてキャプチャ
した値に等しい。
The value of the upper 16 bits of the 18-bit capture register is substantially equal to the value captured by the counter of count clock φ/4. That is, the lower bits of the capture register 101 are equal to the value captured when the counter's count clock is set to φ in the conventional example, and the upper 16 bits of the capture register 101 are equal to the value captured when the counter's count clock in the conventional example is switched to φ/4. equal to the value captured by

シフタ104は、キャプチャレジスタ101の値を中央
処理装置010が読み出しを行う際に上位16ビツトと
下位16ビツトの異なるアドレスによって、読み出すデ
ータのビット位置を変えるために、アドレスが上位16
ビツトのアドレスであれば18ビツトキヤプチヤレジス
タ101の上位16ビツトの値を16ビツト周辺バス0
30に出力し、下位16ビツトのアドレスであれば18
ビツトキヤプチヤレジスタ101゜の下位16ビツトの
値を16ビツト周辺バス030に出力する。
When the central processing unit 010 reads out the value of the capture register 101, the shifter 104 changes the bit position of the read data according to different addresses of the upper 16 bits and the lower 16 bits.
If it is a bit address, the value of the upper 16 bits of the 18-bit capture register 101 is transferred to the 16-bit peripheral bus 0.
30, and if the address is the lower 16 bits, it is 18
The value of the lower 16 bits of the bit capture register 101° is output to the 16-bit peripheral bus 030.

次に本実施例のバードウェアの実際の動作を説明する。Next, the actual operation of the hardware of this embodiment will be explained.

フリーランニングカウンタ100は、第2図に示すよう
に、カウントクロックφをカウントし、キャプチャレジ
スタ101 は、外部信号200が入力するタイミング
に同期してフリーランニングカウンタ100の値を取込
み、中央処理装置010はキャプチャレジスタ101の
値を読み込む割込み処理を行う。
As shown in FIG. 2, the free running counter 100 counts the count clock φ, and the capture register 101 captures the value of the free running counter 100 in synchronization with the timing at which the external signal 200 is input. performs interrupt processing to read the value of the capture register 101.

以下では、中央処理装置010が行う割込み処理につい
て第3図のフローチャートを参照して説明する。
The interrupt processing performed by the central processing unit 010 will be described below with reference to the flowchart in FIG.

中央処理装置010は、外部信号200が人力する度に
以下に述べる割込み処理を起動して、キャプチャレジス
タ101の値をメモリ040に転送すること、前回のキ
ャプチャ値から外部信号200の周期を求めること、の
2つの処理を行う。
The central processing unit 010 activates the interrupt processing described below every time the external signal 200 is input, transfers the value of the capture register 101 to the memory 040, and calculates the period of the external signal 200 from the previous captured value. The following two processes are performed.

■ キャプチャレジスタ101の上位16ビツトの値を
キャプチャ値格納エリア042へ格納する。
(2) Store the value of the upper 16 bits of the capture register 101 in the capture value storage area 042.

■ 次に今回のキャプチャ値を格納しであるキャプチャ
値格納エリア042の値から前回のキャプチャ値を格納
しであるキャプチャ値格納エリア041の値を減算する
(2) Next, the value in the capture value storage area 041, which stores the previous capture value, is subtracted from the value in the capture value storage area 042, which stores the current capture value.

■ 演算結果を周期データ格納エリア043へ、格納す
る。
■ Store the calculation results in the periodic data storage area 043.

■ キャプチャ値格納エリア042の値をキャプチャ値
エリア041へ転送し、次のキャプチャ割込みに対して
今回のキャプチャ値を格納する。
(2) Transfer the value in the capture value storage area 042 to the capture value area 041, and store the current capture value in response to the next capture interrupt.

■ 周期データが01008よりも小さいか、判別する
。上記の判別によって周期データが0100Hよりも小
さい場合は、周期データの有効数字が小さくならないよ
うに、キャプチャレジスタ101の下位側のデータを読
み込み、再度周期演算を行うが本実施例では説明を簡単
にする為、以後周期データの比較値を01008として
説明する。
■ Determine whether the cycle data is smaller than 01008. If the periodic data is smaller than 0100H according to the above determination, the lower data of the capture register 101 is read and the periodic calculation is performed again so that the significant figures of the periodic data do not become smaller. Therefore, the comparison value of the periodic data will be explained as 01008 from now on.

■−1上記■に於いて周期データが01008よりも小
さい場合は、上記のキャプチャレジスタ101の値の下
位16ビツト側の値を読み込み、■の処理を行う。
(2)-1 If the periodic data is smaller than 01008 in (2) above, read the lower 16 bits of the value of the capture register 101 and perform the process (2).

■−1i  周期データが01008よりも大きい場合
は、割込み処理を完了する。′ ■ キャプチャ値格納エリア042の値からキャプチャ
値格納エリア041の演算を行う。
-1i If the cycle data is greater than 01008, interrupt processing is completed. ' 2 Calculate the captured value storage area 041 from the value in the captured value storage area 042.'

■ 演算結果を周期データ格納エリア043に格納し、
割込み処理を完了する。
■ Store the calculation results in the periodic data storage area 043,
Complete interrupt processing.

以上のキャプチャ割込みでは、広い周期に合せてキャプ
チャ101の上位16ビツトの値を読み込み、周期計算
を行っており、外部基準信号200の入力周波数が高く
なって周期データが01008よりも小さくなった場合
には、キャプチャ101の下位16ビツトの値を読み直
して、周期計算を行う操作を行う。
In the above capture interrupt, the period is calculated by reading the value of the upper 16 bits of the capture 101 according to a wide period, and when the input frequency of the external reference signal 200 becomes high and the period data becomes smaller than 01008. To do this, the value of the lower 16 bits of the capture 101 is reread and a cycle calculation is performed.

以上の処理により、タイマ/カウントユニット020は
、外部信号200の入力周波数のダイナミックレンジに
合せて、外部信号200の周期計測を行うことが可能で
ある。
Through the above processing, the timer/count unit 020 can measure the period of the external signal 200 in accordance with the dynamic range of the input frequency of the external signal 200.

実施例2 次に、本発明によるパルス計測装置の第2の実施例につ
いて第4図を参照して説明する。
Embodiment 2 Next, a second embodiment of the pulse measuring device according to the present invention will be described with reference to FIG. 4.

第2の実施例は、1つの基準外部信号200と他の2つ
の外部信号の位相差を求めるものである。
In the second embodiment, the phase difference between one reference external signal 200 and two other external signals is determined.

なお、第4図において、実施例1で既に説明した部分に
ついては説明を省略する。
In addition, in FIG. 4, description of the parts already described in Example 1 will be omitted.

第4図に示すパルス計測装置003は、中央処理装置0
10、メモリ040、タイマカウンタユニット021.
16ビツト幅の周辺バス030からなる。
The pulse measuring device 003 shown in FIG.
10, memory 040, timer counter unit 021.
It consists of a 16-bit wide peripheral bus 030.

タイマカウンタユニット021は、第5図に示すような
カウントクロックφをカウントする18ビツトフリーラ
ンニングカウンタ100 と、同様に第5図に示すよう
な制御対象が発する外部信号200.210.220の
入力によってフリーランニングカウンタ100の値を取
込み保持する18ビツトキヤプチヤレジスタ101.1
02.103 と、キャプチャレジスタ101.102
.103、の値を中央処理装置010が読み出す際に、
キャプチャレジスタ101.102.103の値の上位
16ビツト、下位16ビツトのいずれの16ビツトを読
み出すかを制御するシフタ104からなる。
The timer/counter unit 021 is configured by an 18-bit free running counter 100 that counts the count clock φ as shown in FIG. 18-bit capture register 101.1 that captures and holds the value of free running counter 100
02.103 and capture register 101.102
.. When the central processing unit 010 reads the value of 103,
It consists of a shifter 104 that controls which of the upper 16 bits and lower 16 bits of the value of the capture register 101, 102, and 103 is read out.

第2実施例では、フリーランニングカウンタ100、キ
ャプチャレジスタ101.102.103のビット長は
18ビツト、周辺バス030のビット長は16ビツトと
しているが、上記以外のビット長でも同様の構成をとる
ことができることは言うまでもない。
In the second embodiment, the free-running counter 100 and capture registers 101, 102, and 103 have a bit length of 18 bits, and the peripheral bus 030 has a bit length of 16 bits, but a similar configuration can be used with bit lengths other than the above. Needless to say, it can be done.

メモリ040は、タイマカウンタユニット021が計測
した値を格納するキャプチャ値格納エリア041.04
2、位相差データ格納エリア045.046からなる。
The memory 040 has a capture value storage area 041.04 that stores the values measured by the timer counter unit 021.
2. Consists of phase difference data storage areas 045 and 046.

次にパルス計測装置002の各部の動作を説明する。Next, the operation of each part of the pulse measuring device 002 will be explained.

フリーランニングカウンタ100、キャプチャレジスタ
101、シフタ104、中央処理装置010、メモリ0
40は、実施例1と同様のハードウェアであるため動作
の説明は省略する。
Free running counter 100, capture register 101, shifter 104, central processing unit 010, memory 0
Since 40 is the same hardware as in the first embodiment, a description of its operation will be omitted.

キャプチャレジスタ102.103は、キャプチャレジ
スタ101 と同様のキャプチャレジスタで外部信号2
10.220の入力タイミングに同期してフリーランニ
ングカウンタ100の値を取り込み保持する。
Capture registers 102 and 103 are capture registers similar to capture register 101, and capture external signal 2.
10. The value of the free running counter 100 is taken in and held in synchronization with the input timing of 220.

また、キャプチャレジスタ102.103 は、キャプ
チャレジスタ101 と同様に中央処理装置旧0が読み
出し、書き込みを行う際に上位16ビツトと、下位16
ビツトを独立にアクセスできるように上位16ビツトと
、下位の16ビツトに、異なる別のアドレスを割り付け
である。
Similarly to the capture register 101, the capture registers 102 and 103 are used to read and write data to the upper 16 bits and lower 16 bits when the central processing unit old 0 reads and writes.
Different addresses are assigned to the upper 16 bits and the lower 16 bits so that the bits can be accessed independently.

次に、中央処理装置010が外部信号210と、外部信
号200の位相差を求める為の割込み処理について第6
図のフローチャートを参照して説明する。
Next, the central processing unit 010 explains the sixth interrupt process for determining the phase difference between the external signal 210 and the external signal 200.
This will be explained with reference to the flowchart shown in the figure.

■ キャプチャレジスタ101の上位16ビツトの値を
キャプチャ値格納エリア042へ格納する。
(2) Store the value of the upper 16 bits of the capture register 101 in the capture value storage area 042.

■ キャプチャレジスタ102の上位16ビツトの値を
キャプチャ値格納エリア041へ格納する。
(2) Store the value of the upper 16 bits of the capture register 102 in the capture value storage area 041.

■ キャプチャ値格納エリア041の値からキャプチャ
値格納エリア042の値を減算し、位相差を求める。
(2) Subtract the value in the capture value storage area 042 from the value in the capture value storage area 041 to find the phase difference.

■ ■で求めた位相差データが01008よりも小さい
か、判別する。
(2) Determine whether the phase difference data obtained in (2) is smaller than 01008.

上記判別によって位相差データ0100 Hよりも小さ
い場合は、位相差データの有効数字が小さくならないよ
うに、キャプチャレジスタ101.102の下位側のデ
ータを読み込み、再度周期演算を行うが本実施例では説
明を簡単にする為、以後周期データの比較値を0100
8として説明する。
If the phase difference data is smaller than the phase difference data 0100H by the above determination, the lower data of the capture registers 101 and 102 is read and the period calculation is performed again so that the significant figures of the phase difference data do not become smaller, but this will be explained in this embodiment. To simplify the process, from now on, the comparison value of period data will be 0100.
This will be explained as 8.

■−1上記■において位相差データが01008よりも
小さい場合は、■の処理を行う。
(2)-1 If the phase difference data is smaller than 01008 in the above (2), the process (2) is performed.

■−1i  位相差データが01008よりも大きい場
合は、■の処理を行う。
(2)-1i If the phase difference data is greater than 01008, process (2) is performed.

■ キャプチャレジスタ101の下位16ビツトのアド
レスを出力し、キャプチャレジスタ101の下位16ビ
ツトの値を読み込み、キャプチャ値格納エリア042へ
格納する。
(2) Output the address of the lower 16 bits of the capture register 101, read the value of the lower 16 bits of the capture register 101, and store it in the capture value storage area 042.

■ キャプチャレジスタ102の下位16ビツトのアド
レスを出力し、キャプチャレジスタ102の下位16ヒ
ツトの値を読み込み、キャプチャ値格納エリア041へ
格納する。
(2) Output the address of the lower 16 bits of the capture register 102, read the value of the lower 16 bits of the capture register 102, and store it in the capture value storage area 041.

■ キャプチャ値格納エリア041の値からキャプチャ
値格納エリア042の値を減算し、位相差を求める。
(2) Subtract the value in the capture value storage area 042 from the value in the capture value storage area 041 to find the phase difference.

■ 演算結果を位相差データ格納エリア045に格納し
、割込み処理を終了する。
(2) Store the calculation result in the phase difference data storage area 045 and end the interrupt processing.

以上の処理により、タイマ/カウンタユニット021は
、外部信号200の入力タイミングと、外部信号210
の入力タイミングから外部信号200 と外部信号21
0の位相差を外部信号の入力タイミング、入力周波数に
よらずに、高い精度の位相差を求めることが可能である
Through the above processing, the timer/counter unit 021 can determine the input timing of the external signal 200 and the input timing of the external signal 210.
External signal 200 and external signal 21 from the input timing of
It is possible to obtain a highly accurate phase difference without depending on the input timing or input frequency of an external signal.

上記の説明では、外部信号210と、外部信号200の
位相差を求める場合にってい説明したが、外部信号22
0と外部信号200の位相差も同様の処理で求めること
ができる。
In the above explanation, the case where the phase difference between the external signal 210 and the external signal 200 is calculated is explained.
The phase difference between the external signal 200 and the external signal 200 can also be obtained by similar processing.

また本実施例2では、キャプチャレジスタが3つの場合
について述べたが、キャプチャレジスタの数をさらに増
加させても同様の処理により、複数の信号間の位相差を
求めることができるのは明かである。
Furthermore, in this second embodiment, the case where there are three capture registers has been described, but it is clear that even if the number of capture registers is further increased, the phase difference between multiple signals can be determined by the same processing. .

発明の効果 以上説明したように、本発明によるパルス計測装置にお
いては、キャプチャレジスタに2つのアドレスを割り付
けて上位16ビツト/下位16ビツトの値を独立にアク
セスできる機能をもたせることにより、以下の効果が得
られる。
Effects of the Invention As explained above, in the pulse measuring device according to the present invention, by assigning two addresses to the capture register and providing the function of independently accessing the values of the upper 16 bits/lower 16 bits, the following effects can be achieved. is obtained.

(1)本発明のパルス計測装置は、カウントクロックの
切り換え操作を行わないため、キャプチャ信号による割
込み処理でカウントクロックを切り換えたか否かの判断
を必要とせず、キャプチャ割込みの処理の簡素化、割込
み処理の高速化が可能となり、中央処理装置の処理能力
の向上を図ることができる。
(1) Since the pulse measuring device of the present invention does not perform a count clock switching operation, it is not necessary to determine whether or not the count clock has been switched by interrupt processing using a capture signal, simplifying capture interrupt processing and interrupt processing. It becomes possible to speed up the processing, and improve the processing capacity of the central processing unit.

(2)本発明のパルス計測装置は、入力パルスの周波数
変化をとらえて、内部のフリーランニングカウンタのカ
ウントクロックを切り換え操作を行う必要がないため、
キャプチャタイミングごとに周期演算が可能である。
(2) The pulse measuring device of the present invention does not need to switch the count clock of the internal free running counter by capturing the frequency change of the input pulse.
Periodic calculations can be performed at each capture timing.

(3)本発明のパルス計測装置は、単一のシフタによっ
て複数のキャプチャレジスタの読み出し値をシフトする
ことが可能であるため、計測対象の増加によってキャプ
チャレジスタを増設する際に、単にキャプチャレジスタ
のみを増設するだけで制御対象の増加に対応できる。
(3) Since the pulse measuring device of the present invention can shift the read values of multiple capture registers using a single shifter, when adding capture registers due to an increase in the number of measurement targets, it is possible to shift the read values of multiple capture registers by simply using only the capture registers. It is possible to handle an increase in the number of controlled objects simply by adding more.

以上説明したように、本発明によるパルス計測装置は、
カウントクロック切り換え操作をなくしてソフトウェア
の負担を軽減し、最小限のハードウェアで、外部信号の
入力周波数の変化に対応した高精度の計測を行うことが
できる。
As explained above, the pulse measuring device according to the present invention has the following features:
Eliminating the need to switch count clocks reduces the burden on software, allowing highly accurate measurements that respond to changes in the input frequency of external signals with a minimum amount of hardware.

〔主な参照番号〕[Main reference number]

001.002.003  ・・パルス計測装置010
・・中央処理装置 020.021・・本発明によるパルス計測装置022
・・従来のパルス計測装置 030・・周辺バス 040・・メモリ 041.042・・キャプチャ値格納エリア043・・
周期データ格納エリア 044・・カウントクロック切り換えフラグ045.0
46・・位相差データ格納エリア100.110・・フ
リーランニングカウンタ101.102.103.11
1・・キャプチャレジスタ104・・シフタ
001.002.003...Pulse measuring device 010
...Central processing unit 020.021...Pulse measuring device 022 according to the present invention
・・Conventional pulse measuring device 030 ・・Peripheral bus 040 ・・Memory 041.042 ・・Captured value storage area 043 ・・・
Periodic data storage area 044... Count clock switching flag 045.0
46...Phase difference data storage area 100.110...Free running counter 101.102.103.11
1...Capture register 104...Shifter

Claims (1)

【特許請求の範囲】[Claims] 少なくとも中央処理装置と、単一のカウントクロックを
カウントするカウンタと、外部信号に同期して前記カウ
ンタの値を取込み保持するレジスタと、前記レジスタの
値をシフトするシフタとを具備し、前記レジスタは、異
なるビット位置から始る複数の単位部分からなり、前記
複数の単位部分にそれぞれ異なるアドレスが設定され、
前記シフタは、前記の単位部分からの読み出し値を最下
位ビットに装置し、前記中央処理装置は前記アドレスの
指定により前記レジスタの異なるビット位置から始る複
数の単位部分を独立に読み出すことを特徴とするパルス
計測装置。
It comprises at least a central processing unit, a counter that counts a single count clock, a register that captures and holds the value of the counter in synchronization with an external signal, and a shifter that shifts the value of the register, and the register , consisting of a plurality of unit parts starting from different bit positions, and different addresses are set for each of the plurality of unit parts,
The shifter stores the read value from the unit part to the least significant bit, and the central processing unit independently reads out a plurality of unit parts starting from different bit positions of the register according to the address specification. Pulse measuring device.
JP62077934A 1987-03-31 1987-03-31 Pulse measuring device Expired - Lifetime JP2504044B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62077934A JP2504044B2 (en) 1987-03-31 1987-03-31 Pulse measuring device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62077934A JP2504044B2 (en) 1987-03-31 1987-03-31 Pulse measuring device

Publications (2)

Publication Number Publication Date
JPS63244207A true JPS63244207A (en) 1988-10-11
JP2504044B2 JP2504044B2 (en) 1996-06-05

Family

ID=13647912

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62077934A Expired - Lifetime JP2504044B2 (en) 1987-03-31 1987-03-31 Pulse measuring device

Country Status (1)

Country Link
JP (1) JP2504044B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04145510A (en) * 1990-10-05 1992-05-19 Nec Corp Single-chip microcomputer

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5557910A (en) * 1978-10-23 1980-04-30 Komatsu Ltd Positioning controller
JPS6267603A (en) * 1985-09-19 1987-03-27 Nec Corp Pulse measuring instrument

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5557910A (en) * 1978-10-23 1980-04-30 Komatsu Ltd Positioning controller
JPS6267603A (en) * 1985-09-19 1987-03-27 Nec Corp Pulse measuring instrument

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04145510A (en) * 1990-10-05 1992-05-19 Nec Corp Single-chip microcomputer

Also Published As

Publication number Publication date
JP2504044B2 (en) 1996-06-05

Similar Documents

Publication Publication Date Title
US5168276A (en) Automatic A/D converter operation using a programmable control table
US5278961A (en) Physical address to logical address translator for memory management units
JP3749732B2 (en) Fast access to shared resources on the computer bus
JPS63244207A (en) Pulse measuring instrument
US4644841A (en) Electronic musical instrument
US6334191B1 (en) Multi-function timer with shared hardware
EP0436211B1 (en) Apparatus enabling observation of internal memory-mapped registers
JP2976276B2 (en) Timing generator
US20010005870A1 (en) External bus control system
JP3178445B2 (en) Counter device
JPS6142186Y2 (en)
JP3947017B2 (en) Dial pulse generator
JPH0752579Y2 (en) Overrange / underrange monitor circuit
JPH0520350A (en) Vector processing device
JP2565327B2 (en) Signal processor
JPH07146814A (en) Memory device
JPH0229457Y2 (en)
US20010025228A1 (en) Method for evaluating measured data
JPS6411977B2 (en)
JPS6014435B2 (en) Storage device
KR100249073B1 (en) Digital data processor including apparatus for collecting time-related information
JPH06242146A (en) Digital oscilloscope
JPH03132852A (en) Bus asynchronous control system
JP3206010B2 (en) Time stamp circuit
JPS62113248A (en) Information history memory device