JP2000082952A - Multi-bit counter device - Google Patents

Multi-bit counter device

Info

Publication number
JP2000082952A
JP2000082952A JP10250717A JP25071798A JP2000082952A JP 2000082952 A JP2000082952 A JP 2000082952A JP 10250717 A JP10250717 A JP 10250717A JP 25071798 A JP25071798 A JP 25071798A JP 2000082952 A JP2000082952 A JP 2000082952A
Authority
JP
Japan
Prior art keywords
count value
counter
phase pulse
phase
value
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
JP10250717A
Other languages
Japanese (ja)
Inventor
Michio Egashira
道雄 江頭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP10250717A priority Critical patent/JP2000082952A/en
Publication of JP2000082952A publication Critical patent/JP2000082952A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To realize current up/down counting with a simple configuration. SOLUTION: A CPU 15 takes in an eight bits count value with a prescribed chip selection period from a counter IC 13 to which a two-phase pulse is inputted, which executes addition counting or subtraction counting in accordance with the progress/delay of a phase between input pulses and outputs the eight bits count value, collates it with a count value that is previously taken in, judges the presence or absence of overflow or underflow and carries or borrows the count value which is taken in this time in accordance with the judged result. Since carrying/borrowing are judged by software processing, device constitution is simplified and the manufacturing cost can be reduced.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、簡易な構成で正確
なアップダウン計数を可能にした多ビットカウンタ装置
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a multi-bit counter device capable of accurately counting up and down with a simple configuration.

【0002】[0002]

【従来の技術】アンチロックブレーキ装置や四輪操舵装
置等の車載制御装置は、いずれも車輪回転速度センサや
ハンドル舵角センサといった回転計測手段が不可欠であ
る。特にハンドル舵角センサのようにステアリングホイ
ールの正転と逆転に応じた方向性をもった回転パルスを
計測するセンサの場合、さまざまな工夫が要求されるこ
とになる。図4に示す従来の多ビットカウンタ装置1
は、舵角パルスとしてA相パルスとB相パルスの2相パ
ルスを出力するエンコーダ2の出力を、A相パルスとB
相パルスの位相の進遅に応じてアップ計数又はダウン計
数を行うものであり、一対の8ビットカウンタIC3,
4とCPU5を用いて構成されている。
2. Description of the Related Art In all on-vehicle control devices such as an anti-lock brake device and a four-wheel steering device, rotation measuring means such as a wheel rotational speed sensor and a steering wheel angle sensor are indispensable. In particular, in the case of a sensor such as a steering wheel angle sensor that measures a rotation pulse having directionality according to the forward rotation and the reverse rotation of the steering wheel, various measures are required. Conventional multi-bit counter device 1 shown in FIG.
Outputs the output of the encoder 2 that outputs a two-phase pulse of an A-phase pulse and a B-phase pulse as the steering angle pulse,
The counter counts up or down in accordance with the phase of the phase pulse.
4 and a CPU 5.

【0003】具体的には、上記多ビットカウンタ装置1
は、A相パルス出力線路とB相パルス出力線路を介して
エンコーダ2に接続した下位バイト計数用の8ビットカ
ウンタIC3と、この下位バイト計数用カウンタIC3
のキャリー出力を計数する上位バイト計数用の8ビット
カウンタIC4と、両カウンタIC3,4に対し個別チ
ップセレクト信号線路と共通データバスとを介して接続
したCPU5とから構成される。下位バイト計数用カウ
ンタIC3は、A相とB相の二相パルスが入力され、入
力パルス間の位相の進遅に応じて加算計数又は減算計数
を行い、8ビットの計数値を出力するとともに、キャリ
ー信号をキャリー信号出力線路を介して上位バイト計数
用カウンタIC4に供給する。すなわち、下位バイト計
数用カウンタIC3は、A相パルスがB相パルスよりも
進相であれば加算計数を行い、A相パルスがB相パルス
よりも遅相であれば減算計数を行い、加算による桁上が
り又は減算による桁下がりが発生したときに、上位バイ
ト計数用カウンタIC4に対し相応のキャリー信号を供
給する。
Specifically, the multi-bit counter device 1
Is an 8-bit counter IC3 for counting the lower byte connected to the encoder 2 via the A-phase pulse output line and the B-phase pulse output line, and a counter IC3 for counting the lower byte.
And a CPU 5 connected to both counters IC3, 4 via individual chip select signal lines and a common data bus. The lower byte counting counter IC3 receives the two-phase pulses of the A-phase and the B-phase, performs addition counting or subtraction counting according to the advance / delay of the phase between the input pulses, and outputs an 8-bit count value. The carry signal is supplied to the upper byte counting counter IC4 via the carry signal output line. That is, the lower byte counting counter IC3 performs an addition count if the A-phase pulse is earlier than the B-phase pulse, and performs a subtraction count if the A-phase pulse is later than the B-phase pulse. When a carry due to a carry or a subtraction occurs, a corresponding carry signal is supplied to the upper byte counting counter IC4.

