JPH0357970A - Pulse input apparatus - Google Patents

Pulse input apparatus

Info

Publication number
JPH0357970A
JPH0357970A JP19265989A JP19265989A JPH0357970A JP H0357970 A JPH0357970 A JP H0357970A JP 19265989 A JP19265989 A JP 19265989A JP 19265989 A JP19265989 A JP 19265989A JP H0357970 A JPH0357970 A JP H0357970A
Authority
JP
Japan
Prior art keywords
instruction
time
event
memory
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.)
Pending
Application number
JP19265989A
Other languages
Japanese (ja)
Inventor
Katsuhisa Kondo
近藤 勝久
Yasuo Yamada
泰生 山田
Masashi Takahashi
真史 高橋
Tsutomu Takei
勉 武井
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP19265989A priority Critical patent/JPH0357970A/en
Publication of JPH0357970A publication Critical patent/JPH0357970A/en
Pending legal-status Critical Current

Links

Landscapes

  • Measurement Of Unknown Time Intervals (AREA)

Abstract

PURPOSE:To prepare the order set suitable for the measurement of a time interval by taking in a plurality of input signals at the same time to once store the same in an input memory and reading the signals at every channel to measure event generating time. CONSTITUTION:At least one register storing the measuring result of the order executed immediately before in an order execution part and a means adding at least one flag showing the measuring state of the order executed immediately before and having function calculating the generation time of an event and calculating the difference between the measured value and the value stored in the register are mounted. The first order measures the generation time of the first event and the second order measures the generation time of the second event and this measured value and the measured result of the first order are used to measure a time interval. The result of the event generated time mea sured is stored in the register and a flag is set corresponding to a measuring state by the first order and the difference between the measured value and the register memory value is calculated corresponding to the flag state.

Description

【発明の詳細な説明】 [発明の目的] (産業上の利用分野) 本発明は入力パルスの計測を行なうパルス入力装置、特
に入力パルスの変化時刻、パルス周期など、パルスの時
間間隔を中央処理装置に頼らず算出しうるパルス入力装
置に関するものである。
[Detailed Description of the Invention] [Objective of the Invention] (Industrial Field of Application) The present invention relates to a pulse input device that measures input pulses, and in particular, to central processing of pulse time intervals such as input pulse change times and pulse periods. This invention relates to a pulse input device that can perform calculations without depending on the device.

(従来の技術) 入力パルスの計測を行い、その結果を中央処理装置で処
理するためのパルス入力装置は、各種機器の状態検出装
置として、これらの機器の制御装置とともに広く用いら
れている。これらの装置の機能は、入力信号の変化した
時刻やパルス幅、周期等の時間間隔の測定を行なうもの
であるが、この種のパルス入力装置として、例えば特願
昭62−132215号に開示されたような技術が知ら
れている。
(Prior Art) Pulse input devices for measuring input pulses and processing the results in a central processing unit are widely used as state detection devices for various devices, together with control devices for these devices. The function of these devices is to measure time intervals such as the time when an input signal changes, pulse width, period, etc. As this type of pulse input device, for example, there is a device disclosed in Japanese Patent Application No. 132215/1982. Similar techniques are known.

第4図は上記従来技術によるパルス入力装置の構成を示
す。同図で、点線で示したブロックがパルス入力装置4
01であり、バス402を介してCPU (中央処理装
置)403と接続されている。
FIG. 4 shows the configuration of the pulse input device according to the above-mentioned prior art. In the same figure, the block indicated by the dotted line is the pulse input device 4.
01 and is connected to a CPU (central processing unit) 403 via a bus 402.

パルス入力装置は、外部から複数の入力信号404が与
えられ、命令メモリ405中に書かれたCP0403か
らの命令に基づいて処理を進める。
The pulse input device receives a plurality of input signals 404 from the outside and proceeds with processing based on instructions from the CP0403 written in the instruction memory 405.

そして、結果を同じく命令メモリに書き込むことにより
、CPUに対して入力パルスの計測結果を知らせる。パ
ルス入力装置には、命令を実行するための基本要素とし
て、基準となる時刻情報を発生するタイマカウンタ40
6、入力信号を周期的にサンプルする入力回路407、
サンプルした入力信号をしばらくの間蓄えて置くための
入力メモリ408、そして命令実行に必要な処理を順次
実行してパルス入力装置全体を制御する命令実行部40
9から構或されている。
Then, by writing the result into the instruction memory, the CPU is informed of the measurement result of the input pulse. The pulse input device includes a timer counter 40 that generates reference time information as a basic element for executing instructions.
6. Input circuit 407 that samples the input signal periodically;
An input memory 408 for storing sampled input signals for a while, and an instruction execution unit 40 that sequentially executes processes necessary for executing instructions to control the entire pulse input device.
It is composed of 9.

入力回路407では、入力信号を所定の周期でサンプル
し、入力メモリ408に伝える。前記所定の周期は、通
常、タイマカウンタ406が更新される周期と一致して
おり、クロックを分周して作られたサンプルクロックに
より、入力信号がサンプルされるようになっている。
The input circuit 407 samples the input signal at a predetermined period and transmits it to the input memory 408. The predetermined period usually coincides with the period at which the timer counter 406 is updated, and the input signal is sampled by a sample clock created by frequency-dividing the clock.

