Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP2536199B2 - Counter device - Google Patents
[go: Go Back, main page]

JP2536199B2 - Counter device - Google Patents

Counter device

Info

Publication number
JP2536199B2
JP2536199B2 JP1318415A JP31841589A JP2536199B2 JP 2536199 B2 JP2536199 B2 JP 2536199B2 JP 1318415 A JP1318415 A JP 1318415A JP 31841589 A JP31841589 A JP 31841589A JP 2536199 B2 JP2536199 B2 JP 2536199B2
Authority
JP
Japan
Prior art keywords
counter
value
software
writing
written
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 - Fee Related
Application number
JP1318415A
Other languages
Japanese (ja)
Other versions
JPH03177914A (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.)
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 JP1318415A priority Critical patent/JP2536199B2/en
Publication of JPH03177914A publication Critical patent/JPH03177914A/en
Application granted granted Critical
Publication of JP2536199B2 publication Critical patent/JP2536199B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Executing Machine-Instructions (AREA)

Description

【発明の詳細な説明】 [産業上の利用分野] この発明は、情報処理装置に備えられ、ソフトウェア
による制御が可能なりロードレジスタ付きタイマ/カウ
ンタ等のカウンタ装置に関するものである。
Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a counter device such as a timer / counter equipped with an information processing device, which can be controlled by software and has a load register.

[従来の技術] 従来技術では、リロードレジスタの読み出し/書き込
み動作で取り扱う値はリロードレジスタの値そのもので
あり、カウンタの読み出し/書き込み動作で取り扱う値
はカウンタの値そのものである。
[Prior Art] In the prior art, the value handled by the read / write operation of the reload register is the value of the reload register itself, and the value handled by the read / write operation of the counter is the value of the counter itself.

第3図は、従来技術によるリロードレジスタ付きタイ
マ/カウンタを示す構成図である。図において、1はリ
ロードレジスタ、2はカウンタ、3はカウンタ2への入
力クロックΦの伝達を制御することによりカウンタ2の
起動/停止を制御するスイッチ、4は図示しないプロセ
ッサ等に接続されたデータバスである。
FIG. 3 is a block diagram showing a conventional timer / counter with a reload register. In the figure, 1 is a reload register, 2 is a counter, 3 is a switch for controlling start / stop of the counter 2 by controlling transmission of an input clock Φ to the counter 2, 4 is data connected to a processor or the like not shown. It's a bus.

以上の構成において、ソフトウェアによりリロードレ
ジスタ1の読み出し/書き込みを行なうと、データバス
4とリロードレジスタ1の間でデータの受け渡しが行な
われる(図中5の矢印でこの動作を示した)。また、ソ
フトウェアによりカウンタ2の読み出し/書き込みを行
なうと、データバス4とカウンタ2の間でデータの受け
渡しが行なわれる(図中6の矢印でこの動作を示し
た)。カウンタ2がターミナルカウント値(カウンタの
ハードウェア構成により決定される最終カウント値で、
通常全ビット“0"又は全ビット“1"の時を指す)に到達
すると、リロードレジスタ1の内容がカウンタ2にロー
ドされる(図中7の矢印でこの動作を示した)。
In the above configuration, when the reload register 1 is read / written by software, data is transferred between the data bus 4 and the reload register 1 (this operation is indicated by an arrow 5 in the figure). When the counter 2 is read / written by software, data is transferred between the data bus 4 and the counter 2 (this operation is indicated by an arrow 6 in the figure). Counter 2 is the terminal count value (the final count value determined by the hardware configuration of the counter,
Normally, when all bits "0" or all bits "1" are reached), the content of the reload register 1 is loaded into the counter 2 (this operation is shown by an arrow 7 in the figure).