【0004】[0004]

【発明が解決しようとする課題】上記従来の多ビットカ
ウンタ装置1は、下位バイト計数用カウンタIC3と上
位バイト計数用カウンタIC4が共通データバスを介し
てCPU5に接続されているため、計数値の取り込みに
際しては、CPU5はまず下位バイト計数用カウンタI
C3に対してチップセレクト信号を供給し、共通データ
バスを介して下位バイト計数値を取り込む。次に、CP
U5は、上位バイト計数用カウンタIC4に対してチッ
プセレクト信号を供給し、共通データバスを介して上位
バイト計数値を取り込む。すなわち、CPU5は、8ビ
ットデータバスを介して下位バイト計数値と上位バイト
計数値を順次取り込む必要があり、従って例えば下位バ
イト計数値を取り込み終えた時点で、しかも上位バイト
計数値を取り込むよりも前に下位バイト計数用カウンタ
IC3が計数更新してしまったような場合、上位バイト
計数値と下位バイト計数値のデータとしての同時性すな
わち同一性を保つことができず、CPU5に取り込まれ
た計数値が著しく正確性を欠くことになるといった課題
を抱えるものであった。
In the conventional multi-bit counter device 1, the lower byte counting counter IC3 and the upper byte counting counter IC4 are connected to the CPU 5 via a common data bus, so that the counted value When taking in the data, the CPU 5 first sets the lower byte counting counter I
A chip select signal is supplied to C3, and a lower byte count value is taken in via a common data bus. Next, CP
U5 supplies a chip select signal to the upper byte counting counter IC4 and takes in the upper byte count value via the common data bus. That is, the CPU 5 needs to sequentially take in the lower byte count value and the upper byte count value via the 8-bit data bus. If the lower byte counting counter IC3 has previously updated the count, it is not possible to maintain the synchronism, that is, the same, as the data of the upper byte count value and the lower byte count value. There was a problem that the numerical values would be extremely inaccurate.

【0005】また、下位バイト計数用カウンタIC3か
ら上位バイト計数用カウンタIC4に伝搬されるキャリ
ー信号についても、信号伝搬には相応の時間が必要であ
るため、キャリー信号発生と同時に上位バイト計数用カ
ウンタIC4からデータの取り込みが行われたようなと
きに、キャリー信号の伝搬遅れが原因で現に発生してい
るキャリー信号は取り込み得ず、正しい計数値の取り込
みに失敗することがある等の課題を抱えるものであっ
た。さらにまた、装置構成についても、下位バイト計数
用と上位バイト計数用に一対のカウンタIC3,4を必
要とするため、それだけ回路構成が複雑化しやすく、製
造コストも高くつく等の課題を抱えるものであった。
Also, the carry signal transmitted from the lower byte counting counter IC3 to the upper byte counting counter IC4 requires an appropriate time for signal propagation. When data is fetched from the IC 4, the carry signal that is actually occurring due to the propagation delay of the carry signal cannot be fetched, and there is a problem that the correct count value may not be fetched. Was something. Furthermore, the device configuration requires a pair of counter ICs 3 and 4 for counting the lower byte and counting the upper byte, and therefore has the problems that the circuit configuration is easily complicated and the manufacturing cost is high. there were.

【0006】本発明は、上記課題を解決したものであ
り、単一のカウンタとCPUを用いた簡易な構成で、2
相パルスを正確に計数できるようにすることを目的とす
るものである。
The present invention has solved the above-mentioned problem, and has a simple configuration using a single counter and a CPU.
It is an object of the present invention to accurately count phase pulses.

【0007】[0007]