また、入力メモリ407は、FIFOと同様の機能を持
っており、新しい入力信号を保持するとともに古い入力
信号を消去する、すなわち情報を更新することができる
。従って、入力信号を保持す−る期間は一定である。保
持されたデータは、命令実行部409からチャネル単位
で読み出される。
Further, the input memory 407 has a function similar to that of a FIFO, and can hold new input signals and erase old input signals, that is, update information. Therefore, the period during which the input signal is held is constant. The held data is read out from the instruction execution unit 409 in units of channels.

つまり、データが入力されると読み出され、命令で指定
されるイベント(事象)の検出がなされる。
That is, when data is input, it is read out and an event specified by a command is detected.

たとえば、チャネル3の入力信号の立ち上がり変化時刻
を求める時は、入力メモリ408に蓄えられたチャネル
3の入力履歴を一括して読み出し、立ち上がりの変化が
発生した部分を調べる。更に入力メモリ407は、FI
FO(ファーストイン、ファーストアウト)の構成をと
り、一定周期で更新されるので、変化が生じた部分を調
べることにより、その変化がどの位前に生じたかを知る
ことができる。その変化の値と現在のタイマ値を用いて
、そのイベントの発生時刻を求めることができる。
For example, to find the time of change in the rise of the input signal of channel 3, the input history of channel 3 stored in the input memory 408 is read out all at once, and the portion where the change in the rise has occurred is examined. Furthermore, the input memory 407
It has a FO (first in, first out) configuration and is updated at regular intervals, so by checking the part where a change occurred, it is possible to know how long ago the change occurred. Using the change value and the current timer value, the time at which the event occurred can be determined.

命令メモリ405は、CPU403がパルス入力装置4
01に求める計測内容として、検出すべきイベントの入
力チャネル番号、信号変化の極性(立ち上がり、立ち下
がり)などが指定された命令を複数個格納できる。また
、命令を実行した結果である信号変化の時刻情報などは
、同じく命令メモリ405の所定の位置に書き込まれる
。一方、CPU403は、パルス入力装置401に割り
込みを発生させたり、また、コマンドメモリの内容を定
期的に監視することにより、どのような順序で起こるか
分からない複数のイベントの時刻を正確に知ることがで
きる。
The instruction memory 405 is configured so that the CPU 403 is connected to the pulse input device 4
A plurality of commands can be stored in which the input channel number of the event to be detected, the polarity of signal change (rising, falling), etc. are specified as the measurement content required for 01. Additionally, time information of signal changes, which is the result of executing the command, is similarly written to a predetermined location in the command memory 405. On the other hand, the CPU 403 generates an interrupt in the pulse input device 401 and periodically monitors the contents of the command memory to accurately know the times of multiple events that occur in an unknown order. I can do it.

命令実行部409は、命令メモリ405の先頭から順に
命令を読み出して実行していき、該命令メモリの最後尾
の命令実行を終了すると再度命令メモリの先頭の命令を
実行する。このように、命令実行部409は、該命令メ
モリ内の命令を順に繰り返し実行している。命令メモリ
の空き領域には後述するNOP命令を書き込んでおく。
The instruction execution unit 409 sequentially reads and executes instructions from the beginning of the instruction memory 405, and after finishing executing the instruction at the end of the instruction memory, executes the instruction at the beginning of the instruction memory again. In this way, the instruction execution unit 409 repeatedly executes the instructions in the instruction memory in order. A NOP instruction, which will be described later, is written in a free area of the instruction memory.

また、指定されたイベント測定がおこなわれ、再度測定
を実行する必要のない命令も順に実行される。この場合
、その命令はNOP命令と同様に処理される。
Further, the specified event measurement is performed, and instructions that do not require re-execution of measurement are also executed in order. In this case, the instruction is processed similarly to a NOP instruction.

なお、通常、各命令は、一度実行されてから再度実行す
るまでの時間が一定になるように設計されており、その
時間は、入力メモリ408の入力信号保持時間と同じに
なるようにつくられている。
Note that each instruction is normally designed so that the time from when it is executed once to when it is executed again is constant, and that time is designed to be the same as the input signal retention time of the input memory 408. ing.

(発明が解決しようとする課題) ところで、入力信号の周期、パルス幅、位相差など、時
間間隔の測定を行なうに当りパルス入力装置で測定した
変化時刻をもとに、ホストCPUで所望の時間間隔を求
めることが可能ではあるが、処理速度及びホストCPU
の負荷の増大等から好ましくない。
(Problem to be Solved by the Invention) By the way, when measuring time intervals such as the cycle, pulse width, and phase difference of an input signal, the host CPU calculates the desired time based on the change time measured by the pulse input device. Although it is possible to determine the interval, processing speed and host CPU
This is undesirable because it increases the load on the machine.

また、時間間隔を連続的に測定する場合は、さらに重大
な問題が生じる。すなわち、例えば、第5図に示す入力
信号の正パルス幅を測定する場合を考える。CPUは、
イベント1とイベント2の測定結果から正パルス幅を算
出する。図中A部分は、パルス入力装置がその算出に必
要な時刻データを保持している期間を示す。入力信号が
′ 0゛の期間が短くなるとホストCPUでの正パルス
幅の算出は不可能になる。
An even more serious problem arises when measuring time intervals continuously. That is, for example, consider the case where the positive pulse width of the input signal shown in FIG. 5 is measured. The CPU is
The positive pulse width is calculated from the measurement results of event 1 and event 2. Part A in the figure shows the period during which the pulse input device holds time data necessary for its calculation. If the period during which the input signal is '0' becomes short, it becomes impossible for the host CPU to calculate the positive pulse width.