[発明が解決しようとする課題] ところで、タイマ/カウンタの応用上重要な操作に、
「動作中のカウンタ値修正」がある。この場合、ターミ
ナルカウント値の発生をnクロックだけ延期する操作を
行なうことになる。従来技術による上記リロードレジス
タ付きタイマ/カウンタでは、カウンタ2の値そのもの
を書き直す必要があるため、補正必要値nを用いて「補
正後のカウンタ値」をソフトウェアで計算する必要があ
る。「補正後のカウンタ値」は、 で計算されるわけであるが、「S/Wオーバヘッド」はソ
フトウェアを実行するプロセッサのハードウェアの制約
(命令実行時間やバスの空き具合など)により詳細な予
測は不可能である。従って、正確な「補正後のカウンタ
値」を算出できないため、高速リアルタイム制御等に必
須となる正確な「動作中のカウンタ値修正」は実現でき
ないという課題があった。
[Problems to be Solved by the Invention] By the way, for important operations in the application of the timer / counter,
There is "correction of counter value during operation". In this case, the operation of delaying the generation of the terminal count value by n clocks is performed. In the above-described timer / counter with a reload register according to the prior art, the value itself of the counter 2 needs to be rewritten, so that the “corrected counter value” needs to be calculated by software using the correction required value n. "Corrected counter value" is However, the "S / W overhead" cannot be predicted in detail because of the hardware constraints of the processor that executes the software (such as instruction execution time and bus availability). Therefore, there is a problem in that an accurate “corrected counter value” cannot be calculated, and thus an accurate “correction of counter value during operation”, which is essential for high-speed real-time control or the like, cannot be realized.

以上の内容を図示したのが第4図である。タイミング
Aでカウンタ値の読み出しを行ない、期間Cで補正後の
カウンタ値を計算し、この結果をタイミングBでカウン
タに書き込む。期間CはタイミングA〜タイミングBの
間隔であるが、これを正確に予測することができないた
め問題を発生する。
FIG. 4 illustrates the above contents. The counter value is read at timing A, the corrected counter value is calculated during period C, and the result is written to the counter at timing B. The period C is the interval from timing A to timing B, but this cannot be predicted accurately, which causes a problem.

この発明は上記のような課題を解決するためになされ
たもので、動作中のカウンタ値を精度良く補正できるも
のを得ることを目的とする。
The present invention has been made to solve the above problems, and an object thereof is to obtain a counter value that can be accurately corrected during operation.

[課題を解決するための手段] この発明では、ソフトウェアにより書き込まれる値と
カウンタの現在値とを加算する加算手段と、カウンタの
起動,停止に連動して、カウンタ動作中は上記加算手段
の出力値をカウンタに書き込み,カウンタ停止中はソフ
トウェアにより書き込まれる値をそのままカウンタに書
き込む切換手段とを備えたものである。
[Means for Solving the Problem] According to the present invention, an adding means for adding a value written by software and the current value of the counter, and an output of the adding means during the operation of the counter in association with the start and stop of the counter. It is provided with a switching means for writing a value to the counter and writing the value written by the software to the counter as it is while the counter is stopped.

また、上記カウンタ動作中において、ソフトウェアに
よる書き込みから加算手段の出力値をカウンタへ書き込
むまでの期間が、加算手段の動作時間のみにより決定さ
れるものである。
Further, during the counter operation, the period from writing by software to writing the output value of the adding means in the counter is determined only by the operating time of the adding means.

[作用] この発明において、動作中のカウンタへの書き込み動
作で取り扱う値はカウンタの値そのものではなく、カウ
ンタの補正に真に必要な「補正必要値」であり、カウン
タの現在値はソフトウェアによる読み出し〜補正計算の
手順をふむことなく、本装置内に備えられた加算手段で
上記ソフトウェアにより書き込まれる補正必要値と加算
され、その結果が切換手段を介してカウンタにロード,
すなわち書き込まれる。また、停止中のカウンタへの書
き込み動作で取り扱う値はカウンタの値そのものであ
り、ソフトウェアにより書き込まれる値が切換手段を介
してそのままカウンタに書き込まれるため、カウンタの
初期値設定も容易に行なうことができる。
[Operation] In the present invention, the value handled in the writing operation to the counter during operation is not the value of the counter itself but the “correction required value” that is truly necessary for the correction of the counter, and the current value of the counter is read by software. ~ Without adding the correction calculation procedure, the addition means provided in the apparatus adds the correction required value written by the software, and the result is loaded into the counter via the switching means.
That is, it is written. Further, the value handled by the writing operation to the counter while stopped is the counter value itself, and the value written by the software is written to the counter as it is through the switching means. Therefore, the initial value of the counter can be easily set. it can.

また、動作中のカウンタへの補正必要値の書き込みか
らカウンタ値が補正されるまでの期間は加算手段の動作
オーバヘッド,すなわち動作時間のみで決まるため、極
めて短く,かつプロセッサのハードウェア制約を受けな
い。
In addition, the period from the writing of the correction required value to the counter during operation to the correction of the counter value is determined only by the operation overhead of the adding means, that is, the operation time, so it is extremely short and is not subject to hardware restrictions of the processor. .

