JPH0767083B2 - Pulse counting method - Google Patents

Pulse counting method

Info

Publication number
JPH0767083B2
JPH0767083B2 JP62143800A JP14380087A JPH0767083B2 JP H0767083 B2 JPH0767083 B2 JP H0767083B2 JP 62143800 A JP62143800 A JP 62143800A JP 14380087 A JP14380087 A JP 14380087A JP H0767083 B2 JPH0767083 B2 JP H0767083B2
Authority
JP
Japan
Prior art keywords
pulse
output
register
processing device
counter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP62143800A
Other languages
Japanese (ja)
Other versions
JPS63306716A (en
Inventor
賢司 水井
真 神田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP62143800A priority Critical patent/JPH0767083B2/en
Publication of JPS63306716A publication Critical patent/JPS63306716A/en
Publication of JPH0767083B2 publication Critical patent/JPH0767083B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Manipulation Of Pulses (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)

Description

【発明の詳細な説明】 [概要] 本発明は、パルスをカウントするパルスカウンタのカウ
ント値を周期的に読取って処理を行う場合、エンドレス
方式で動作するカウンタのオーバーフローを記憶するレ
ジスタを設け、処理装置からの読取り指令により、パル
スカウンタの出力とレジスタの出力を読み出すと共にレ
ジスタをリセットすることにより、処理装置の障害発生
による周期的な読取りの中断があっても処理装置の動作
再開時に誤ったカウント値の読取りを防止するものであ
る。
DETAILED DESCRIPTION OF THE INVENTION [Outline] According to the present invention, when a count value of a pulse counter that counts pulses is periodically read and processed, a register that stores overflow of a counter that operates in an endless system is provided and processed. By reading the output of the pulse counter and the output of the register and resetting the register in response to a read command from the device, even if there is a periodic interruption of reading due to a failure of the processing device, an incorrect count is given when the operation of the processing device is restarted. It prevents reading the value.

[産業上の利用分野] 本発明は、センサや各種の変量を検出する装置からのパ
ルス出力をカウントして計測、制御等の処理を行う装置
におけるパルスカウント方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a pulse counting method in a device that counts pulse outputs from a sensor or a device that detects various variables and performs processing such as measurement and control.

[従来の技術] センサ等の各種設備からのパルス出力をカウントして計
測処理する装置において、処理装置が停電等により処理
ができない状態になった場合にもパルス入力のカウント
を継続して行うことが要求される場合が多い。
[Prior Art] In a device that counts and processes the pulse output from various equipment such as sensors, even if the processing device becomes incapable of processing due to a power failure or the like, continue to count the pulse input. Is often required.

この場合、従来はパルスカウンタのみをバッテリで給電
し、パルスのカウントを行い、復電時に処理装置がこの
カウンタの値を読取る方法が、一般に採用されている。
In this case, conventionally, a method has been generally adopted in which only the pulse counter is powered by a battery, pulses are counted, and the processor reads the value of the counter when power is restored.

従来のパルスカウント方式のブロック構成と動作説明図
を第3図に示す。
FIG. 3 shows a block configuration of a conventional pulse counting method and an operation explanatory diagram.

第3図の(1)と(4)において、30はパルスカウン
タ、31は処理装置、32はゲート回路、33は読取り信号、
34はパルスカウンタのカウント値の出力線(バス)を表
す。
In (1) and (4) of FIG. 3, 30 is a pulse counter, 31 is a processor, 32 is a gate circuit, 33 is a read signal,
Reference numeral 34 represents an output line (bus) for the count value of the pulse counter.

従来のパルスカウント方式としては、第3図の(1)に
示す読取りリセット方式と(4)に示すエンドレス方式
がある。
As a conventional pulse counting method, there are a read reset method shown in (1) and an endless method shown in (4) of FIG.

読取りリセット方式は第3図の(2)と(3)にしめす
ように、処理装置31からの読取り信号33が発生する毎に
ゲート回路32が開き、パルスカウンタ30のカウント値の
出力線34の信号が処理装置31に入力すると共にリセット
端子Rにも読取り信号33が与えられることにより、パル
スカウンタ30はリセットされる。
As shown in (2) and (3) of FIG. 3, the read reset method opens the gate circuit 32 each time a read signal 33 from the processing device 31 is generated, and outputs the count value output line 34 of the pulse counter 30. The pulse counter 30 is reset when the signal is input to the processing device 31 and the read signal 33 is also applied to the reset terminal R.

また、エンドレス方式は、第3図の(5)と(6)に示
すように、処理装置31からの読取り信号33が発生する毎
にゲート回路32が開き、パルスカウンタ30のカウント値
の出力線34の信号を処理装置31に供給する動作を行う点
は上記の読取りリセット方式と同じであるが、パルスカ
ウンタ30は読取り時にはリセットされずそのままカウン
トを継続し、最大カウント値を越えてオーバーフローし
た時に“0"に戻るものである。
In the endless system, as shown in (5) and (6) of FIG. 3, the gate circuit 32 opens every time the read signal 33 from the processing device 31 is generated, and the output line of the count value of the pulse counter 30 is output. The point that the operation of supplying the signal of 34 to the processing device 31 is performed is the same as the above read reset method, but the pulse counter 30 does not reset at the time of reading and continues counting as it is, and when it overflows beyond the maximum count value. It returns to "0".

[発明が解決しようとする問題点] 従来例の方式のうち、読取りリセット方式は、処理装置
が読込むたびにパルスカウンタをリセットするので、1
回読込んでから次の読込みまでのカウント値が直読でき
るという利点はあるが、カウント値の読込み中に処理装
置に停電等の異常状態が発生した場合には、処理装置が
読込んではいないのにカウンタのみリセットされるとい
う欠点があった。
[Problems to be Solved by the Invention] Among the conventional methods, the read reset method resets the pulse counter each time the processing device reads, so
There is an advantage that the count value from one reading to the next reading can be read directly, but if an abnormal state such as a power failure occurs in the processing unit while reading the count value, the processing unit is not reading. There was a drawback that only the counter was reset.

また、エンドレス方式は、停電等により処理装置が停止
し、カウンタのみが動作してカウンタが一周以上の値に
なってから復電した時、一周した分の値を読取れないこ
とが問題点となっている。例えば、8ビット=256をカ
ウントするパルスカウンタで、停電中に256以上のパル
スが入ってきた場合、復電した時このカウンタの出力を
読取っても、一周以上しているか否かが判定できないと
いう問題である。
In addition, the endless method has a problem that when the processor stops due to a power failure or the like and only the counter operates and the counter reaches a value of one cycle or more and then the power is restored, the value for one cycle cannot be read. Has become. For example, with a pulse counter that counts 8 bits = 256, if more than 256 pulses are input during a power failure, even if the output of this counter is read when the power is restored, it cannot be determined whether or not one cycle has been completed. It's a problem.

[問題点を解決するための手段] 本発明は、上記の問題点を解決するため、エンドレス方
式で動作するカウンタのオーバーフローを記憶するレジ
スタを設け、処理装置からの読取り信号により、パルス
カウンタの出力とレジスタの出力を読出すと共にレジス
タをリセットすることにより、処理装置の障害発生によ
る周期的な読取りの中断があっても処理装置の動作再開
時に誤ったカウント値の読取りを防止するものである。
[Means for Solving Problems] In order to solve the above problems, the present invention provides a register for storing overflow of a counter operating in an endless system, and outputs a pulse counter by a read signal from a processing device. By reading out the output of the register and resetting the register, even if there is a periodic interruption of the reading due to the occurrence of a failure in the processing device, an incorrect reading of the count value is prevented when the operation of the processing device is restarted.

本発明の原理的構成を第1図に示す。The principle structure of the present invention is shown in FIG.

第1図において、10はパルスカウンタ、11はレジスタ、
12,13はゲート回路、14は処理装置、15はパルスカウン
タの出力線、16はパルスカウンタのオーバーフロー出力
線、17はレジスタ11の出力線、18は読取り信号線を表
す。
In FIG. 1, 10 is a pulse counter, 11 is a register,
12, 13 are gate circuits, 14 is a processor, 15 is an output line of the pulse counter, 16 is an overflow output line of the pulse counter, 17 is an output line of the register 11, and 18 is a read signal line.

[作用] パルスカウンタ10は、パルス入力を受けてカウント動作
を行い、オーバーフローが生じると出力線16からレジス
タ11に供給され計数して記憶される。
[Operation] The pulse counter 10 receives a pulse input and performs a counting operation. When an overflow occurs, the pulse counter 10 is supplied to the register 11 from the output line 16 and counts and stores it.

処理装置14は,パルスカウンタ10のパルス入力をカウン
トして最大カウント値をカウントするのに要する時間よ
りも短い一定の周期で発生する読取り信号を読取り信号
線18に発生してゲート回路12,13を駆動し、ゲートを開
く。これにより、パルスカウンタ10とレジスタ11の出力
が夫々処理装置に入力され、処理装置において処理が行
われる。
The processing device 14 generates a read signal generated on the read signal line 18 at a constant period shorter than the time required to count the pulse input of the pulse counter 10 and count the maximum count value, and outputs the read signal to the gate circuits 12, 13 Drive and open the gate. As a result, the outputs of the pulse counter 10 and the register 11 are input to the processing device, and the processing is performed in the processing device.

また、この読取り動作と並行してレジスタ11は読取り信
号をリセット端子に受けてリセットされる。なお、実際
は、ゲート回路12が開になって出力線17の信号が出力さ
れた直後にレジスタはリセットされる。
Further, in parallel with this read operation, the register 11 receives the read signal at the reset terminal and is reset. Actually, the register is reset immediately after the gate circuit 12 is opened and the signal on the output line 17 is output.

[実施例] 本発明の実施例の構成を第2図(a)に示す。[Embodiment] The configuration of an embodiment of the present invention is shown in FIG.

第2図(a)において、20はパルスカウンタ、21,22は
オーバーフロー信号を計数して保持するレジスタ、23,2
4はゲート回路、25は処理部(CPU)、26はメモリ、27は
論理回路、28は読取り信号線を表す。
In FIG. 2 (a), 20 is a pulse counter, 21 and 22 are registers for counting and holding overflow signals, and 23 and 2
4 is a gate circuit, 25 is a processing unit (CPU), 26 is a memory, 27 is a logic circuit, and 28 is a read signal line.

この実施例の動作を第2図(b)の動作説明図をもちい
て説明する。
The operation of this embodiment will be described with reference to the operation explanatory diagram of FIG.

なお,処理部(CPU)25から読取り信号線28に発生する
読取り信号の周期は,パルスカウンタ20がパルス入力を
カウントして最大カウント値をカウントするのに要する
時間よりも短い。
The cycle of the read signal generated from the processing unit (CPU) 25 on the read signal line 28 is shorter than the time required for the pulse counter 20 to count the pulse input and count the maximum count value.

パルスカウンタ20はnビットのエンドレスカウンタであ
り、その最大のカウント値であるオール“1"になると、
次のパルス入力で自動的にオール“0"となり、同時にオ
ーバーフロー信号を発生するものである。
The pulse counter 20 is an n-bit endless counter, and when the maximum count value of all "1" is reached,
When the next pulse is input, all are automatically set to "0" and an overflow signal is generated at the same time.

以下に動作を説明する。The operation will be described below.

先ず、第2図(b)の(イ)の場合、パルスカウンタ20
がオーバーフローする前に2回の読取りが行われ、始め
の読取りにより値“m"が読取られ、次の読取りによ
り値“n"が読取られる。処理部25は前回に読んだ値
(m)をメモリ26に保持しているので、今回読んだ値
(n)からその値(m)を減算(n−m)して、から
までのパルス数を知ることができる。
First, in the case of (a) of FIG. 2 (b), the pulse counter 20
Is read twice before the overflow occurs, the first reading reads the value "m" and the next reading the value "n". Since the processing unit 25 holds the value (m) read last time in the memory 26, the value (m) is subtracted (nm) from the value (n) read this time, and the number of pulses up to You can know.

次に、第2図(b)の(ロ)の場合は、パルスカウンタ
20が最初の読取りの後にオーバーフローが1回発生し
てその後、処理部25が読取り信号を発した場合である。
このオーバーフローが発生した時は、レジスタ22のフラ
グQ2はオフ(0出力)であるから、オーバーフロー信号
が論理回路27をかいしてレジスタ21に与えられセット状
態にし、フラグQ1をオン(1出力)にする。この状態で
読取りが行われると、値nが読取られ同時にレジスタ
21はリセットされフラグQ1はオフになる。
Next, in the case of (b) in FIG. 2 (b), the pulse counter
20 is a case where an overflow occurs once after the first reading and then the processing unit 25 issues a reading signal.
When this overflow occurs, the flag Q2 of the register 22 is off (0 output). Therefore, an overflow signal is passed through the logic circuit 27 to the register 21 to set it, and the flag Q1 is turned on (1 output). To When reading is done in this state, the value n is read and at the same time the register is
21 is reset and flag Q1 is off.

この場合、処理部25は次の計算によりパルスカウント値
を知ることができる。但し、Lはパルスカウンタ20の最
大値である。
In this case, the processing unit 25 can know the pulse count value by the following calculation. However, L is the maximum value of the pulse counter 20.

m>nのとき パルス数=L−(m−n) m≦nのとき パルス数=L+(n−m) 次に、第2図(b)の(ハ)に示すように、最初の読取
りの後、処理部25に停電等の障害が発生してその後復
電して読取りを行うまでの間に、オーバーフローが2
回以上発生した場合は、2度目のオーバーフローにより
レジスタ22がセットされる。レジスタ22がセットされる
とその出力が論理回路27へ第2図に示すように禁止入力
として供給されているので、それ以降は、オーバーフロ
ー信号が発生してもレジスタ21へ入力されない。この場
合、処理部25はレジスタ22のフラグQ2がオンであること
を検出することにより、その時の読取りカウント値は使
用出来ない(信用できない)ものと判定して処理する。
When m> n Number of pulses = L− (m−n) When m ≦ n Number of pulses = L + (n−m) Next, as shown in (c) of FIG. After the power failure occurs in the processing unit 25 and then the power is restored and the reading is performed, the overflow 2
If it occurs more than once, the register 22 is set by the second overflow. When the register 22 is set, its output is supplied to the logic circuit 27 as a prohibition input as shown in FIG. 2, and thereafter, even if an overflow signal is generated, it is not input to the register 21. In this case, the processing unit 25 detects that the flag Q2 of the register 22 is on, and determines that the read count value at that time is unusable (untrustworthy) and processes it.

[発明の効果] このように、前回の読取りの後、処理部に停電等の障害
が発生しても、パルスカウンタ20のオーバーフローが1
回発生している期間内に次の読取りを行えば、正しいカ
ウント値を知ることができ、オーバーフローが2回以上
発生した場合にも、レジスタの出力によりその時のカウ
ント値が不正確であることが表示される。
[Effects of the Invention] As described above, even if a failure such as a power failure occurs in the processing unit after the previous reading, the overflow of the pulse counter 20 is 1
If the next reading is performed within the period in which the count has occurred twice, the correct count value can be known, and even if the overflow occurs twice or more, the count value at that time may be incorrect due to the output of the register. Is displayed.

そして、本発明によれば、エンドレス方式の長所も生か
して比較的に簡単な構成によりオーバーフローの検出と
読取りを実現することができる。
Further, according to the present invention, it is possible to realize overflow detection and reading with a relatively simple configuration, taking advantage of the advantages of the endless method.

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

第1図は本発明の原理的構成を示す図、第2図(a)は
本発明の実施例の構成を示す図、第2図(b)は実施例
の動作説明図、第3図は従来例の構成と動作説明図であ
る。 第1図中、 10:パルスカウンタ 11:レジスタ 12,13:ゲート回路 14:処理装置 15:パルスカウンタの出力線 16:オーバーフロー出力線 17:レジスタ11の出力線 18:読取り信号線
FIG. 1 is a diagram showing a principle configuration of the present invention, FIG. 2 (a) is a diagram showing a configuration of an embodiment of the present invention, FIG. 2 (b) is an operation explanatory diagram of the embodiment, and FIG. It is a structure and operation explanatory drawing of a prior art example. In FIG. 1, 10: pulse counter 11: register 12, 13: gate circuit 14: processor 15: pulse counter output line 16: overflow output line 17: register 11 output line 18: read signal line

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】パルス出力のカウンタ値を周期的に処理装
置が読取って処理を行うためのパルスカウント方式にお
いて, パルス出力をカウントして最大カウント値の次にオーバ
ーフロー出力を発生してリセットされるエンドレス方式
のパルスカウンタ(10)と, 前記パルスカウンタのオーバーフロー出力を論理回路を
介して入力され,オーバーフロー出力の発生回数が1回
か2回以上かを記憶保持し,前記処理装置からの読取り
信号(18)によりリセットされる各オーバーフローの回
数に対応して設けられた2段のレジスタ(11)と, 前記論理回路の他方の入力には,前記レジスタの2段目
の出力を禁止入力として供給され, 前記パルスカウンタの計数状態出力及びレジスタの状態
出力を,前記パルスカウンタの最大カウント値をカウン
トする時間より短い周期で発生する処理装置(14)から
の読取り信号により前記処理装置へ接続するバスへ出力
するゲート回路(12,13)を備え, 前記処理装置は,読取られたレジスタの状態出力とパル
スカウンタの前回と今回の計数状態出力に基づいてパル
スのカウント数を判別し, 前記処理装置の電源障害等により読取りを中断して前記
障害が回復した後に読取りが行われると,前記処理装置
は,前記レジスタの状態出力を判別し,2段目のレジスタ
がセットされてない場合は上記通常のパルスのカウント
数を判別し,セットされている場合は読取ったカウンタ
の値を使用しない処理をすることを特徴とするパルスカ
ウント方式。
1. A pulse counting system for periodically reading a counter value of pulse output by a processing device for processing, counting the pulse output, generating an overflow output next to the maximum count value, and resetting. An endless type pulse counter (10) and an overflow output of the pulse counter are inputted through a logic circuit, and the memory stores whether or not the number of occurrences of overflow output is one or more times, and a read signal from the processing device. The two-stage register (11) provided corresponding to the number of overflows reset by (18) and the other input of the logic circuit are supplied with the second-stage output of the register as a prohibited input. The count state output of the pulse counter and the state output of the register count the maximum count value of the pulse counter. The processing device (14) is provided with a gate circuit (12, 13) for outputting to a bus connected to the processing device in response to a read signal from the processing device (14) generated in a cycle shorter than the time, and the processing device outputs the status output of the read register. When the pulse count number is discriminated based on the previous and present count state outputs of the pulse counter, and reading is performed after the reading is interrupted due to a power failure or the like of the processing apparatus and the failure is recovered, the processing apparatus , The status output of the register is discriminated. If the second stage register is not set, the normal pulse count number is discriminated, and if it is set, the read counter value is not used. A pulse counting method characterized in that
JP62143800A 1987-06-09 1987-06-09 Pulse counting method Expired - Lifetime JPH0767083B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62143800A JPH0767083B2 (en) 1987-06-09 1987-06-09 Pulse counting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62143800A JPH0767083B2 (en) 1987-06-09 1987-06-09 Pulse counting method

Publications (2)

Publication Number Publication Date
JPS63306716A JPS63306716A (en) 1988-12-14
JPH0767083B2 true JPH0767083B2 (en) 1995-07-19

Family

ID=15347272

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62143800A Expired - Lifetime JPH0767083B2 (en) 1987-06-09 1987-06-09 Pulse counting method

Country Status (1)

Country Link
JP (1) JPH0767083B2 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5478966A (en) * 1977-12-06 1979-06-23 Fujitsu Ltd Failure detector of counter
JPS5917901A (en) * 1982-07-19 1984-01-30 井関農機株式会社 Apparatus for molding ridge between rice fields

Also Published As

Publication number Publication date
JPS63306716A (en) 1988-12-14

Similar Documents

Publication Publication Date Title
US5440603A (en) Watch-dog timer circuit and a microcomputer equipped therewith
JPH0346854B2 (en)
US5404356A (en) Microcomputer with watchdog timer and I/O port control
US5327362A (en) System for detecting a runaway of a microcomputer
JPH0767083B2 (en) Pulse counting method
JP2725419B2 (en) Counting circuit
JP2598547Y2 (en) Pattern generator for semiconductor test equipment
JPH04283840A (en) Diagnostic method for information processor
JP3308670B2 (en) Event-driven processing equipment failure detection device
JP2804406B2 (en) Pulse measuring device
JP2636684B2 (en) Bus monitoring equipment
US5497481A (en) Microcomputer computer system having plural programmable timers and preventing memory access operations from interfering with timer start requests
JP2516711B2 (en) Watchdog timer device
KR100207481B1 (en) Detecting time adjustment equipment to detect data during desire period
JP2605440B2 (en) Data processing device
JPH01199242A (en) Abnormality detector of microcomputer system
JPS60209847A (en) Picture forming device
JPH0120393B2 (en)
JPH01283641A (en) Interruption controller
JPH04225432A (en) Interruption processing time control system for one-chip microcomputer
JPH06230150A (en) Timer
JPS61286933A (en) Information processor
JPS62113245A (en) Operation monitoring device for signal processor
JPH0764823A (en) Watchdog timer circuit
JPH0310130B2 (en)