【課題を解決するための手段】上記目的を達成するた
め、本発明は、二相パルスが入力され、入力パルス間の
位相の進遅に応じて加算計数又は減算計数を行い、複数
ビットの計数値を出力するカウンタと、所定周期でチッ
プセレクト信号を前記カウンタに供給し、前記複数ビッ
トの計数値を取り込み、前回取り込んだ計数値と比較対
照してオーバーフロー又はアンダーフローの発生の有無
を判定し、該判定結果に従い今回取り込んだ計数値の桁
上げ又は桁下げを行う演算処理手段とを具備することを
特徴とするものである。
In order to achieve the above-mentioned object, the present invention provides a multi-bit multi-bit counter in which a two-phase pulse is input and an addition count or a subtraction count is performed in accordance with the advance or delay of the phase between the input pulses. A counter that outputs a numerical value, supplies a chip select signal to the counter at a predetermined cycle, captures the count value of the plurality of bits, compares the count value with the previously captured count value, and determines whether an overflow or underflow has occurred. And an arithmetic processing means for carrying up or down the currently read count value in accordance with the result of the determination.

【0008】前記演算処理手段は、前記カウンタから今
回取り込んだ計数値と前回取り込んだ計数値と比較対照
し、前回の計数値が上限値近傍所定範囲にあり、今回の
計数値が初期値近傍所定範囲にあった場合、オーバーフ
ローが1回発生したものと判定して桁上げを行い、前回
の計数値が初期値近傍所定範囲にあり、今回の計数値が
下限値近傍所定範囲にあった場合、アンダーフローが1
回発生したものと判定して桁下げを行うことを特徴とす
るものである。
The arithmetic processing means compares and compares the currently acquired count value from the counter with the previously acquired count value, the last count value is within a predetermined range near the upper limit value, and the current count value is within a predetermined range near the initial value. If it is within the range, it is determined that an overflow has occurred once, and carry is performed. If the previous count value is in the predetermined range near the initial value and the current count value is in the predetermined range near the lower limit value, 1 underflow
It is characterized in that it is determined that the number of occurrences has occurred and a carry-down is performed.

【0009】また、前記カウンタが、互いに所定位相だ
け異なるA相パルスとB相パルスの二相パルスが入力さ
れ、A相パルスがB相パルスよりも進相であれば加算計
数を行い、A相パルスがB相パルスよりも遅相であれば
減算計数を行うアップダウンカウンタであることを特徴
とするものである。
Further, the counter receives two-phase pulses of an A-phase pulse and a B-phase pulse which are different from each other by a predetermined phase, and if the A-phase pulse is more advanced than the B-phase pulse, adds and counts. If the pulse is later than the B-phase pulse, it is an up-down counter that performs subtraction counting.

【0010】[0010]

【発明の実施の形態】以下、本発明の実施形態を図1な
いし図3を参照して説明する。図1は、本発明の多ビッ
トカウンタ装置の一実施形態を示す概略構成図、図2
は、図1に示した多ビットカウンタ装置の計数動作を説
明するための動作原理図、図3は、図1に示したCPU
の動作を説明するためのフローチャートである。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to FIGS. FIG. 1 is a schematic configuration diagram showing an embodiment of a multi-bit counter device according to the present invention.
FIG. 3 is an operation principle diagram for explaining a counting operation of the multi-bit counter device shown in FIG. 1, and FIG. 3 is a CPU shown in FIG.
5 is a flowchart for explaining the operation of FIG.

【0011】図1に示す多ビットカウンタ装置11は、
A相パルス出力線路とB相パルス出力線路を介してエン
コーダ12に接続した8ビットカウンタIC13と、こ
のカウンタIC13に8ビットデータバスとチップセレ
クト信号線路を介して接続したCPU15とから構成さ
れる。カウンタIC13は、A相とB相の二相パルスが
入力され、入力パルス間の位相の進遅に応じて加算計数
又は減算計数を行い、8ビットの計数値を出力するもの
である。具体的には、A相パルスがB相パルスよりも進
相であれば加算計数を行い、A相パルスがB相パルスよ
りも遅相であれば減算計数を行うアップダウンカウンタ
で構成してある。
The multi-bit counter device 11 shown in FIG.
It comprises an 8-bit counter IC 13 connected to the encoder 12 via the A-phase pulse output line and the B-phase pulse output line, and a CPU 15 connected to the counter IC 13 via an 8-bit data bus and a chip select signal line. The counter IC 13 receives two-phase pulses of the A-phase and the B-phase, performs an addition count or a subtraction count in accordance with the advance or delay of the phase between the input pulses, and outputs an 8-bit count value. Specifically, an up-down counter is configured to perform an addition count if the A-phase pulse is earlier than the B-phase pulse, and perform a subtraction count if the A-phase pulse is later than the B-phase pulse. .