[実施例] 以下、この発明の一実施例を図について説明する。[Embodiment] An embodiment of the present invention will be described below with reference to the drawings.

第1図は実施例によるリロードレジスタ付きタイマ/
カウンタを示す構成図であり、第3図の従来例と同一,
又は相当部分には同一符号を用いてその説明は省略す
る。図において、11はソフトウェアによりデータバス4
を介して書き込まれる値を一時格納するカウンタバッフ
ァ、12は上記カウンタバッファ11の出力,すなわちソフ
トウェアにより書き込まれた値と、カウンタ2の出力,
すなわちカウンタ2の現在値とを加算して出力する加算
回路(加算手段)、13はスイッチ3が閉じている場合,
すなわちカウンタ2が動作している場合に閉じるように
制御され、加算回路12の加算結果をカウンタ2に書き込
めるようにするスイッチ、14はスイッチ3が開いている
場合,すなわちカウンタ2が停止している場合に閉じる
ように制御され、ソフトウェアにより書き込まれる値を
直接カウンタ2に書き込めるようにするスイッチであ
り、上記スイッチ13,14は本題の切換手段を構成する。
FIG. 1 shows a timer with a reload register according to an embodiment.
It is a block diagram showing a counter, the same as the conventional example of FIG.
Alternatively, the same reference numerals are used for corresponding portions and the description thereof will be omitted. In the figure, 11 is a data bus 4 by software.
A counter buffer for temporarily storing a value written via the counter, an output of the counter buffer 11, that is, a value written by software and an output of the counter 2,
That is, an adder circuit (adder means) for adding and outputting the current value of the counter 2, 13 is a switch when the switch 3 is closed,
That is, the switch is controlled so as to be closed when the counter 2 is operating, and allows the addition result of the adder circuit 12 to be written in the counter 2. Reference numeral 14 is a switch 3 when the switch 3 is open, that is, the counter 2 is stopped. In this case, the switches 13 and 14 are controlled so as to be closed so that the value written by software can be directly written in the counter 2, and the switches 13 and 14 constitute the switching means of the main subject.

次に動作について説明する。 Next, the operation will be described.

ソフトウェアによりリロードレジスタ1の読み出し/
書き込みを行なうと、従来同様,データバス4とリロー
ドレジスタ1の間でデータの受け渡しが行なわれる(図
中5の矢印でこの動作を示した)。また、カウンタ2が
ターミナルカウント値に到達すると、従来同様,リロー
ドレジスタ1の内容がカウンタ2にロードされる(図中
7の矢印でこの動作を示した)。
Read reload register 1 by software /
When writing is performed, data is transferred between the data bus 4 and the reload register 1 as in the conventional case (this operation is indicated by an arrow 5 in the figure). When the counter 2 reaches the terminal count value, the contents of the reload register 1 are loaded into the counter 2 as in the conventional case (this operation is indicated by the arrow 7 in the figure).