また、ホストCPUからイベント1の測定結果を読み出
してからイベント2の測定結果を読み出すまでにある程
度の時間がかかる。その間に新しい測定が行なわれ、イ
ベント3の測定結果が更新されてしまうことが生じる可
能性がある。この場合、ホストCPUは、実際の時間間
隔よりも大きい値を時間間隔の測定値としてしまう。こ
のようなことを避けるために、制御対象の入力信号の性
質及びパルス入力装置の測定タイミング等を十分考慮し
てホストCPUのプログラムを作成する必要があり、使
用者の負担は重い。また、入力信号の性質によっては、
上記の問題を解決できない場合もある。この問題を解決
するためには、パルス入力装置に時間間隔の算出を行な
う機能を付ければよい。
Further, it takes a certain amount of time from reading out the measurement results of event 1 to reading out the measurement results of event 2 from the host CPU. In the meantime, there is a possibility that a new measurement will be performed and the measurement result of event 3 will be updated. In this case, the host CPU uses a value larger than the actual time interval as the measured value of the time interval. In order to avoid such a situation, it is necessary to create a program for the host CPU with due consideration given to the nature of the input signal to be controlled, the measurement timing of the pulse input device, etc., which places a heavy burden on the user. Also, depending on the nature of the input signal,
In some cases, the above problems cannot be resolved. In order to solve this problem, a function for calculating time intervals may be added to the pulse input device.

従来のパルス入力装置に周期、パルス幅、位相差などの
時間間隔の測定を行なう命令を加えた場合、以下の3つ
の問題が生じる。
When commands for measuring time intervals such as period, pulse width, and phase difference are added to a conventional pulse input device, the following three problems arise.

第1の問題は、1つの命令が必要とするビット幅が広く
なってしまうことである。例えば、入力信号の変化時刻
を測定する命令では、測定するチャネルを示すフィール
ドと極性を示すフィールドを1組持てば良い。しかし、
時間間隔の測定を指示する命令では、2組持つ必要があ
る。フィールド長を短縮するためにコード化を進めれば
、命令をデコードするための回路が複雑になり命令実行
時間が増大する。
The first problem is that the bit width required by one instruction becomes wide. For example, a command to measure the change time of an input signal only needs to have one field indicating the channel to be measured and one field indicating the polarity. but,
An instruction that instructs to measure a time interval requires two sets. If the encoding is advanced to shorten the field length, the circuit for decoding the instructions becomes complicated and the instruction execution time increases.

第2の問題は、時間間隔測定命令には、1番目のイベン
トが生じた時刻を格納しておくメモリが必要になる。例
えば、正パルスの幅を測定する命令を作成した場合、第
1のイベント(立ち上がり変化)の発生時刻を格納する
メモリを用意する必要がある。第1のイベントが発生し
てから第2のイベント(立ち下がり変化)が発生するま
での時間は予測不可能なので、上記の格納メモリは任意
の時間そのイベントを格納できなければならない。
The second problem is that the time interval measurement command requires memory to store the time when the first event occurs. For example, when creating an instruction to measure the width of a positive pulse, it is necessary to prepare a memory that stores the time at which the first event (rising edge change) occurs. Since the time between the occurrence of the first event and the occurrence of the second event (falling transition) is unpredictable, the storage memory described above must be able to store the event for an arbitrary amount of time.

そのため、第1のイベント発生時刻を格納するメモリを
設ける必要がある。したがって、汎用的なパルス入力装
置を・提供するためには、命令メモリに設定できる命令
の数と同数の格納用メモリを設定することが必要となる
。しかし、この格納用メモリは、変化時刻の測定のみ行
なう命令では使用されないものであるので、時間間隔の
測定を行なわないユーザにとっては全く無駄なメモリと
なってしまう。
Therefore, it is necessary to provide a memory for storing the first event occurrence time. Therefore, in order to provide a general-purpose pulse input device, it is necessary to set the same number of storage memories as the number of commands that can be set in the command memory. However, since this storage memory is not used by an instruction that only measures change times, it becomes a completely useless memory for users who do not measure time intervals.

第3の問題は、時間間隔測定命令の実行時間が長くなっ
てしまうことである。例えば、メモリアクセスの回数を
考える。単純な変化時刻の測定命令では、命令の読み出
しと測定結果の格納のために、命令メモリを2回アクセ
スし、入力メモリを1回アクセスする必要がある。した
がって、時間間隔測定命令では、2回の命令メモリアク
セスと、2つのイベントを検出するため2回の入力メモ
リアクセスが必要になる。命令実行部で行なう処理にお
いても、明らかに時間間隔測定命令の方が多くなってし
まう。
The third problem is that the execution time of the time interval measurement command becomes long. For example, consider the number of memory accesses. A simple change time measurement command requires accessing the command memory twice and the input memory once in order to read the command and store the measurement result. Therefore, the time interval measurement instruction requires two instruction memory accesses and two input memory accesses to detect two events. Even in the processing performed by the instruction execution unit, the number of time interval measurement instructions clearly increases.

したがって本発明は、時間間隔の測定に適した命令セッ
ト、すなわち命令のコード長が短かく、デコードが容易
な命令セットを用意すると共にパルス入力装置が有して
いる既設のメモリが有効に利用でき、かつ各命令の処理
がしやすいパルス入力装置を提供することを目的として
いる。
Therefore, the present invention provides an instruction set suitable for measuring time intervals, that is, an instruction set that has a short instruction code length and is easy to decode, and also enables effective use of the existing memory of the pulse input device. It is an object of the present invention to provide a pulse input device that can easily process each command.