【0012】CPU15は、所定周期(例えば、5m
s)でチップセレクト信号をカウンタIC13に供給
し、データバスを介して8ビット計数値を取り込む。ま
た、前回取り込んだ計数値と今回取り込んだ計数値を比
較対照し、チップセレクト周期内で発生したオーバーフ
ロー又はアンダーフローの有無を判定し、この判定結果
に従って今回取り込んだ計数値の桁上げ又は桁下げを行
う。具体的には、前回の計数値がC0h〜FFhの間に
あり、今回の計数値が00h〜40hの間にあった場合
は、オーバーフローが1回発生したものと判定し、上位
バイト値を桁上げする。また前回の計数値が00h〜4
0hの間にあり、今回の計数値がC0h〜FFhの間に
あった場合は、アンダーフローが1回発生したものと判
定し、上位バイト値を桁下げする。
The CPU 15 has a predetermined period (for example, 5 m
In step s), a chip select signal is supplied to the counter IC 13, and an 8-bit count value is fetched via the data bus. In addition, the previously captured count value is compared with the currently captured count value to determine whether an overflow or underflow has occurred within the chip select cycle, and carry or decrement the currently captured count value according to the determination result. I do. Specifically, when the previous count value is between C0h and FFh and the current count value is between 00h and 40h, it is determined that one overflow has occurred, and the upper byte value is carried. . Also, the last count value is 00h to 4
If the count value is between 0h and the current count value is between C0h and FFh, it is determined that one underflow has occurred, and the upper byte value is lowered.

【0013】カウンタIC13の出力データは、図2に
示したように、正負8ビット(80h〜7Fh)の幅を
もった計数範囲(領域イ)内を往来する。CPU15
は、上位バイト計数値の桁上げ・桁下げ判定を行うた
め、5ms毎に前回と今回の計数値をストアし、両者を
比較対照してカウンタIC13のオーバフロー或いはア
ンダーフローの有無をチェックする。ただし、カウンタ
IC13が出力する計数値が必ずしも連続的に変化せず
データ飛びを生ずる可能性があるため、データ飛びを生
じてもオーバフローとアンダーフローを確実に捕捉でき
るよう、上限値近傍と初期値近傍に設ける判定幅を、図
2に梨地模様を付して示したC0h〜40hに設定して
ある。
As shown in FIG. 2, the output data of the counter IC 13 travels within a counting range (area A) having a width of positive and negative 8 bits (80h to 7Fh). CPU15
Stores the count value of the previous time and the count value of the present time every 5 ms in order to determine whether the upper byte count value carries or decrements, and compares the two values to check for overflow or underflow of the counter IC 13. However, since the count value output by the counter IC 13 does not always change continuously and there is a possibility that data skipping occurs, even if data skipping occurs, an overflow and an underflow can be reliably detected so that the vicinity of the upper limit and the initial value can be captured. The determination width provided in the vicinity is set to C0h to 40h shown with a satin pattern in FIG.

【0014】舵角の計測に際し、CPU15はまず、図
3のステップ(101)においてカウンタIC13から
今回の計数値の取り込みを行い、続くステップ以下にお
いて前回の計数値と比較する。ここで、例えば前回の計
数値がC0h〜FFhの間(領域ロ)にあり、今回の計
数値が00h〜40hの間(領域ハ)にあった場合、判
断ステップ(102)の判断肯定結果を受けた判断ステ
ップ(103)に続くステップ(104)において、オ
ーバーフローが1回発生したものと判定し、上位バイト
値をを桁上げする。また前回の計数値が00h〜40h
の間(領域ニ)にあり、今回の計数値がC0h〜FFh
の間(領域ホ)にあった場合は、判断ステップ(10
5)の判断肯定結果を受けた判断ステップ(106)に
続くステップ(107)において、アンダーフローが1
回発生したものと判定し、上位バイト値を桁下げする。
なお、上記以外の計数値変化については、カウンタIC
13の計数値にオーバフローもアンダーフローも発生し
なかったものとみなし、上位バイト値として前回値を継
続して採用する。かくして、CPU15によるソフトウ
ェア処理により決定された上位バイト値は、ステップ
(108)においてカウンタIC13の計数値に結合さ
れる。
In measuring the steering angle, the CPU 15 first takes in the current count value from the counter IC 13 in step (101) in FIG. 3, and compares it with the previous count value in the following steps. Here, for example, if the previous count value is between C0h and FFh (area B) and the current count value is between 00h and 40h (area C), the determination result of the determination step (102) is affirmed. In a step (104) following the received judgment step (103), it is determined that one overflow has occurred, and the upper byte value is carried. Also, the last count value is 00h to 40h
(Area d), and the current count value is C0h to FFh
(Area E), the judgment step (10)
In the step (107) following the judgment step (106) receiving the judgment positive result of the step 5), the underflow is 1
Is determined to have occurred once, and the upper byte value is lowered.
The change in the count value other than the above is determined by the counter IC.
It is considered that neither overflow nor underflow has occurred in the count value of 13, and the previous value is continuously adopted as the upper byte value. Thus, the upper byte value determined by the software processing by the CPU 15 is combined with the count value of the counter IC 13 in step (108).

