JPH0378586B2 - - Google Patents

Info

Publication number
JPH0378586B2
JPH0378586B2 JP57069024A JP6902482A JPH0378586B2 JP H0378586 B2 JPH0378586 B2 JP H0378586B2 JP 57069024 A JP57069024 A JP 57069024A JP 6902482 A JP6902482 A JP 6902482A JP H0378586 B2 JPH0378586 B2 JP H0378586B2
Authority
JP
Japan
Prior art keywords
memory
logic
voltage level
input
signal
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
JP57069024A
Other languages
Japanese (ja)
Other versions
JPS58184555A (en
Inventor
Hirohisa Mizuhara
Hidetaka Watanabe
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP57069024A priority Critical patent/JPS58184555A/en
Publication of JPS58184555A publication Critical patent/JPS58184555A/en
Publication of JPH0378586B2 publication Critical patent/JPH0378586B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R21/00Arrangements for measuring electric power or power factor
    • G01R21/133Arrangements for measuring electric power or power factor by using digital technique

Landscapes

  • Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Measurement Of Current Or Voltage (AREA)

Description

【発明の詳細な説明】 この発明は「H」及び「L」で表される2値の
電圧レベルを有する信号が、レベル「H」からレ
ベル「L」となる(以下立下りという)回数、又
はレベル「L」からレベル「H」となる(以下立
上りという)回数を計数するパルス計数装置に関
し、特に入力2値信号の波形が幅の狭いパルス状
である場合の処理に関するものである。
DETAILED DESCRIPTION OF THE INVENTION This invention relates to the number of times a signal having binary voltage levels represented by "H" and "L" changes from level "H" to level "L" (hereinafter referred to as falling); The present invention also relates to a pulse counting device that counts the number of times the level changes from level "L" to level "H" (hereinafter referred to as rising), and particularly relates to processing when the waveform of the input binary signal is a narrow pulse shape.

第1図はマイクロコンピユータを用いて構成し
たパルス計数装置の一例を示すブロツク図で、
1,2は信号入力端子、3はホトカプラ、4,5
は抵抗、6は2値化機能を有するインバータ、7
はマイクロコンピユータ、7aは入出力部(以下
I/Oと略記する)、7bはプロセツサ部(以下
CPUと略記する)、7cはメモリである。
Figure 1 is a block diagram showing an example of a pulse counting device configured using a microcomputer.
1 and 2 are signal input terminals, 3 is a photocoupler, 4 and 5
is a resistor, 6 is an inverter with a binarization function, and 7 is a resistor.
is a microcomputer, 7a is an input/output unit (hereinafter abbreviated as I/O), and 7b is a processor unit (hereinafter abbreviated as I/O).
7c is a memory.

第2図は第1図の装置の動作を示すフロー図
で、信号の立下り点(レベル「H」からレベル
「L」への変化点)の数を計数する場合の各ステ
ツプを示す。インバータ6の出力信号のパルス幅
に比して短い繰返し周期を有するサンプリングパ
ルスを用いそのサンプリングパルスごとにCPU
7bにおいてそのサンプリングパルス時点の入力
信号のレベルを測定し今回メモリへ書込む(ステ
ツプ9)。次に今回メモリの内容と前回メモリ
(後で説明する)の内容とを比較し(ステツプ1
0)、一致しておればステツプ13に移り今回メ
モリの内容を前回メモリへ書込む。初期状態にお
いてはステツプ10で常にYESとなるように制
御することが必要である。すなわち前回メモリは
1サンプリングパルス前の今回メモリの内容を保
持するレジスタである。ステツプ10がNOで、
かつステツプ11で今回メモリの内容がレベル
「L」を示すときは入力信号が「H」から「L」
に立下つたことを示すので、計数メモリに数値1
を加え(ステツプ12)、かつステツプ13の処
理を行う。NEXTと書いてある所では次のサン
プリングパルスの到来を待ち、次のサンプリング
パルスが来るとステツプ9から開始する。また、
ステツプ11でNOなら立上り点を示すのでステ
ツプ13を経てNEXTにうつる。
FIG. 2 is a flowchart showing the operation of the apparatus shown in FIG. 1, showing each step in counting the number of falling points of a signal (points of change from level "H" to level "L"). Using a sampling pulse with a short repetition period compared to the pulse width of the output signal of the inverter 6, the CPU
In step 7b, the level of the input signal at the time of the sampling pulse is measured and written into the memory (step 9). Next, compare the contents of the current memory with the contents of the previous memory (explained later) (step 1).
0), if they match, the process moves to step 13 and the contents of the current memory are written to the previous memory. In the initial state, it is necessary to perform control so that step 10 always returns YES. That is, the previous memory is a register that holds the contents of the current memory one sampling pulse ago. If step 10 is NO,
And when the contents of the memory indicate the level "L" this time in step 11, the input signal changes from "H" to "L".
This indicates that the number has fallen, so the number 1 is stored in the counting memory.
is added (step 12), and the process of step 13 is performed. At the place where NEXT is written, the process waits for the next sampling pulse to arrive, and when the next sampling pulse arrives, it starts from step 9. Also,
If NO in step 11, it indicates the rising point, so proceed to step 13 to proceed to NEXT.