〔発明の構成] (課題を解決するための手段) 上述した問題点を解決するために本発明では、時間間隔
の測定を連続して実行される命令メモリ上のアドレスに
記憶された2つの命令を用いて実現する構成としている
。そして第1の命令は、第1イベントの発生時刻を測定
する。第2の命令は、第2イベントの発生時刻を測定し
、その測定値と第1の命令の測定結果とを用いて時間間
隔を測定する。
[Structure of the Invention] (Means for Solving the Problems) In order to solve the above-mentioned problems, the present invention provides two instructions stored at addresses on an instruction memory that are successively executed to measure a time interval. The configuration is implemented using . The first instruction then measures the time of occurrence of the first event. The second instruction measures the time of occurrence of the second event, and uses the measured value and the measurement result of the first instruction to measure the time interval.

この機能を実行するために、本発明においては命令実行
部に、直前に実行した命令の測定結果を格納する少なく
とも1つのレジスタと、直前に実行した命令の測定状況
を示す少なくとも1つのフラグを付加すると共に、イベ
ントの発生時刻を算出する機能、および測定値とレジス
タに格納された値との差を算出する手段を備えている。
In order to perform this function, the present invention adds at least one register that stores the measurement result of the most recently executed instruction and at least one flag that indicates the measurement status of the most recently executed instruction to the instruction execution unit. In addition, it has a function of calculating the time when an event occurs, and a means of calculating the difference between the measured value and the value stored in the register.

このようにして測定されたイベント発生時刻の結果が上
記のレジスタに格納され、第1の命令により測定状況に
応じて上記フラグのセットを行ない、第2の命令により
上記フラグの状態に応じて、該測定値と上記レジスタ格
納値の差を求めるようにしている。
The result of the event occurrence time measured in this way is stored in the above register, the first instruction sets the above flag according to the measurement situation, and the second instruction sets the above flag according to the state of the flag. The difference between the measured value and the value stored in the register is determined.

(作用) 本発明の如き構戊により、測定した第1のイベントを格
納するメモリは、命令メモリのメモリ領域を利用でき、
このメモリ領域は時間間隔の測定を行なわない場合には
、変化時刻の測定結果を格納するのに用いることができ
るので、特別なメモリ領域を必要としない。
(Function) With the structure of the present invention, the memory for storing the measured first event can use the memory area of the instruction memory,
This memory area can be used to store measurement results of change times when time intervals are not measured, so a special memory area is not required.

また、時間間隔測定に用いる第1および第2の2つの命
令は、それぞれ、1つのイベントを指定するフィールド
と、測定する時間間隔の最初のイベントを測定するか後
のイベントを測定するかを指定するフィールドがあれば
良い。従って、それぞれの命令のコード長は、従来の時
刻測定命令と等しく出来るので、コード長が短くデコー
ドが容易な命令セットを実現できる。
The first and second instructions used for time interval measurement each have a field for specifying one event and a field for specifying whether to measure the first event or a later event in the time interval to be measured. It would be nice if there was a field to do so. Therefore, the code length of each instruction can be made equal to that of the conventional time measurement instruction, so it is possible to realize an instruction set with a short code length and easy decoding.

(実施例) 次の本発明の実施例につき添付図而を参照して説明する
(Example) The following example of the present invention will be described with reference to the attached drawings.

第1図は本発明によるパルス入力装置の命令実行部40
9の構戊を示す。該パルス入力装置を構成する他の構成
要素については、第4図に示すものと同じであるので省
略する。
FIG. 1 shows a command execution unit 40 of a pulse input device according to the present invention.
This shows the structure of 9. The other components constituting the pulse input device are the same as those shown in FIG. 4, and therefore will be omitted.

第1図において、命令実行部409は第1の減算器11
1、第2の減算器1第2、検証回路113、■レジスタ
114、およびRレジスタ115で構或されている。更
に、図示してないが前記2つのレジスタに関連してVフ
ラグおよびRフラグが設けられている。
In FIG. 1, the instruction execution unit 409 includes the first subtracter 11
1, a second subtracter 1, a verification circuit 113, a register 114, and an R register 115. Further, although not shown, a V flag and an R flag are provided in association with the two registers.

信号102は、第4図に示した入力メモリ407からの
信号であり、測定するイベントが検出された場合、その
イベントがどのくらい前に発生したかを示している。信
号101は、タイマカウンタ406からの信号である。
Signal 102 is a signal from input memory 407 shown in FIG. 4 and indicates how long ago the event to be measured occurred, if detected. Signal 101 is a signal from timer counter 406.

信号104は、命令実行による測定値を命令メモリ40
5の所定のメモリ領域に格納するための信号である。
A signal 104 sends a measured value due to instruction execution to the instruction memory 40.
This is a signal for storing in a predetermined memory area of No. 5.

本発明にかかるパルス入力装置の命令実行部409は、
入力信号のイベント発生時刻を減算器111を用いて算
出する。前述した様に、信号102はイベントがどのく
らい前に発生したかを示している。従って、信号101
のタイマカウンタ値から信号102の値を減算する事に
よりイベントの発生時刻を算出する。この値を減算器1
11から信号103として出力し、さらに減算器1第2
をスルーさせて信号104として出力する。このスルー
機能は、減算器1第2の片方のオペランドとして、ゼロ
を入力する事により容易に実現できる。このように、本
発明によるパルス入力装置の命令実行部409は、イベ
ント発生時刻の測定機能を実現している。
The command execution unit 409 of the pulse input device according to the present invention includes:
The event occurrence time of the input signal is calculated using the subtracter 111. As previously mentioned, signal 102 indicates how long ago the event occurred. Therefore, signal 101
The time at which the event occurs is calculated by subtracting the value of the signal 102 from the timer counter value. Subtractor 1
11 as a signal 103, and further subtracter 1 second
is passed through and output as a signal 104. This through function can be easily realized by inputting zero as one of the second operands of the subtracter 1. In this way, the command execution unit 409 of the pulse input device according to the present invention realizes the function of measuring the event occurrence time.