【0015】このように、上記多ビットカウンタ装置1
1によれば、従来のキャリー信号計数用に設けていたカ
ウンタ4が不要になり、それだけ装置構成が簡単化さ
れ、製造コストの削減が可能であり、しかも桁上げや桁
下げがソフトウェア処理により判定されるため、チップ
セレクト信号の周期を十分に短い周期に設定しておくこ
とで、カウンタIC13の桁上がり又は桁下がりを見逃
すことなく確実に検出することができる。従って、従来
のように、下位バイト計数用カウンタ3から上位バイト
計数用カウンタ4に供給されるキャリー信号の伝搬時間
或いは下位バイトと上位バイトの読み込み時間差に起因
するデータエラーに左右されることはなく、常に正確な
計数値の取り込みが可能である。
As described above, the above multi-bit counter device 1
According to No. 1, the counter 4 provided for counting the carry signal in the related art is not required, so that the device configuration is simplified, the manufacturing cost can be reduced, and the carry and the carry can be determined by software processing. Therefore, by setting the cycle of the chip select signal to a sufficiently short cycle, it is possible to reliably detect the carry of the counter IC 13 without missing the carry. Therefore, unlike the related art, it is not affected by the propagation time of the carry signal supplied from the lower byte counting counter 3 to the upper byte counting counter 4 or the data error caused by the difference in reading time between the lower byte and the upper byte. In addition, it is possible to always take in accurate count values.

【0016】また、CPU15が、カウンタIC13か
ら今回取り込んだ計数値と前回取り込んだ計数値と比較
対照し、前回の計数値がC0h〜FFhの間にあり、今
回の計数値が00h〜40hの間にあった場合、オーバ
ーフローが1回発生したものと判定し、上位バイト値を
を桁上げし、また前回の計数値が00h〜40hの間に
あり、今回の計数値がC0h〜FFhの間にあった場合
は、アンダーフローが1回発生したものと判定し、上位
バイト値を桁下げするというように、今回取り込んだ計
数値と前回取り込んだ計数値との比較対照をもってオー
バーフローやアンダーフローを確実に検出することがで
き、しかもオーバーフローやアンダーフローの判定を単
純な線引き越境判定ではなく、ある程度の幅をもった領
域から領域への越境判定で行うため、カウンタ出力にデ
ータ飛びが発生しても桁上げや桁下げを確実に判定する
ことができる。
Further, the CPU 15 compares and compares the count value currently received from the counter IC 13 with the count value previously captured, and the previous count value is between C0h and FFh and the current count value is between 00h and 40h. In this case, it is determined that an overflow has occurred once, the upper byte value is carried, and if the previous count value is between 00h and 40h and the current count value is between C0h and FFh, , It is determined that an underflow has occurred once and the upper byte value is shifted down, so that overflow and underflow can be reliably detected by comparing the currently acquired count value with the previously acquired count value. In addition, the judgment of overflow or underflow is not a simple line-crossing boundary judgment, but rather an area with a certain width. To perform the judgment, jump data to the counter output can be reliably determined carry or borrow be generated.

【0017】また、カウンタIC13を、互いに所定位
相だけ異なるA相パルスとB相パルスの二相パルスが入
力され、A相パルスがB相パルスよりも進相であれば加
算計数を行い、A相パルスがB相パルスよりも遅相であ
れば減算計数を行うアップダウンカウンタで構成したか
ら、例えば互いに90度だけ位相のずれたA相パルスと
B相パルスを出力するた舵角検出用エンコーダ12等に
接続したことで、ステアリングホイールを正転させたと
きと逆転させたときとでA相パルスとB相パルスの進遅
関係が逆転することを捕らえ、舵角を正確に検出するこ
とができる。また、チップセレクト信号の周期は十分に
短い周期に設定できるため、カウンタIC13の桁上が
り又は桁下がりを見逃すことなく確実に検出することが
でき、急激なステアリング操作があっても、十分な応答
性をもって舵角を正確に検出できる。
If a two-phase pulse of an A-phase pulse and a B-phase pulse which are different from each other by a predetermined phase is input to the counter IC 13 and the A-phase pulse is earlier than the B-phase pulse, the counter IC 13 performs addition counting. If the pulse is later than the B-phase pulse, the encoder is constituted by an up-down counter that performs subtraction counting. For example, a steering angle detection encoder 12 that outputs an A-phase pulse and a B-phase pulse whose phases are shifted from each other by 90 degrees. By connecting the steering wheel and the like, it is possible to detect that the advance / delay relationship between the A-phase pulse and the B-phase pulse is reversed between when the steering wheel is rotated forward and when the steering wheel is rotated reversely, and the steering angle can be accurately detected. . In addition, since the cycle of the chip select signal can be set to a sufficiently short cycle, it is possible to reliably detect the carry or borrow of the counter IC 13 without overlooking it. With this, the steering angle can be accurately detected.