一方、ソフトウェアによるカウンタ2への書き込み動
作はカウンタ2が動作中か停止中かにより異なる。動作
中のカウンタ2への書き込み動作で取り扱う値は補正必
要値であり、このときスイッチ3は閉となるので、スイ
ッチ13は閉,スイッチ14は開となっている。ここで、ソ
フトウェアによりカウンタ2への書き込みを行なうと、
データバス4からカウンタバッファ11へデータ転送が行
なわれる(図中15の矢印でこの動作を示した)。カウン
タバッファ11にデータが書き込まれると、加算回路12
は、上記カウンタバッファ11の内容,すなわちカウンタ
2の補正必要値と、その時のカウンタ2の内容,すなわ
ちカウンタ2の現在値とを加算し、その結果をスイッチ
13を介してカウンタ2へ書き戻す。なお、このカウンタ
2へ値を書き戻す操作は、ソフトウェアによりカウンタ
2への書き込みを行なった際に一回だけ発生する。ま
た、停止中のカウンタ2への書き込み動作で取り扱う値
はカウンタの値そのものであり、このときスイッチ3は
開となるので、スイッチ13は開,スイッチ14は閉となっ
ている。従って、初期値設定のため停止中のカウンタ2
にソフトウェアにより書き込みを行なう場合は、データ
バス4からスイッチ14を介してカウンタ2ヘデータ転送
が行なわれ、カウンタの値そのものが書き込まれる。な
お、ソフトウェアによりカウンタ2の読み出しを行なう
と、カウンタ2からデータバス4へデータ転送が行なわ
れる。カウンタ2の読み出し動作で取り扱う値は、カウ
ンタ2の値そのものである(図中16の矢印でこの動作を
示した)。
On the other hand, the writing operation to the counter 2 by software differs depending on whether the counter 2 is operating or stopped. The value handled in the writing operation to the counter 2 during operation is a correction required value. At this time, since the switch 3 is closed, the switch 13 is closed and the switch 14 is open. Here, when writing to the counter 2 by software,
Data is transferred from the data bus 4 to the counter buffer 11 (this operation is indicated by the arrow 15 in the figure). When the data is written in the counter buffer 11, the adder circuit 12
Adds the content of the counter buffer 11, that is, the correction required value of the counter 2, and the content of the counter 2 at that time, that is, the current value of the counter 2, and switches the result.
Write back to counter 2 via 13. The operation of writing back the value to the counter 2 occurs only once when the writing to the counter 2 is performed by software. Further, the value handled by the writing operation to the counter 2 which is stopped is the counter value itself. At this time, since the switch 3 is open, the switch 13 is open and the switch 14 is closed. Therefore, the counter 2 which is stopped for the initial value setting
When writing is performed by software, data is transferred from the data bus 4 to the counter 2 via the switch 14, and the value of the counter itself is written. When the counter 2 is read by software, the data is transferred from the counter 2 to the data bus 4. The value handled by the reading operation of the counter 2 is the value of the counter 2 itself (indicated by the arrow 16 in the figure).

第2図は動作中のカウンタ2へのソフトウェアによる
書き込み動作を示したものである。タイミングBで動作
中のカウンタ2へ補正必要値を書き込むと、期間C後に
カウンタ値が補正される。ここで、期間Cは加算回路12
の動作オーバヘッドのみで決まるため、極めて短く,か
つプロセッサのハードウェアの制約により不確定さが排
除されている。また、このときプロセッサは、ソフトウ
ェアによるカウンタ値の読み出し〜補正計算を行なう必
要がないので、その負荷が大幅に軽減される。
FIG. 2 shows a write operation by software to the counter 2 during operation. When the correction required value is written in the counter 2 operating at the timing B, the counter value is corrected after the period C. Here, the period C is for the adder circuit 12
Since it is determined only by the operation overhead of, the uncertainty is extremely short and the uncertainty of the processor hardware limits the uncertainty. Further, at this time, the processor does not need to read the counter value through software and perform correction calculation, so that the load is significantly reduced.

[発明の効果] 以上のように、この発明によれば、ソフトウェアによ
り書き込まれる値とカウンタの現在値とを加算する加算
手段と、カウンタの起動,停止に連動して、カウンタ動
作中は上記加算手段の出力率をカウンタに書き込み,カ
ウンタ停止中はソフトウェアにより書き込まれる値をそ
のままカウンタに書き込む切換手段とを備えたので、動
作中のカウンタの補正を精度良く行なうことができ、か
つソフトウェアによる補正計算を必要としないので、プ
ロセッサの負荷を軽減することができる。また、停止中
のカウンタへの初期値設定も容易である。
[Effects of the Invention] As described above, according to the present invention, the addition means for adding the value written by software and the current value of the counter, and the above addition during the operation of the counter in conjunction with the start and stop of the counter. Since the output ratio of the means is written in the counter and the value written by the software is written in the counter as it is while the counter is stopped, the counter can be corrected accurately while operating, and the correction calculation by the software can be performed. Is not required, the load on the processor can be reduced. In addition, it is easy to set the initial value to the stopped counter.

また、カウンタ動作中において、ソフトウェアによる
書き込みから加算手段の出力値をカウンタへ書き込むま
での期間は、加算手段の動作時間のみにより決定される
ので、極めて短く,かつプロセッサのハードウェア制約
を受けない。
Further, during the counter operation, the period from the writing by the software to the writing of the output value of the adding means to the counter is determined only by the operating time of the adding means, so it is extremely short and is not restricted by the hardware of the processor.

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