本発明によるパルス入力装置では、第1の命令の測定結
果を第2の命令で用いる。そのために、第1の命令によ
る測定結果を格納するレジスタとして、Rレジスタ11
5とVレジスタ114を命令実行部409内に設けた。
In the pulse input device according to the present invention, the measurement result of the first command is used in the second command. For this purpose, the R register 11 is used as a register to store the measurement result according to the first instruction.
5 and V register 114 are provided in the instruction execution unit 409.

第1の命令実行時に命令の読み出しと同時に、測定結果
を格納するメモリ領域を読み出しRレジスタに洛納する
。従って、その時点よりも前に、第1の命令の測定がな
されていたらその測定結果がRレジスタに格納されるこ
とになる。また、第1の命令の実行終了時に、その測定
結果を命令メモリ405の所定のフィールドに格納する
とともに、■レジスタ114にも格納する。
When the first instruction is executed, the memory area for storing the measurement results is read out and stored in the R register at the same time as the instruction is read out. Therefore, if the first instruction has been measured before that point, the measurement result will be stored in the R register. Further, at the end of execution of the first instruction, the measurement result is stored in a predetermined field of the instruction memory 405 and also stored in the ■register 114.

次に、フラグの動作について説明する。本パルス入力装
置は、前述のようにRフラグとVフラグという2種類の
フラグを持っており、フラグのセットは、第lの命令実
行時のみ行なう。他の命令の実行では、常に終了時にも
フラグをリセットする。
Next, the operation of the flag will be explained. As described above, this pulse input device has two types of flags, the R flag and the V flag, and the flags are set only when the 1st instruction is executed. Execution of other instructions always resets the flag on completion as well.

これらのフラグは、それぞれ、Rレジスタ及びVレジス
タに第1の命令の測定値が格納されているか否かを示す
ために用いる。第1の命令の実行時に命令メモリ405
から読み出した測定結果を格納するメモリ領域に測定値
が格納されていた場合は、Rフラグがセットされる。格
納されてぃながった場合は、このフラグはセットされな
い。この判定は、測定結果を格納するメモリ領域に測定
値が格納されているか否かを示すビットを命令の特定フ
ィールドに設ければ、容易に行える。第1の命令の実行
時に、第1のイベントの発生時刻が測定された場合は、
■フラグがセットされる。本パルス入力装置のフラグは
上記のようにセットされるので、その直後に実行される
第2の命令では、Rレジスタ115とVレジスタ114
に第1の命令の測定結果が格納されているか否かを判定
することができる。
These flags are used to indicate whether the measured value of the first instruction is stored in the R register and the V register, respectively. When the first instruction is executed, the instruction memory 405
If the measured value is stored in the memory area that stores the measured result read from the , the R flag is set. This flag will not be set if it has not been stored. This determination can be easily made by providing a bit in the specific field of the instruction that indicates whether or not the measurement value is stored in the memory area for storing the measurement result. If the occurrence time of the first event is measured when the first instruction is executed,
■A flag is set. Since the flag of this pulse input device is set as described above, in the second instruction executed immediately after, the R register 115 and the V register 114 are
It can be determined whether the measurement result of the first instruction is stored in the first instruction.

第1の命令で、第1イベントの発生時刻が測定され、続
いて実行した第2命令で、第2イベントが検出されるこ
とがある。本発明のパルス入力装置は、入力メモリに蓄
えた入力信号を調べることによりイベントを検出するの
で、第1イベントよりも前に発生した第2イベントを検
出してしまう可能性がある。そのため、その第2イベン
トが、第1イベントよりも後に発生したか否かを知る必
要がある。したがって、そのために検証回路l13が設
けられている。実行中の第2の命令が検出したイベント
が新しければ、出力信号106として゜ 1゜を出力す
る。
The first instruction may measure the time of occurrence of the first event, and the subsequently executed second instruction may detect the second event. Since the pulse input device of the present invention detects an event by checking the input signal stored in the input memory, there is a possibility that a second event occurring before the first event will be detected. Therefore, it is necessary to know whether the second event occurred after the first event. Therefore, a verification circuit l13 is provided for this purpose. If the event detected by the second instruction being executed is new, 1 degree is output as the output signal 106.

本実施例に示すパルス入力装置の命令は、大きく分けて
次の4種類である。すなわち、NOP,EDGE,WI
DTH,WIDTHPがこれである。NOP命令は何も
しない命令であり、命令メモリ405の空き領域に書き
込んでおく。EDGE命令は、イベントの変化時刻を測
定するための命令であり、また、時間間隔測定の第1の
命令としても用いる。本実施例では、特に不都合は生じ
ないので、単なる変化時刻測定命令と時間間隔測定の第
1の命令とを同一命令に設定している。WI DTHと
WIDTHPは、時間間隔測定の第2の命令として用い
る。WIDTHPは、周期測定の第2の命令として用い
る。WIDTHは、パルス幅及び位相差測定の第2の命
令として用いる。
The commands of the pulse input device shown in this embodiment are roughly divided into the following four types. That is, NOP, EDGE, WI
These are DTH and WIDTHP. The NOP instruction is an instruction that does nothing, and is written into an empty area of the instruction memory 405. The EDGE command is a command for measuring the change time of an event, and is also used as the first command for time interval measurement. In this embodiment, since no particular inconvenience occurs, the simple change time measurement command and the first time interval measurement command are set as the same command. WI DTH and WIDTHP are used as the second command for time interval measurement. WIDTHP is used as the second command for period measurement. WIDTH is used as the second command for pulse width and phase difference measurements.

これらの命令の基本フォーマットを第2図に示す。命令
は固定長であり、下位ビットは、測定結果を格納するフ
ィールドにあてられている。フィールド201は、4種
類の命令のそれぞれを指定するものであるので、フィー
ルド201は2ビットあればよい。フィールド202は
、測定する入力チャネルを指定する。フィールド203
は、測定する変化の極性(立ち上がりまたは立ち下がり
)を示す。フィールド204は、指定した測定が実行さ
れたか否かを示すフィールドである。ホストCPU40
3は、このフィールドを調べることにより測定結果格納
フィールドに測定値が格納されているか否かを判定でき
る。フィールド206は、測定結果が得られたら割り込
みパルスを発生するか否か、測定を連続して行なうか否
かを指定するものである。
The basic format of these instructions is shown in FIG. The instructions are of fixed length, and the lower bits are dedicated to fields that store measurement results. Since field 201 specifies each of the four types of instructions, field 201 only needs to have 2 bits. Field 202 specifies the input channel to measure. field 203
indicates the polarity (rising or falling) of the change being measured. Field 204 is a field that indicates whether the specified measurement has been performed. host CPU40
3 can determine whether a measured value is stored in the measurement result storage field by checking this field. Field 206 specifies whether or not to generate an interrupt pulse when a measurement result is obtained, and whether or not to perform measurements continuously.

フラグによる時間間隔の測定について説明する。Measurement of time intervals using flags will be explained.

時間間隔の測定は、第1の命令と第2の命令とを連続し
て実行するように命令メモリ405に設定することによ
り行なう。第1の命令として、EDGE命令を用いる。
The time interval is measured by setting the first command and the second command in the command memory 405 to be executed consecutively. The EDGE instruction is used as the first instruction.

該EDGE命令の実行終了時には、その測定結果が命令
実行部409内のRレジスタ115及び■レジスタ11
4に書き込まれており、その測定状況がRフラグとVフ
ラグに設定されている。第1の命令と第2の命令は、連
続して実行されるので、第2の命令実行開始時点では、
Rレジスタ115、■レジスタ114、Rフラグ及びV
フラグには、第1の命令終了時の状態が保持されている
。第2の命令の実行時に、あるイベントが検出されれば
、その発生時刻を減算器111を用いて算出し、Rフラ
グとVフラグを用いてRレジスタ115とVレジスタ1
14のうち適当な方を選択し、減算器1第2を用いて時
間間隔の算出をする。以上が時間間隔測定の概略である
。2つのフラグの内容によっては、第2イベントが検出
されても時間間隔の算出は行なわないこともある。
When the execution of the EDGE instruction ends, the measurement results are stored in the R register 115 and the ■ register 11 in the instruction execution unit 409.
4, and its measurement status is set in the R flag and V flag. Since the first instruction and the second instruction are executed consecutively, at the start of execution of the second instruction,
R register 115, ■ register 114, R flag and V
The flag holds the state at the end of the first instruction. When a certain event is detected during execution of the second instruction, the time of occurrence is calculated using the subtracter 111, and the R register 115 and V register 1 are calculated using the R flag and the V flag.
14, and calculate the time interval using subtracter 1 and 2. The above is an outline of time interval measurement. Depending on the contents of the two flags, the time interval may not be calculated even if the second event is detected.

第2イベントを検出した時に、フラグ内容及び検証回路
の出力信号106の値により、第2の命令の処理がどの
様に行なわれるかを第3図(a)(b)に示す。
FIGS. 3(a) and 3(b) show how the second command is processed based on the contents of the flag and the value of the output signal 106 of the verification circuit when the second event is detected.

検証回路113からの信号106は、検出したイベント
が直前に実行された第1の命令で検出した第1イベント
以後に発生したものであれば゜ 1゜を出力する。直前
に実行した第1の命令の測定結果は、■レジスタ114
に格納されている。従って、信号106が゜ 0′の時
は、第1イベントの発生時刻として、■レジスタ114
に格納された値を用いることはない。
The signal 106 from the verification circuit 113 outputs ゜1゜ if the detected event has occurred after the first event detected by the first instruction executed immediately before. The measurement result of the first instruction executed immediately before is stored in the register 114.
is stored in. Therefore, when the signal 106 is 0', the register 114 is set as the time of occurrence of the first event.
The value stored in is never used.

第3図(a)は、周期測定の第2の命令であるWIDT
HP命令の処理内容を示している。周期測定においては
、第1の命令の指定するイベントと第2の命令の指定す
るイベントは、全く同じ種類(同一チャネル、同一局性
のイベント)となっている。この場合、WIDTHP実
行時に検出したイベントは、その直前に実行した第1の
命令でも検出されており、その発生時刻はVレジスタ1
14にも格納されているが、第1イベントの発生時刻と
して、WIDTHPで検出したイベントよりも古いイベ
ントの発生時刻の格納されたRレジスタ115の内容を
用いる。
FIG. 3(a) shows the second command for period measurement, WIDT.
It shows the processing content of the HP command. In period measurement, the event specified by the first command and the event specified by the second command are of exactly the same type (same channel, same locality event). In this case, the event detected when WIDTHP was executed was also detected in the first instruction executed immediately before, and its occurrence time is recorded in the V register 1.
As the occurrence time of the first event, the content of the R register 115, which stores the occurrence time of an event older than the event detected by WIDTHP, is used.

第3図(b)は、WIDTH命令の処理内容を示す。■
フラグが゜ 1゜の時は、直前の第1の命令の実行にお
いて第1イベントが検出され、その測定値がVレジスタ
114に格納されていることを示している。この場合は
、信号106により、■レジスタ114に格納されたイ
ベントが、検出した第2イベント以前に発生したか否か
を判断する。第2イベント以前に発生したイベントであ
る時、すなわち、信号106が゜ 1゛の時、■レジス
タ114の内容を用いて求める時間間隔を算出する。信
号106が゛0゛でRフラグが゜1゛の時は、Rレジス
タ115の内容を用いて時間間隔を算出する。
FIG. 3(b) shows the processing contents of the WIDTH command. ■
When the flag is 1°, it indicates that the first event was detected in the execution of the immediately preceding first instruction, and its measured value is stored in the V register 114. In this case, it is determined based on the signal 106 whether the event stored in the register 114 has occurred before the detected second event. When the event occurs before the second event, that is, when the signal 106 is 1, the content of the register 114 is used to calculate the time interval. When the signal 106 is "0" and the R flag is "1", the time interval is calculated using the contents of the R register 115.

また、Rフラグのみ゛ 1゜であるときは、Rレジスタ
115の内容を用いて時間間隔を算出する。
Further, when only the R flag is "1", the time interval is calculated using the contents of the R register 115.

■フラグが゛ 1゜であり、信号106が゜ 1゜の時
は、■レジスタ114の内容を利用する。
■When the flag is 1° and the signal 106 is 1°, the contents of the register 114 are used.

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

以上、本発明の実施例を述べてきたが、本発明によるパ
ルス入力装置は、入力パルスの時間間隔測定を行なうに
際し、複数の入力信号を同時に取り込み、一度人カメモ
リに蓄え、入力メモリをチャネルごとに読み出し、イベ
ントの発生時刻を計測するという構成を取るため、複数
のイベントが短い時間内に集中して発生した場合などで
も、取り逃すことがない。
The embodiments of the present invention have been described above, and when measuring the time interval of input pulses, the pulse input device according to the present invention simultaneously captures a plurality of input signals, stores them once in the human memory, and stores the input signals for each channel. Since the system uses a configuration in which the data is read out and the time at which the event occurs is measured, even if multiple events occur in a concentrated manner within a short period of time, no event will be missed.

また、本発明によるパルス入力装置においては、時間間
隔測定時に必要な第1イベントの測定結果を格納するメ
モリは、命令メモリの測定結果を格納するメモリ領域を
用いることができるので該メモリ領域は、時間間隔測定
を必要としない場合には、変化時刻の測定結果を格納す
ることにも用いることができる。従って、時間間隔測定
用の新たなメモリ領域を必要とせず、メモリが柔軟に利
用できる。
Further, in the pulse input device according to the present invention, the memory for storing the measurement results of the first event necessary for time interval measurement can use the memory area for storing the measurement results of the command memory, so that the memory area can be If time interval measurement is not required, it can also be used to store measurement results of change times. Therefore, there is no need for a new memory area for time interval measurement, and memory can be used flexibly.

更に、本発明に用いられる命令セットは、それらのビッ
トパターンが比較的単純な型式となっているので該命令
をデコードするデコード回路も小規模なもので済む。ま
た、本発明においては、第1イベントを測定する第1の
命令および第2イベントを測定する第2の命令によるメ
モリアクセスは、命令メモリに対しては2回、入力メモ
リに対しては1回というように、アクセス回数が少ない
ので命令の実行時間が短かくかつ一定している。
Furthermore, since the instruction set used in the present invention has a relatively simple bit pattern, the decoding circuit for decoding the instructions can also be small-scale. Furthermore, in the present invention, memory accesses by the first instruction for measuring the first event and the second instruction for measuring the second event are performed twice to the instruction memory and once to the input memory. Since the number of accesses is small, the instruction execution time is short and constant.

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

第1図は本発明によるパルス入力装置内の命令実行部の
構成を示す図、 第2図は本発明の装置において用いられる命令フォーマ
ット図、 第3図(a)は第2の命令であるWIDTHP命令の処
理内容を示す図、 第3図(b)は第2の命令であるWI DTH命令の処
理内容を示す図、 第4図は従来のパルス入力装置の全体の構成図、第5図
は従来のパルス入力装置で測定する場合の不都合なパル
ス入力信号の状態を説明する図、をそれぞれ示す。 401・・・パルス入力装置、 402・・・バス、 Φ403・・・CPU (中央処理装置)、405・・
・命令メモリ、 406・・・タイマカウンタ、 407・・・入力回路、 408・・・入力メモリ、 409・・・命令実行部、 111および1第2・・・減算器、 113・・・検証回路、 114・・・Vレジスタ、 115・・・Rレジスタ。 第3図 (a) 注) はdon’ t cure 第3図(b)
FIG. 1 is a diagram showing the configuration of an instruction execution unit in a pulse input device according to the present invention, FIG. 2 is an instruction format diagram used in the device according to the present invention, and FIG. 3(a) is a diagram showing the second instruction WIDTHP. Figure 3(b) is a diagram showing the processing content of the second command, WI DTH command, Figure 4 is an overall configuration diagram of a conventional pulse input device, and Figure 5 is a diagram showing the processing content of the command. Figures illustrating disadvantageous states of pulse input signals when measured with a conventional pulse input device are shown, respectively. 401...Pulse input device, 402...Bus, Φ403...CPU (central processing unit), 405...
・Instruction memory, 406...Timer counter, 407...Input circuit, 408...Input memory, 409...Instruction execution unit, 111 and 1 second...Subtractor, 113...Verification circuit , 114...V register, 115...R register. Figure 3 (a) Note: Don't cure Figure 3 (b)