【0018】なお、上記実施形態では、多ビットカウン
タ装置11を舵角センサ用に用いた場合を例にとった
が、本発明の多ビットカウンタ装置は、正逆回転する回
転体の計測用として舵角センサ以外の用途にも適用する
ことができる。
In the above-described embodiment, the case where the multi-bit counter device 11 is used for a steering angle sensor is taken as an example. However, the multi-bit counter device of the present invention is used for measuring a rotating body that rotates normally and reversely. It can be applied to applications other than the steering angle sensor.

【0019】[0019]

【発明の効果】以上説明したように、本発明によれば、
二相パルスが入力され、入力パルス間の位相の進遅に応
じて加算計数又は減算計数を行い、複数ビットの計数値
を出力するカウンタから、演算処理手段が所定のチップ
セレクト周期をもって複数ビットの計数値を取り込み、
前回取り込んだ計数値と比較対照してオーバーフロー又
はアンダーフローの発生の有無を判定し、該判定結果に
従い今回取り込んだ計数値の桁上げ又は桁下げを行う構
成としたから、従来のキャリー信号計数用に設けていた
カウンタが不要になり、それだけ装置構成が簡単化さ
れ、製造コストの削減が可能であり、しかも桁上げや桁
下げがソフトウェア処理により判定されるため、チップ
セレクト信号の周期を十分に短い周期に設定しておくこ
とで、カウンタの桁上がり又は桁下がりを見逃すことな
く確実に検出することができ、従って従来のように、下
位バイト計数用カウンタから上位バイト計数用カウンタ
に供給されるキャリー信号の伝搬時間或いは下位バイト
と上位バイトの読み込み時間差に起因するデータエラー
に左右されることはなく、常に正確な計数値の取り込み
が可能である等の優れた効果を奏する。
As described above, according to the present invention,
A two-phase pulse is input, an addition count or a subtraction count is performed in accordance with the advance / delay of the phase between the input pulses, and a counter that outputs a count value of a plurality of bits is used by the arithmetic processing unit to generate a plurality of bits with a predetermined chip select cycle. Capture the count value,
Compared to the previously captured count value, the presence or absence of overflow or underflow is determined, and the carry value or carry-down of the currently captured count value is performed according to the determination result. The counter provided in the above is unnecessary, which simplifies the device configuration, reduces the manufacturing cost, and furthermore, since the carry and the carry are determined by software processing, the cycle of the chip select signal can be sufficiently increased. By setting the period to be short, it is possible to reliably detect the carry or borrow of the counter without overlooking it. Therefore, unlike the related art, the counter is supplied from the lower byte counter to the upper byte counter. It is not affected by data error caused by carry signal propagation time or reading time difference between lower byte and upper byte. Ku, excellent effects etc. are possible always accurate count uptake.