第1図は本発明の一実施例によるリロードレジスタ付き
タイマ/カウンタを示す構成図、第2図は本発明の実施
例の動作を説明するためのタイミング図、第3図は従来
技術によるリロードレジスタ付きタイマ/カウンタを示
す構成図、第4図は従来技術による動作を説明するため
のタイミング図である。 1はリロードレジスタ、2はカウンタ、3はスイッチ、
4はデータバス、11はカウンタバッファ、12は加算回路
(加算手段)、13,14はスイッチ(切換手段)。 なお、図中、同一符号は同一、又は相当部分を示す。
FIG. 1 is a block diagram showing a timer / counter with a reload register according to an embodiment of the present invention, FIG. 2 is a timing diagram for explaining the operation of the embodiment of the present invention, and FIG. 3 is a reload register according to the prior art. FIG. 4 is a configuration diagram showing a built-in timer / counter, and FIG. 4 is a timing diagram for explaining the operation according to the conventional technique. 1 is a reload register, 2 is a counter, 3 is a switch,
4 is a data bus, 11 is a counter buffer, 12 is an adder circuit (adding means), and 13 and 14 are switches (switching means). In the drawings, the same reference numerals indicate the same or corresponding parts.

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】ソフトウェアによる読み出し及び書き込み
が可能なカウンタを備えたカウンタ装置において、 ソフトウェアにより書き込まれる値とカウンタの現在値
とを加算する加算手段と、カウンタの起動,停止に連動
して、カウンタ動作中は上記加算手段の出力値をカウン
タに書き込み,カウンタ停止中はソフトウェアにより書
き込まれる値をそのままカウンタに書き込む切換手段と
を備えたことを特徴とするカウンタ装置。
1. A counter device having a counter readable and writable by software, comprising: an addition means for adding a value written by software and a current value of the counter; A counter device comprising: a switching means for writing the output value of the adding means to the counter during operation and for writing the value written by the software to the counter while the counter is stopped.
【請求項2】カウンタ動作中において、ソフトウェアに
よる書き込みから加算手段の出力値をカウンタへ書き込
むまでの期間が、加算手段の動作時間のみにより決定さ
れることを特徴とする請求項1記載のカウンタ装置。
2. The counter device according to claim 1, wherein during the counter operation, the period from the writing by the software to the writing of the output value of the adding means in the counter is determined only by the operating time of the adding means. .
JP1318415A 1989-12-06 1989-12-06 Counter device Expired - Fee Related JP2536199B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1318415A JP2536199B2 (en) 1989-12-06 1989-12-06 Counter device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1318415A JP2536199B2 (en) 1989-12-06 1989-12-06 Counter device

Publications (2)

Publication Number Publication Date
JPH03177914A JPH03177914A (en) 1991-08-01
JP2536199B2 true JP2536199B2 (en) 1996-09-18

Family

ID=18098898

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1318415A Expired - Fee Related JP2536199B2 (en) 1989-12-06 1989-12-06 Counter device

Country Status (1)

Country Link
JP (1) JP2536199B2 (en)

Also Published As

Publication number Publication date
JPH03177914A (en) 1991-08-01

Similar Documents

Publication Publication Date Title
JPH05274259A (en) Serial input interface circuit
JPH01237864A (en) Dma transfer controller
US5499348A (en) Digital processor capable of concurrently executing external memory access and internal instructions
JP2536199B2 (en) Counter device
JPH02312407A (en) Counter device
JPH0573296A (en) Microcomputer
JPH02133833A (en) Controller for in-circuit emulator
JPS63732A (en) Control system for interruption factor register
JPH01193943A (en) Micro computer
JPH04195344A (en) Register file read mechanism
JPH01240941A (en) Information processor
JPH0667929A (en) Breakpoint setting device
JPH01280918A (en) Interval timer
JPH0194437A (en) Information processor
JPS6220041A (en) Asynchronous data transfer circuit for data processor
JPS58121432A (en) Memory control circuit
JPH03288241A (en) Register device
JPH01205338A (en) Instruction control system
JPS60129841A (en) Interruption control circuit
JPS60225254A (en) Computer of two-phase sequence system
JPH09325935A (en) Bus switching circuit
JPH0399338A (en) Microprocessor
JPS61143848A (en) Microprogram controller
JPH06139076A (en) Interruption processor
JPH0318932A (en) Instruction read control system

Legal Events

Date Code Title Description
S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees