JPH0443715A - Counter with holding function - Google Patents
Counter with holding functionInfo
- Publication number
- JPH0443715A JPH0443715A JP15104890A JP15104890A JPH0443715A JP H0443715 A JPH0443715 A JP H0443715A JP 15104890 A JP15104890 A JP 15104890A JP 15104890 A JP15104890 A JP 15104890A JP H0443715 A JPH0443715 A JP H0443715A
- Authority
- JP
- Japan
- Prior art keywords
- value
- signal
- output
- initial value
- adder
- 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
Links
Landscapes
- Complex Calculations (AREA)
Abstract
Description
【発明の詳細な説明】 〔産業上の利用分野〕 本発明はホールド機能を有するカウンタに関する。[Detailed description of the invention] [Industrial application field] The present invention relates to a counter with a hold function.
クロック信号に同期して、出力値を“1”ずつ増加して
いくカウンタとしては、加算器を用いたものがある。第
4図は、そのような、加算器を用いたカウンタの従来例
を示すものである。As a counter that increases the output value by "1" in synchronization with a clock signal, there is a counter that uses an adder. FIG. 4 shows a conventional example of such a counter using an adder.
以下、同図を用いて従来のカウンタの基本動作の説明を
する。まず、初期値セット信号405を活性化すること
で、第1のセレクタ407はnビットの初期値404を
選択的に出力しカウント値409とする。ホールド信号
406が不活性(値″1”)のとき、初期値404は、
第2のセレクタ408をそのまま通過し、カウント結果
を格納するレジスタ403の入力となる。このレジスタ
403の出力値、すなわちnビットのカウント値409
は、加算器402の入力となる。加算器402は、カウ
ント値に“1”を加えた値を出力する。以降は、初期値
セット信号405を不活性にして、加算器402の出力
を第1のセレクタ407.第2のセレクタ408をその
跋ま通過させ、新たなカウント値409として出力しレ
ジスタ403へ再度入力する。この結果、カウント値4
゜9は、クロックに同期しながら、初期値404から“
1”ずつ増加した値となる。The basic operation of the conventional counter will be explained below using the same figure. First, by activating the initial value set signal 405, the first selector 407 selectively outputs the n-bit initial value 404 and sets it as a count value 409. When the hold signal 406 is inactive (value "1"), the initial value 404 is
The signal passes directly through the second selector 408 and becomes an input to the register 403 that stores the count result. The output value of this register 403, that is, the n-bit count value 409
becomes the input of adder 402. Adder 402 outputs a value obtained by adding "1" to the count value. Thereafter, the initial value set signal 405 is inactivated and the output of the adder 402 is sent to the first selector 407. It passes through the second selector 408, outputs it as a new count value 409, and inputs it to the register 403 again. As a result, count value 4
゜9 changes from the initial value 404 to “ while synchronizing with the clock.
The value increases by 1".
ホールド信号406は、カウント値409が増加しない
ように制御するためのものである。この信号によって、
任意の時間、出力値(カウント値)の変化を抑えること
ができる。ホールド信号406を活性(値“O″)にす
ると、第2のセレクタ408はレジスタ403の出力を
選択的に通過させる。したがって、レジスタ403は、
その出力と入力とが直結した帰還型のループをつくるよ
うになり、カウント値409は、変化せず一定値を保つ
ようになる。The hold signal 406 is for controlling the count value 409 so that it does not increase. With this signal,
Changes in the output value (count value) can be suppressed for an arbitrary period of time. When the hold signal 406 is activated (value "O"), the second selector 408 selectively passes the output of the register 403. Therefore, register 403 is
A feedback loop is created in which the output and input are directly connected, and the count value 409 does not change and remains constant.
以上の動作のタイミングチャートを第2図に示す。A timing chart of the above operation is shown in FIG.
第4図の構成のカウンタで、初期値セット信号とホール
ド信号とが同時に活性化した場合の動作は以下のように
なる。カウントの初期値は、第1のセレクタを通過して
、カウント値として外部に出力されるものの、第2のセ
レクタによってレジスタの入力とは遮断されてしまうた
め、ホールド信号が不活性(値“1”)にもどった時の
カウント値は、初期値をセットする直前の値(これをX
とする)に戻り、カウントアツプが続行される。The operation of the counter having the configuration shown in FIG. 4 when the initial value set signal and the hold signal are simultaneously activated is as follows. Although the initial value of the count passes through the first selector and is output as a count value, it is cut off from the register input by the second selector, so the hold signal is inactive (value "1"). ”), the count value is the value immediately before setting the initial value (this is
) and the count-up continues.
すなわち、第5図のタイミングチャートで示したように
、初期値のセットがおこなわれなかった場合と同様の結
果になる。That is, as shown in the timing chart of FIG. 5, the result is the same as when no initial value is set.
しかしながら、ホールド信号はカウント値の増加を抑圧
するということが目的の制御信号であるから、初期値を
セットした時点でホールド信号が活性化したならば、セ
ットされた初期値をホールド(すなわち初期値の増加を
抑制)し、ホールド信号が不活性になったときは、セッ
トされた初期値からカウントアツプを開始するという動
作の方が望ましいといえる。このような動作のタイミン
グチャートは第3図のようになる。However, since the hold signal is a control signal whose purpose is to suppress the increase in the count value, if the hold signal is activated at the time the initial value is set, the set initial value will be held (i.e., the initial value It can be said that it is more desirable to suppress the increase in the value of 0) and to start counting up from the set initial value when the hold signal becomes inactive. A timing chart of such an operation is shown in FIG.
本発明の目的は、初期値セット信号をボールド信号が同
時に活性化しても、初期値のセットがおこなえるホール
ド機能付カウンタを提供することにある。SUMMARY OF THE INVENTION An object of the present invention is to provide a counter with a hold function that allows initial values to be set even if an initial value set signal and a bold signal are simultaneously activated.
本発明のホールド機能付カウンタは、クロック信号に同
期してカウント値を格納するレジスタと、ホールド信号
を入力し対応する1ビットの値を前記クロック信号に同
期して出力するDフリップフロップと、前記レジスタの
出力と前記Dフリップフロップの出力とを入力しそれら
の和を出力する加算器と、前記加算器の出方とカウント
の初期値とを入力し初期値セット信号により両者のうち
の一方を選択的に出方し前記レジスタの入力とするセレ
クタとを備えている。The counter with a hold function of the present invention includes: a register that stores a count value in synchronization with a clock signal; a D flip-flop that inputs a hold signal and outputs a corresponding 1-bit value in synchronization with the clock signal; An adder inputs the output of the register and the output of the D flip-flop and outputs the sum thereof, and inputs the output of the adder and the initial value of the count, and selects one of them by an initial value set signal. and a selector that selectively outputs the output and inputs the register.
本発明のホールド機能付カウンタは、ホールド信号を、
Dフリップフロップを経由させて加算器の1ビット入力
とすることで、ホールド機能を実現させる。加算器は、
(レジスタの出方値)十(Dフリップフロップの出力値
)という加算処理をおこない、ホールド信号が不活性(
値“1”)のときは、通常のカウント値を“1”増加さ
せる動作をおこない、ホールド信号が活性(値“0“)
のときは、入力したカウント値をそのまま出力する。The counter with a hold function of the present invention uses a hold signal to
A hold function is realized by passing it through a D flip-flop and using it as a 1-bit input to an adder. The adder is
(output value of the register) is added (output value of the D flip-flop), and the hold signal is inactive (
When the value is "1"), the normal count value is increased by "1", and the hold signal is activated (value "0").
In this case, the input count value is output as is.
このような構成でホールドm能を実現することにより、
従来例のように、加算器の出力をレジスタの入力と遮断
する必要がなくなり、セットされた初期値は必ずレジス
タへ格納できる。したがって、初期値セット信号とホー
ルド信号が同時に活性化されたときでも、初期値をセッ
トし、ホールド信号が不活性になったときに、セットさ
れた初期値からカウントアツプを開始するという動作が
可能となる。By realizing the hold function with such a configuration,
Unlike the conventional example, there is no need to disconnect the output of the adder from the input of the register, and the set initial value can always be stored in the register. Therefore, even when the initial value set signal and the hold signal are activated at the same time, it is possible to set the initial value and start counting up from the set initial value when the hold signal becomes inactive. becomes.
次に、本発明の実施例について図面を参照して説明する
。Next, embodiments of the present invention will be described with reference to the drawings.
第1図は本発明の一実施例を示すブロック図である0本
実施1例のカウンタは、nビットのカウント値を格納す
るレジスタ103と、ホールド信号106に対応する1
ビットの2進数を出力するDフリップフロップ108と
、レジスタ103とDフリップフロップ108との出力
の値を加算する加算器102と、初期値セット信号10
5により加算器102の出力及びカウントの初期値のい
ずれか一方を選択しカウント値として外部に出力すると
ともにレジスタ103に入力するセレクタ107とから
なる。FIG. 1 is a block diagram showing one embodiment of the present invention. The counter of the first embodiment includes a register 103 that stores an n-bit count value, and a register 103 that stores an n-bit count value, and a
A D flip-flop 108 that outputs a binary number of bits, an adder 102 that adds the output values of the register 103 and the D flip-flop 108, and an initial value set signal 10.
5 selects either the output of the adder 102 or the initial value of the count and outputs it to the outside as a count value and inputs it to the register 103.
次に動作を説明する。Next, the operation will be explained.
初期値セット信号105が活性化すると、セレクタ10
7はnビットの初期値104を選択的に出力しカウント
値109とする。このカウント値109はレジスタ10
3の入力となる。さらにこのカウント値109は、レジ
スタ103によりクロック信号101に同期して、加算
器102へ出力される。ホールド信号106はDフリッ
プフロップ108の入力であり、このDフリップフロッ
プ108の出力は加算器102の1ビット長の入力であ
る。加算器102はnビットの2進数と1ビットの2進
数の和を出力する演算器であり、(レジスタ103のn
ビット出力値)+(Dフリラフ”70ツブ108の1ビ
ット出力値(=1))の計算をする。When the initial value set signal 105 is activated, the selector 10
7 selectively outputs an n-bit initial value 104 and sets it as a count value 109. This count value 109 is the register 10
3 input. Furthermore, this count value 109 is output by the register 103 to the adder 102 in synchronization with the clock signal 101. Hold signal 106 is the input of D flip-flop 108, and the output of D flip-flop 108 is the 1-bit long input of adder 102. The adder 102 is an arithmetic unit that outputs the sum of an n-bit binary number and a 1-bit binary number.
bit output value) + (1-bit output value (=1) of D-Fliruff"70 knob 108).
そこでホールド信号106が不活性、すなわち値“1″
のときは、現在のカウント値に“ビを加えた値が出力さ
れることになる。そのときに初期値セット信号105が
不活性ならば、加算器102の出力がカウント値109
となり、以下同様にしてカウントアツプ動作が続行され
る。Therefore, the hold signal 106 is inactive, that is, the value is "1".
In this case, the value obtained by adding "bi" to the current count value will be output. If the initial value set signal 105 is inactive at that time, the output of the adder 102 will be the count value 109.
Then, the count-up operation continues in the same manner.
カウントアツプ中にホールド信号106が活性化したと
き、すなわち値“0”になったときは、加算器102は
(レジスタ103の出力値)+(Dフリップフロップ1
08の出力値(=O))を計算することになるので、現
在のカウント値がそのまま出力し続けることになる。し
たがって、第2図のタイムチャートに示したような動作
が実現できる。When the hold signal 106 is activated during count-up, that is, when the value becomes "0", the adder 102 outputs (output value of register 103) + (D flip-flop 1).
Since the output value (=O) of 08 is calculated, the current count value continues to be output as is. Therefore, the operation shown in the time chart of FIG. 2 can be realized.
次に、初期値セット信号105とホールド信号106が
同時に活性化した場合を考える。Next, consider a case where the initial value set signal 105 and the hold signal 106 are activated simultaneously.
初期値104はセレクタ107を通過してカウント値1
09となるとともに、レジスタ103の入力となる。ホ
ールド信号106は活性、すなわち値“0″であるから
、Dフリップフロップ108はクロックに同期して値“
0”を出力し、加算器102はレジスタ103の出力値
をそのまま出力することになる。すなわち、加算器10
2の出力値は初期値104に等しい、したがって、初期
値セット信号105が不活性化して、セレクタ107が
加算器102の出力を選択的に通過させるようになって
も、カウント値109は初期値104のままである。The initial value 104 passes through the selector 107 and becomes the count value 1.
09 and becomes an input to the register 103. Since the hold signal 106 is active, that is, the value is "0", the D flip-flop 108 is synchronized with the clock and has the value "0".
0", and the adder 102 outputs the output value of the register 103 as is. In other words, the adder 102
The output value of 2 is equal to the initial value 104. Therefore, even if the initial value set signal 105 is inactivated and the selector 107 selectively passes the output of the adder 102, the count value 109 remains the initial value. It remains 104.
ホールド信号106が不活性(値“1”)になると、加
算器102は“1”を加える処理をはじめるので、初期
値104をカウントアツプした値がクロック信号101
に同期して出力されることになる。したがって、第3図
のタイミングチャートで示したような動作が実現できる
。When the hold signal 106 becomes inactive (value "1"), the adder 102 starts adding "1", so the value obtained by counting up the initial value 104 becomes the clock signal 101.
It will be output in sync with. Therefore, the operation shown in the timing chart of FIG. 3 can be realized.
なお、本発明ではホールド信号106は値が“0”のと
きに活性としたが、Dフリップフロップ108の出力部
(または入力部)にインバータを接続することで、値が
“1”のときに活性とすることも可能である。In the present invention, the hold signal 106 is activated when the value is "0", but by connecting an inverter to the output section (or input section) of the D flip-flop 108, the hold signal 106 is activated when the value is "1". It is also possible to make it active.
従来のホールド機能付カウンタは、初期値セット信号と
ホールド信号が同時に活性化すると、初期値をセットす
ることができなかった。それは、ホールド信号が活性化
したたきは、加算器の出力を、カウント値を格納するレ
ジスタヘセットできない構成になっていたからである。In a conventional counter with a hold function, if the initial value set signal and the hold signal were activated at the same time, the initial value could not be set. This is because the configuration is such that the output of the adder cannot be set to the register that stores the count value once the hold signal is activated.
本発明のホールド機能付カウンタは、加算器にホールド
信号を入力して、カウント値に“1”を加えるか加えな
いかを制御するものであり、加算器の出力はレジスタへ
必ずセットされる構成になっている。したがって、初期
値セット信号とホールド信号とが同時に活性化しても、
初期値をセットし、かつ初期値の増加を抑制するという
動作が可能となる。The counter with a hold function of the present invention inputs a hold signal to an adder to control whether "1" is added to the count value or not, and the output of the adder is always set to a register. It has become. Therefore, even if the initial value set signal and hold signal are activated at the same time,
It becomes possible to set an initial value and suppress an increase in the initial value.
第1図は本発明の一実施例を示すブロック図、第2図は
ホールド機能付カウンタの基本タイミングチャート図、
第3図は本発明のホールド機能付カウンタにおいて初期
値をセットする信号とホールド信号が同時に活性化した
ときのタイミングチャート図、第4図は従来例を示すブ
ロック図、第5図は従来例において初期値をセットする
信号とホールド信号とが同時に活性化したときのタイミ
ングチャート図である。
101.401・・・クロック信号、102,402・
・・加算器、103.403・・・レジスタ、104゜
404・・・初期値、105,405・・・初期値セッ
ト信号、106.406・・・ホールド信号、107・
・・セレクタ、407・・・第1のセレクタ、408・
・・第2のセレクタ、108・・・Dフリップフロップ
、109.409・・・カウント値。FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is a basic timing chart of a counter with a hold function,
FIG. 3 is a timing chart when the signal for setting the initial value and the hold signal are activated simultaneously in the counter with a hold function of the present invention, FIG. 4 is a block diagram showing a conventional example, and FIG. 5 is a diagram showing the conventional example. FIG. 7 is a timing chart when a signal for setting an initial value and a hold signal are activated at the same time. 101.401...Clock signal, 102,402...
...Adder, 103.403...Register, 104°404...Initial value, 105,405...Initial value set signal, 106.406...Hold signal, 107.
...Selector, 407...First selector, 408.
...Second selector, 108...D flip-flop, 109.409...Count value.
Claims (1)
と、ホールド信号を入力し対応する1ビットの値を前記
クロック信号に同期して出力するDフリップフロップと
、前記レジスタの出力と前記Dフリップフロップの出力
とを入力しそれらの和を出力する加算器と、前記加算器
の出力とカウントの初期値とを入力し初期値セット信号
により両者のうちの一方を選択的に出力し前記レジスタ
の入力とするセレクタとを備え、前記ホールド信号の値
によりカウント値の歩進及びホールドを制御することを
特徴とするホールド機能付カウンタ。A register that stores a count value in synchronization with a clock signal, a D flip-flop that inputs a hold signal and outputs a corresponding 1-bit value in synchronization with the clock signal, and a combination of the output of the register and the D flip-flop. an adder that inputs the output and outputs the sum thereof; and an adder that inputs the output of the adder and the initial value of the count, selectively outputs one of the two by an initial value set signal, and outputs the input of the register. 1. A counter with a hold function, comprising a selector for controlling the increment and hold of the count value according to the value of the hold signal.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP15104890A JPH0443715A (en) | 1990-06-08 | 1990-06-08 | Counter with holding function |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP15104890A JPH0443715A (en) | 1990-06-08 | 1990-06-08 | Counter with holding function |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0443715A true JPH0443715A (en) | 1992-02-13 |
Family
ID=15510162
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP15104890A Pending JPH0443715A (en) | 1990-06-08 | 1990-06-08 | Counter with holding function |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0443715A (en) |
-
1990
- 1990-06-08 JP JP15104890A patent/JPH0443715A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JPH0443715A (en) | Counter with holding function | |
| JPH04209020A (en) | Microcomputer | |
| JPH11112296A (en) | Double edge d-flip flop circuit | |
| JP2757714B2 (en) | Frame pulse generation circuit | |
| JPH0222912A (en) | Flip flop circuit | |
| JP2927096B2 (en) | Variable frequency oscillation circuit | |
| JP2794950B2 (en) | Integrator circuit | |
| JPH0433117A (en) | Watchdog timer circuit | |
| JP2536942B2 (en) | Semiconductor integrated circuit | |
| JPS6379420A (en) | Odd number frequency divider | |
| JPH0271641A (en) | Block synchronization detection circuit | |
| JPH0230244A (en) | External synchronizing clock generating circuit | |
| JPS63254827A (en) | Decoding circuit | |
| JPH05243916A (en) | Flip-flop circuit provided with logic inversion error preventing function | |
| JPH08195654A (en) | Clock regenerating circuit | |
| JPH02117206A (en) | Semiconductor integrated circuit device | |
| JPS605622A (en) | Clock signal generator | |
| JPH08125494A (en) | Moving average filter | |
| JPH0555883A (en) | Timer circuit | |
| JPH07177024A (en) | Odd counter circuit | |
| JPH02100554A (en) | Ringer signal generator | |
| JPH02130020A (en) | Delay circuit | |
| JPH02113625A (en) | 1/N frequency divider | |
| JPH03139010A (en) | Asynchronous signal synchronizing circuit | |
| JPH11298301A (en) | Flip-flop circuit with asynchronous set/reset |