Claims (1)

【特許請求の範囲】 システムクロックを計数して基準時刻情報を出力するタ
イマカウンタと、前記時刻情報と同期して複数チャンネ
ルからの入力信号を所定の周期でサンプリングする入力
回路と、サンプリングされた所定回数分の前記入力信号
を記憶する入力メモリと、複数の命令を主として記憶す
る命令メモリと、前記命令メモリを検索して前記複数の
命令を順序読み出して実行すると共に装置の全体的な動
作を制御する命令実行部を有するパルス入力装置におい
て、 前記命令実行部は、直前に実行した命令の変化時刻の測
定結果を格納する少なくとも1つのレジスタと、第1の
命令の実行時にその測定状況を示すフラグと、前記レジ
スタの内容と測定したイベントの発生時刻との時間差を
算出する減算手段とを備え、実行時にフラグのセットを
行ない入力信号の状態変化の発生時刻を測定する第1の
命令と、前記フラグの状態にしたがって前記レジスタの
内容と測定した状態変化時刻の値との差をとるように指
命する第2の命令とを予め用意し、該命令を前記命令メ
モリに記憶しておいてから第1の命令および第2の命令
を連続的に実行し、入力信号の時間間隔の測定を行なう
ようにしたことを特徴とするパルス入力装置。
[Claims] A timer counter that counts a system clock and outputs reference time information; an input circuit that samples input signals from a plurality of channels at a predetermined period in synchronization with the time information; an input memory that stores the input signals for the number of times; an instruction memory that mainly stores a plurality of instructions; and an instruction memory that searches the instruction memory to sequentially read and execute the plurality of instructions, and controls the overall operation of the device. In a pulse input device having an instruction execution unit, the instruction execution unit includes at least one register that stores a measurement result of a change time of an instruction executed immediately before, and a flag that indicates the measurement status at the time of execution of the first instruction. and a subtraction means for calculating the time difference between the contents of the register and the measured event occurrence time, a first instruction that sets a flag at the time of execution and measures the occurrence time of the state change of the input signal; Prepare in advance a second instruction that instructs to take the difference between the contents of the register and the measured state change time value according to the state of the flag, and store this instruction in the instruction memory. A pulse input device characterized in that a first command and a second command are executed continuously and a time interval of input signals is measured.
JP19265989A 1989-07-27 1989-07-27 Pulse input apparatus Pending JPH0357970A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19265989A JPH0357970A (en) 1989-07-27 1989-07-27 Pulse input apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19265989A JPH0357970A (en) 1989-07-27 1989-07-27 Pulse input apparatus

Publications (1)

Publication Number Publication Date
JPH0357970A true JPH0357970A (en) 1991-03-13

Family

ID=16294912

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19265989A Pending JPH0357970A (en) 1989-07-27 1989-07-27 Pulse input apparatus

Country Status (1)

Country Link
JP (1) JPH0357970A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007085933A (en) * 2005-09-22 2007-04-05 Agilent Technol Inc Frequency measuring technique and frequency measuring device
US8665670B2 (en) 2007-04-20 2014-03-04 The University Court Of The University Of St. Andrews Acoustic deterrence

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007085933A (en) * 2005-09-22 2007-04-05 Agilent Technol Inc Frequency measuring technique and frequency measuring device
US8665670B2 (en) 2007-04-20 2014-03-04 The University Court Of The University Of St. Andrews Acoustic deterrence

Similar Documents

Publication Publication Date Title
JPH055136B2 (en)
JP2806524B2 (en) Vector operation instruction issue control method
JPH0357970A (en) Pulse input apparatus
US7478258B2 (en) Identifying a processor in a multiprocessor system
JP2775830B2 (en) Instruction frequency measurement method
JPH0934754A (en) Instrument and method for measuring performance of program
JPH11212830A (en) Measuring device for performance of processor
RU2050588C1 (en) Method for control and debug of real-time programs and device for its implementation
JPS63269239A (en) Processor load measuring system
JPH0229457Y2 (en)
SU1322290A2 (en) Device for debugging programs
JPS61117633A (en) Capture ratio measuring system
JPH11102298A (en) Timer control method, and its circuit and program recording medium
JPH03282266A (en) Pulse input apparatus
SU1339569A1 (en) Device for forming interruption signal in program debugging
JPS62109140A (en) Tracing circuit for program processor
JPH02272647A (en) System for measuring execution time of program
JPS6239782B2 (en)
JPH0296848A (en) Method for measuring execution time of instruction
JPH02267648A (en) Detection system for memory access error
JPS6175937A (en) Electronic computer
JPH0368039A (en) Program passage address tracing device
JP2001014190A (en) Information processor
JPS61267143A (en) Information processor
JPH048823B2 (en)