第3図は入力信号とサンプリングパルスとの関
係を示す波形図で、第3図a,cはそれぞれ入力
信号、同図bはサンプリングパルス、同図dは同
図cに示す入力信号の立下り点31b,31d,
31f,31hでトリガされて論理が反転するフ
リツプフロツプの出力論理を示す。第3図aに示
す入力信号に対してはサンプリングパルス30
a,30bの間、30c,30dの間、30e,
30fの間で第2図ステツプ10でNO、ステツ
プ11でYESとなりステツプ12で立下り点が
計数されるが、第3図bに示す入力信号に対して
はサンプリングパルスの周期が入力信号のパルス
幅より長いために、サンプリングパルスが入力信
号のパルス幅内に1本も存在せずしたがつて立下
り点31b,31d,31f,31hのうち計数
もれとなるものが生ずる。このような場合は第3
図cの波形から第3図dの波形を発生し、32
b,32d,32f,32hを計数すればよい。
Figure 3 is a waveform diagram showing the relationship between the input signal and the sampling pulse, where a and c in Figure 3 are the input signals, b is the sampling pulse, and d is the falling edge of the input signal shown in c in Figure 3. Points 31b, 31d,
The output logic of the flip-flop whose logic is inverted when triggered by 31f and 31h is shown. For the input signal shown in Figure 3a, the sampling pulse 30
Between a and 30b, between 30c and 30d, 30e,
30f, NO is determined in step 10 of FIG. 2, YES is determined in step 11, and falling points are counted in step 12. However, for the input signal shown in FIG. 3b, the period of the sampling pulse is equal to the pulse of the input signal. Since it is longer than the width, there is no sampling pulse within the pulse width of the input signal, and therefore some of the falling points 31b, 31d, 31f, and 31h are omitted in counting. In such a case, the third
The waveform in Figure 3 d is generated from the waveform in Figure c, and 32
What is necessary is to count b, 32d, 32f, and 32h.

第4図は従来の装置の他の例を示すブロツク図
で、第1図と同一符号は同一部分を示し20はT
形フリツプフロツプである。インバータ6の出力
が第3図cに示すものであるとき、フリツプフロ
ツプ20の出力端子Qの論理は第3図dのように
なり、これを入力し第2図のステツプ11を省略
すれば32b,32d,32f,32hの点を検
出できることは明らかである。
FIG. 4 is a block diagram showing another example of the conventional device, in which the same reference numerals as in FIG. 1 indicate the same parts, and 20 is a T.
It is a flip-flop in shape. When the output of the inverter 6 is as shown in FIG. 3c, the logic at the output terminal Q of the flip-flop 20 is as shown in FIG. 3d. If this is input and step 11 in FIG. 2 is omitted, 32b, It is clear that points 32d, 32f, and 32h can be detected.