【0020】また、演算処理手段が、前記カウンタから
今回取り込んだ計数値と前回取り込んだ計数値と比較対
照し、前回の計数値が上限値近傍所定範囲にあり、今回
の計数値が初期値近傍所定範囲にあった場合、オーバー
フローが1回発生したものと判定して桁上げを行い、前
回の計数値が初期値近傍所定範囲にあり、今回の計数値
が下限値近傍所定範囲にあった場合、アンダーフローが
1回発生したものと判定して桁下げを行うので、例えば
8ビットカウンタを用いた場合、前回の計数値がC0h
〜FFhの間にあり、今回の計数値が00h〜40hの
間にあった場合、オーバーフローが1回発生したものと
判定し、上位バイト値をを桁上げし、また前回の計数値
が00h〜40hの間にあり、今回の計数値がC0h〜
FFhの間にあった場合は、アンダーフローが1回発生
したものと判定し、上位バイト値を桁下げするというよ
うに、今回取り込んだ計数値と前回取り込んだ計数値と
の比較対照をもってオーバーフローやアンダーフローを
確実に検出することができ、しかもオーバーフローやア
ンダーフローの判定を単純な線引き越境判定ではなく、
ある程度の幅をもった領域から領域への越境判定で行う
ため、カウンタ出力にデータ飛びが発生しても桁上げや
桁下げを確実に判定することができる等の効果を奏す
る。
In addition, the arithmetic processing means compares and compares the currently acquired count value from the counter with the previously acquired count value, the last count value is within a predetermined range near the upper limit value, and the current count value is near the initial value. If it is within the predetermined range, it is determined that an overflow has occurred once and carry is performed, and the previous count value is within the predetermined range near the initial value, and the current count value is within the predetermined range near the lower limit value. , The underflow is determined to have occurred once, and the carry is performed. For example, when an 8-bit counter is used, the previous count value is C0h.
If the current count value is between 00h and 40h, it is determined that one overflow has occurred, the upper byte value is carried, and the previous count value is between 00h and 40h. And the current count value is C0h ~
If it is between FFh, it is determined that an underflow has occurred once, and the overflow and underflow are performed by comparing the count value captured this time with the count value captured last time, such as lowering the upper byte value. Can be reliably detected, and the determination of overflow or underflow is not a simple line-crossing boundary determination,
Since the determination is made by crossing the boundary from a region having a certain width to the region, there is an effect that, even if data skipping occurs in the counter output, carry-up or carry-down can be reliably determined.

【0021】また、カウンタを、互いに所定位相だけ異
なるA相パルスとB相パルスの二相パルスが入力され、
A相パルスがB相パルスよりも進相であれば加算計数を
行い、A相パルスがB相パルスよりも遅相であれば減算
計数を行うアップダウンカウンタで構成したから、例え
ば互いに90度だけ位相のずれたA相パルスとB相パル
スを出力するた舵角検出用エンコーダ等に接続すれば、
ステアリングホイールを正転させたときと逆転させたと
きとでA相パルスとB相パルスの進遅関係が逆転するこ
とを捕らえ、舵角を正確に検出することができ、またチ
ップセレクト信号の周期は十分に短い周期に設定できる
ため、カウンタの桁上がり又は桁下がりを見逃すことな
く確実に検出することができ、急激なステアリング操作
があっても、十分な応答性をもって舵角を正確に検出で
きる等の効果を奏する。
The counter receives two-phase pulses of an A-phase pulse and a B-phase pulse which are different from each other by a predetermined phase.
If the A-phase pulse is more advanced than the B-phase pulse, an up-down counter that performs addition counting is performed, and if the A-phase pulse is later than the B-phase pulse, a down-counting counter is performed. If connected to a steering angle detection encoder that outputs A-phase and B-phase pulses with shifted phases,
It captures that the forward and backward relations of the A-phase pulse and the B-phase pulse are reversed when the steering wheel is rotated forward and reverse, and the steering angle can be detected accurately, and the cycle of the chip select signal can be detected. Can be set to a sufficiently short cycle, so that it is possible to reliably detect the carry or borrow of the counter without overlooking it, and even if there is a sudden steering operation, the steering angle can be accurately detected with sufficient responsiveness And so on.

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

【図1】本発明の多ビットカウンタ装置の一実施形態を
示す概略構成図である。
FIG. 1 is a schematic configuration diagram showing one embodiment of a multi-bit counter device of the present invention.

【図2】図1に示した多ビットカウンタ装置の計数動作
を説明するための動作原理図である。
FIG. 2 is an operation principle diagram for explaining a counting operation of the multi-bit counter device shown in FIG. 1;

【図3】図1に示したCPUの動作を説明するためのフ
ローチャートである。
FIG. 3 is a flowchart for explaining the operation of the CPU shown in FIG. 1;

【図4】従来の多ビットカウンタ装置の一例を示す概略
構成図である。
FIG. 4 is a schematic configuration diagram illustrating an example of a conventional multi-bit counter device.

【符号の説明】[Explanation of symbols]