しかし、第4図に示す回路で1たん停電が発生
し次に停電が復旧したと仮定し、マイクロコンピ
ユータ7の中では停電対策が施されていて、たと
えば停電直前のデータを不揮発性メモリに退避し
ておいて停電復旧後に退避したデータをもとのレ
ジスタへ戻すのであるが、フリツプフロツプ20
の出力論理がどうなるかは不定であるので、第4
図の回路によるとフリツプフロツプ20の状態に
よつてパルス1個分の計数誤差を生ずることがあ
るという欠点であつた。
However, assuming that a power outage occurs once in the circuit shown in Figure 4 and then the power outage is restored, the microcomputer 7 has measures against power outages, and for example, the data immediately before the power outage is saved to nonvolatile memory. After the power is restored, the evacuated data is returned to the original register, but the flip-flop 20
Since it is uncertain what the output logic will be, the fourth
The circuit shown in the figure has a drawback in that depending on the state of the flip-flop 20, a counting error of one pulse may occur.

この発明は従来の装置における上述の欠点を除
去するためになされたもので、停電発生と停電復
旧との間にパルス計数誤差が発生することのない
パルス計数装置を提供することを目的としてい
る。
The present invention was made to eliminate the above-mentioned drawbacks of conventional devices, and an object of the present invention is to provide a pulse counting device that does not generate pulse counting errors between the occurrence of a power outage and the restoration of a power outage.

以下、図面によつてこの発明の実施例を説明す
る。第5図は停電及び停電復旧を含む信号波形を
示す波形図で、第5図aは入力信号波形、第5図
bは入力信号波形の立下り点50a,50b,5
0c,50f,50gでトリガされて出力論理が
反転するフリツプフロツプの出力を示し、50
d,51dが停電発生、50e,51gが停電復
旧点を示す。第6図はこの発明の一実施例を示す
ブロツク図で、第4図と同一符号は同一部分を示
し、21は停電検出回路である。停電検出回路2
1と停電時及び停電復旧時の処理については一般
に知られているので説明を省略するが、マイクロ
コンピユータ7はこのような処理装置を備えてい
るものとする。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 5 is a waveform diagram showing signal waveforms including power outage and power outage recovery, where FIG. 5 a shows the input signal waveform, and FIG.
It shows the output of a flip-flop whose output logic is inverted when triggered at 0c, 50f, and 50g.
d and 51d indicate the occurrence of a power outage, and 50e and 51g indicate the power outage recovery point. FIG. 6 is a block diagram showing an embodiment of the present invention, in which the same reference numerals as in FIG. 4 indicate the same parts, and 21 is a power failure detection circuit. Power outage detection circuit 2
1 and the processing at the time of power outage and power outage recovery are generally known and will not be described here, but it is assumed that the microcomputer 7 is equipped with such a processing device.

第7図は第6図の動作を示すフロー図で、40
〜45はそれぞれプログラムステツプを示し、第
2図と比較し9と41、10と42、12と4
3、13と44が対応しステツプ11は省略され
ステツプ40と45が付加されている。したがつ
て停電の復旧以外は第4図の回路と同様にステツ
プ41〜44が実行されるが、ステツプ40で
YESとなるとその時点のサンプリングパルスに
よつてサンプルされた入力信号の論理を直接前回
メモリへ入力する。すなわち51eで停電が復旧
したときは前回メモリの内容がどうなつていても
51e時点の直後のサンプリングパルス時点のフ
リツプフロツプ20の出力論理を前回メモリに入
力し(ステツプ45)、その次のサンプリングパ
ルス時点のフリツプフロツプ20の出力論理を今
回メモリに入力する(ステツプ41)ので、停電
復旧によつてフリツプフロツプ20の出力論理が
どう設定されようとも計数誤差を発生することは
ない。
FIG. 7 is a flow diagram showing the operation of FIG.
-45 indicate program steps, and compared with FIG. 2, 9 and 41, 10 and 42, 12 and 4
3, 13 and 44 correspond, step 11 is omitted and steps 40 and 45 are added. Therefore, steps 41 to 44 are executed in the same way as the circuit in FIG. 4 except for recovery from a power outage, but step 40
If YES, the logic of the input signal sampled by the sampling pulse at that time is directly input to the previous memory. That is, when the power is restored at 51e, the output logic of the flip-flop 20 at the sampling pulse immediately after 51e is input to the previous memory (step 45), regardless of the contents of the previous memory. Since the output logic of the flip-flop 20 is input to the memory this time (step 41), no counting error will occur no matter how the output logic of the flip-flop 20 is set upon recovery from a power failure.

なお上記実施例では入力信号回路は1回路の場
合について説明したが、複数の入力信号回路の場
合も同様の手順を各回路について行えばよい。更
にI/O7aに入力される信号波形にノイズが重
畳しているような場合、複数個のサンプリングパ
ルスに対して同一の論理が連続しているときには
じめて入力信号が当該論理にあるとして処理する
ことがあるが、このような場合においてもこの発
明を利用することができる。
In the above embodiment, the case where there is one input signal circuit has been described, but in the case of a plurality of input signal circuits, the same procedure may be performed for each circuit. Furthermore, if noise is superimposed on the signal waveform input to the I/O 7a, the input signal is processed as having the corresponding logic only when the same logic continues for multiple sampling pulses. However, the present invention can also be used in such cases.

なお、第6図はマイクロコンピユータ7を使用
する実施例を示したが、第7図の動作を実行する
専用の回路を構成することも容易である。
Although FIG. 6 shows an embodiment using the microcomputer 7, it is also easy to construct a dedicated circuit for executing the operations shown in FIG.

以上のようにこの発明によれば、幅の狭いパル
ス状の2値信号においてパルスを計数する場合に
おいても、停電と停電復旧により誤計数を発生す
ることのないパルス計数装置を提供することがで
きる。
As described above, according to the present invention, it is possible to provide a pulse counting device that does not cause erroneous counts due to power outage and power restoration even when counting pulses in a narrow pulse-like binary signal. .

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

第1図はマイクロコンピユータを用いて構成し
た従来のパルス計数装置の一例を示すブロツク
図、第2図は第1図の装置の動作を示すフロー
図、第3図は入力信号とサンプリングパルスとの
関係を示す波形図、第4図は従来の装置の他の例
を示すブロツク図、第5図は停電及び停電復旧を
含む信号波形を示す波形図、第6図はこの発明の
一実施例を示すブロツク図、第7図は第6図の動
作を示すフロー図である。 1,2……信号入力端子、3……ホトカプラ、
6……インバータ、7……マイクロコンピユー
タ、7a……I/O、7b……CPU、7c……
メモリ、20……T形フリツプフロツプ、21…
…停電検出回路。なお、図中同一符号は同一又は
相当部分を示す。
Fig. 1 is a block diagram showing an example of a conventional pulse counting device configured using a microcomputer, Fig. 2 is a flow diagram showing the operation of the device shown in Fig. 1, and Fig. 3 is a block diagram showing the operation of the device shown in Fig. 1. FIG. 4 is a block diagram showing another example of the conventional device, FIG. 5 is a waveform diagram showing signal waveforms including power outage and power recovery, and FIG. 6 is a waveform diagram showing an embodiment of the present invention. The block diagram shown in FIG. 7 is a flow diagram showing the operation of FIG. 6. 1, 2...Signal input terminal, 3...Photocoupler,
6...Inverter, 7...Microcomputer, 7a...I/O, 7b...CPU, 7c...
Memory, 20...T-type flip-flop, 21...
...Power failure detection circuit. Note that the same reference numerals in the figures indicate the same or equivalent parts.

Claims (1)

【特許請求の範囲】[Claims] 1 2値の電圧レベルを有する信号が電圧レベル
を反転して所定の電圧レベルとなる回数を計数す
るパルス計数装置において、上記信号を入力しそ
の電圧レベルが反転して上記所定の電圧レベルと
なる時点の信号変化によつてトリガされて出力論
理が反転するフリツプフロツプと、所定の周期を
有するサンプリングパルスにより上記フリツプフ
ロツプの出力論理をサンプリングしその最も新し
いサンプリング点の論理を記憶する今回メモリ
と、この今回メモリの内容が今回メモリに入力さ
れた時点から1サンプリング周期遅れた時点で入
力される前回メモリと上記今回メモリの内容が上
記前回メモリの内容と異る論理となるごとに数値
1が加算されるカウンタと、上記今回メモリ、上
記前回メモリ及び上記カウンタの内容を装置の停
電時に不揮発性メモリに退避し停電復旧時に上記
不揮発性メモリからそれぞれ上記今回メモリ、上
記前回メモリ及び上記カウンタに設定する手段
と、上記停電復旧後の最初のサンプリングパルス
によりサンプリングした上記入力信号の論理に限
り直接上記前回メモリに入力する手段とを備えた
ことを特徴とするパルス計数装置。
1. In a pulse counting device that counts the number of times a signal having a binary voltage level inverts the voltage level and becomes a predetermined voltage level, the above signal is input, and the voltage level is inverted and becomes the predetermined voltage level. A flip-flop whose output logic is inverted when triggered by a signal change at a point in time; a current memory that samples the output logic of the flip-flop using a sampling pulse having a predetermined period and stores the logic at the latest sampling point; A value of 1 is added each time the previous memory input at a time one sampling cycle later than the current memory content and the current memory content have a different logic from the previous memory content. a counter, and means for saving the contents of the current memory, the previous memory, and the counter to a nonvolatile memory when the device is out of power, and setting the contents of the current memory, the previous memory, and the counter from the nonvolatile memory to the current memory, the previous memory, and the counter, respectively, when the power is restored. , means for directly inputting only the logic of the input signal sampled by the first sampling pulse after restoration of the power outage to the previous memory.
JP57069024A 1982-04-22 1982-04-22 Pulse counter Granted JPS58184555A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP57069024A JPS58184555A (en) 1982-04-22 1982-04-22 Pulse counter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP57069024A JPS58184555A (en) 1982-04-22 1982-04-22 Pulse counter

Publications (2)

Publication Number Publication Date
JPS58184555A JPS58184555A (en) 1983-10-28
JPH0378586B2 true JPH0378586B2 (en) 1991-12-16

Family

ID=13390595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP57069024A Granted JPS58184555A (en) 1982-04-22 1982-04-22 Pulse counter

Country Status (1)

Country Link
JP (1) JPS58184555A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0733464Y2 (en) * 1988-11-14 1995-07-31 横河電機株式会社 Integrated value backup device

Also Published As

Publication number Publication date
JPS58184555A (en) 1983-10-28

Similar Documents

Publication Publication Date Title
JPH0129093B2 (en)
US20020008548A1 (en) Device for detecting abnormality of clock signal
JPH0378586B2 (en)
JPH0133052B2 (en)
JPS6255110B2 (en)
JP2911130B2 (en) Phase difference detector
JPS62131637A (en) Timing jitter measuring system
KR0161383B1 (en) Index period detecting apparatus in a floppy disc driver controller
JP2824080B2 (en) Period measurement circuit
JP2599759B2 (en) Flip-flop test method
JP2804406B2 (en) Pulse measuring device
JPH0563524A (en) Signal input circuit
JP2984802B2 (en) Input signal abnormality detection circuit
SU473180A1 (en) Device for testing comparison circuits
JPH03252526A (en) Sensor output circuit
JP2613916B2 (en) Data aperiodic readout circuit
JPH0635998B2 (en) Capture device
JPH0658386B2 (en) Counter device
JPH04307372A (en) Edge detection circuit device
SU661830A1 (en) Erasure correction device
JP2638337B2 (en) Error counter circuit
JPS6379444A (en) Serial data receiver
JP2009244195A (en) Signal processor and processing method
JPH08122098A (en) Position detector for rotor
JPS606143B2 (en) Input data state change detection circuit