11 多ビットカウンタ装置 12 エンコーダ 13 カウンタIC(カウンタ) 15 CPU(演算処理手段) 11 Multi-bit counter device 12 Encoder 13 Counter IC (Counter) 15 CPU (Operation processing means)

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 二相パルスが入力され、入力パルス間の
位相の進遅に応じて加算計数又は減算計数を行い、複数
ビットの計数値を出力するカウンタと、所定周期でチッ
プセレクト信号を前記カウンタに供給し、前記複数ビッ
トの計数値を取り込み、前回取り込んだ計数値と比較対
照してオーバーフロー又はアンダーフローの発生の有無
を判定し、該判定結果に従い今回取り込んだ計数値の桁
上げ又は桁下げを行う演算処理手段とを具備することを
特徴とする多ビットカウンタ装置。
1. A counter for receiving a two-phase pulse, performing an addition count or a subtraction count in accordance with the advance / delay of the phase between the input pulses, and outputting a count value of a plurality of bits. The count value of the plurality of bits is supplied to the counter, the count value of the plurality of bits is captured, the presence or absence of occurrence of overflow or underflow is determined by comparing with the previously captured count value, and the carry or digit of the currently captured count value is determined according to the determination result. A multi-bit counter device, comprising: an arithmetic processing unit for performing a reduction.
【請求項2】 前記演算処理手段は、前記カウンタから
今回取り込んだ計数値と前回取り込んだ計数値と比較対
照し、前回の計数値が上限値近傍所定範囲にあり、今回
の計数値が初期値近傍所定範囲にあった場合、オーバー
フローが1回発生したものと判定して桁上げを行い、前
回の計数値が初期値近傍所定範囲にあり、今回の計数値
が下限値近傍所定範囲にあった場合、アンダーフローが
1回発生したものと判定して桁下げを行うことを特徴と
する請求項1記載の多ビットカウンタ装置。
2. The arithmetic processing means compares and compares the currently acquired count value from the counter with a previously acquired count value, the previous count value is within a predetermined range near an upper limit value, and the current count value is an initial value. If it is within the predetermined range, it is determined that an overflow has occurred once, and carry is performed. The previous count value was within the predetermined range near the initial value, and the current count value was within the predetermined range near the lower limit value. 2. The multi-bit counter device according to claim 1, wherein in the case, the underflow is determined to have occurred once and the carry is performed.
【請求項3】 前記カウンタは、互いに所定位相だけ異
なるA相パルスとB相パルスの二相パルスが入力され、
A相パルスがB相パルスよりも進相であれば加算計数を
行い、A相パルスがB相パルスよりも遅相であれば減算
計数を行うアップダウンカウンタであることを特徴とす
る請求項1記載の多ビットカウンタ装置。
3. The counter receives a two-phase pulse of an A-phase pulse and a B-phase pulse that differ from each other by a predetermined phase,
2. An up-down counter which performs an addition count when the A-phase pulse is earlier than the B-phase pulse and performs a subtraction count when the A-phase pulse is later than the B-phase pulse. A multi-bit counter device as described.
JP10250717A 1998-09-04 1998-09-04 Multi-bit counter device Pending JP2000082952A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10250717A JP2000082952A (en) 1998-09-04 1998-09-04 Multi-bit counter device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10250717A JP2000082952A (en) 1998-09-04 1998-09-04 Multi-bit counter device

Publications (1)

Publication Number Publication Date
JP2000082952A true JP2000082952A (en) 2000-03-21

Family

ID=17212012

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10250717A Pending JP2000082952A (en) 1998-09-04 1998-09-04 Multi-bit counter device

Country Status (1)

Country Link
JP (1) JP2000082952A (en)

Similar Documents

Publication Publication Date Title
JP2001165951A (en) Detected signal processor for rotary sensor and output method for detecting signal of the rotary sensor
JP2720642B2 (en) Multi-turn absolute value encoder
JP2690210B2 (en) Elevator speed detector
JP2000082952A (en) Multi-bit counter device
JPH06118090A (en) Speed detector
JPH109894A (en) Method for detecting abnormality of encoder signal in motor control device
JPH061279B2 (en) Digital speed detector
JPH04346069A (en) Speed signal generating circuit
JPS61266964A (en) Processor for period data on pulse signal
Rull et al. Programmable logic design for an encoder-based velocity sensor in a DSP-controlled motion system
JP2582786Y2 (en) Encoder counter
KR19990043005A (en) Motor speed detection device using incremental encoder
KR100286043B1 (en) speed detecting system and method thereof
JPH04233467A (en) Method and apparatus for measuring speed of motor
JPS62259101A (en) Speed arithmetic system
JP2791906B2 (en) Counter device
JPH06186055A (en) Method for reading phase difference type rotary encoder
JPH07151775A (en) Speed detecting device
JPH02250686A (en) Rotation direction detector for motor
JPS6161060A (en) Two-phase pulse directivity discriminating circuit
JP2990111B2 (en) Timer circuit
JP2891472B2 (en) Speed signal detection circuit
JPH0375567A (en) Detecting system of speed
JPH0351764A (en) Apparatus for detecting speed and acceleration
JPS63185136A (en) Sampling clock recovery circuit

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20030128