JPH04225409A - Microcomputer system - Google Patents

Microcomputer system

Info

Publication number
JPH04225409A
JPH04225409A JP2407561A JP40756190A JPH04225409A JP H04225409 A JPH04225409 A JP H04225409A JP 2407561 A JP2407561 A JP 2407561A JP 40756190 A JP40756190 A JP 40756190A JP H04225409 A JPH04225409 A JP H04225409A
Authority
JP
Japan
Prior art keywords
timer
bit
counter
data
register
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
JP2407561A
Other languages
Japanese (ja)
Inventor
Naomiki Mitsuishi
直幹 三ッ石
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2407561A priority Critical patent/JPH04225409A/en
Publication of JPH04225409A publication Critical patent/JPH04225409A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the burden of a CPU by providing a means which holds the data in addition to a conventional timer and a means which processes the held data after a prescribed time. CONSTITUTION:The processing means include a 2nd counter 15 which counts down its value at each prescribed time passed, a shift circuit 17 which rotates at each prescribed time, an adder/subtractor circuit 19 which adds or subtracts the contents of a comparison register 120 at each prescribed time, etc. Therefore a part or the whole of the processing to be carried out by a CPU can be carried out by the hardware of a timer with a signal (a) received from the timer when a prescribed time passed. As a result, the burden of the CPU is reduced and the overall processing time of a single chip microcomputer can be shortened.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明はデ−タ処理装置に係り、
例えば、シングルチップマイクロコンピュ−タに内蔵さ
れるタイマに利用して有効な技術に関するものである。
[Industrial Application Field] The present invention relates to a data processing device.
For example, it relates to a technique that is effective for use in a timer built into a single-chip microcomputer.

【0002】0002

【従来の技術】シングルチップマイクロコンピュ−タに
内蔵されるタイマは、例えば、カウンタ、比較レジスタ
及び比較器等から構成され、上記カウンタは指定された
クロックに従ってカウントアップされる。上記カウンタ
と上記比較レジスタの内容は比較器によって、常に比較
されている。上記カウンタがオ−バフロ−したり、上記
カウンタと上記比較器の内容が一致したときに、CPU
( central processingunit 
:中央処理装置)に対して割込みを要求することができ
る。上記CPUはこの割込み要求によって、所定の処理
を行う。
2. Description of the Related Art A timer built into a single-chip microcomputer is composed of, for example, a counter, a comparison register, a comparator, etc., and the counter is counted up according to a designated clock. The contents of the counter and the comparison register are constantly compared by a comparator. When the above counter overflows or the contents of the above counter and the above comparator match, the CPU
(central processing unit
: can request an interrupt to the central processing unit. The CPU performs predetermined processing in response to this interrupt request.

【0003】しかしながら、上記CPUが上記の処理を
行う場合は、他の処理を中断しなければならず、シング
ルチップマイクロコンピュ−タが実行すべき処理全体の
実行時間の低下を生ずる。また、上記の処理を実現する
ためのソフトウェアを開発しなければならず、上記のシ
ングルチップマイクロコンピュ−タを用いたシステムの
開発期間が増加する。
However, when the CPU performs the above processing, it must interrupt other processing, resulting in a reduction in the execution time of the entire processing to be executed by the single-chip microcomputer. Furthermore, software must be developed to implement the above processing, which increases the development period for a system using the single-chip microcomputer.

【0004】これに対して、上記所定時間に達した時に
、所定の出力端子の出力レベルを変化させるようにした
タイマの例や、比較レジスタと比較器を複数組備えたタ
イマの例に(株)日立製作所昭和63年12月発行の『
H8/532HD6475328  HD643532
8  ハ−ドウェアマニュアル』等がある。これらは、
方形波の出力などをソフトウェアの介在なしに実現する
ことができるが、単純な波形出力以外はソフトウェアに
より実行しなければならない。
On the other hand, there are examples of timers that change the output level of a predetermined output terminal when the predetermined time is reached, and examples of timers that are equipped with multiple sets of comparison registers and comparators. ) Published by Hitachi, Ltd. in December 1988.
H8/532HD6475328 HD643532
8 Hardware Manual, etc. these are,
Although it is possible to output square waves and the like without the intervention of software, anything other than simple waveform output must be executed by software.

【0005】[0005]

【発明が解決しようとする課題】本発明者は上記シング
ルチップマイクロコンピュ−タのタイマを用いて制御さ
れるシステムの検討を行った。例えば、4極2相のステ
ッピングモ−タの制御を行うには、図24に示すように
ステッピングモ−タを駆動するコイル2本の両端を制御
するのに少なくとも4本の出力端子が必要である。これ
らの端子はシングルチップマイクロコンピュ−タの汎用
の出力ポ−ト又は入出力ポ−トを使用すればよい。しか
しながら、これらのコイルの両端が同時にハイレベルと
ならないようにしなければならない。この場合、CPU
はステッピングモ−タが1ステップ回転する毎に、出力
デ−タを変化させなければならず、また、ステッピング
モ−タが何回転したかを管理しなければならない。この
ように、シングルチップマイクロコンピュ−タのタイマ
を用いた制御において、アプリケ−ションによってはC
PUの負担が非常に大きくなる。
SUMMARY OF THE INVENTION The present inventor has studied a system controlled using the timer of the single-chip microcomputer described above. For example, to control a four-pole, two-phase stepping motor, at least four output terminals are required to control both ends of two coils that drive the stepping motor, as shown in FIG. For these terminals, general-purpose output ports or input/output ports of a single-chip microcomputer may be used. However, it is necessary to prevent both ends of these coils from going high at the same time. In this case, the CPU
The output data must be changed every time the stepping motor rotates one step, and the number of rotations of the stepping motor must be managed. In this way, in control using a single-chip microcomputer timer, depending on the application, C
The burden on PU becomes extremely large.

【0006】本発明の目的は、タイマを用いたシステム
においてハ−ドウェアの増加量を最小限に抑えつつ、C
PUの介在を最小限とするタイマを提供することにある
An object of the present invention is to minimize the increase in hardware in a system using a timer while
The object of the present invention is to provide a timer that minimizes PU intervention.

【0007】本発明の上記並びにその他の目的と新規な
特徴は、本明細書の記述並びに添付図面から明らかにな
るであろう。
The above and other objects and novel features of the present invention will become apparent from the description of this specification and the accompanying drawings.

【0008】[0008]

【課題を解決するための手段】本願において開示される
発明のうち代表的なものの概要を簡単に説明すれば下記
のとおりである。
[Means for Solving the Problems] A brief overview of typical inventions disclosed in this application is as follows.

【0009】すなわち、計数を行う手段すなわちカウン
タ、所定の計数値を保持する比較レジスタ及び上記カウ
ンタの内容と上記比較レジスタの内容と比較する比較器
等から成る従来のタイマの他にデ−タを保持する手段と
所定の時間が経過したとき上記デ−タを保持する手段に
保持したデ−タを加工する手段を設けるものである。例
えば、上記デ−タを加工する手段としては、上記所定の
時間の経過毎にカウントダウンする第2のカウンタ、上
記所定の時間の経過毎にロ−テ−トするシフト回路、上
記所定の時間の経過毎に上記比較レジスタの内容を加算
又は減算する加減算回路等を設ける。上記デ−タを加工
する手段はデ−タ保持機能を有していてもよい。
In other words, in addition to the conventional timer which includes means for counting, that is, a counter, a comparison register for holding a predetermined count value, and a comparator for comparing the contents of the counter and the contents of the comparison register, The data holding means is provided with a holding means and a means for processing the data held in the data holding means after a predetermined period of time has elapsed. For example, the means for processing the data includes a second counter that counts down every time the predetermined time elapses, a shift circuit that rotates the data every time the predetermined time elapses, and a second counter that counts down every time the predetermined time elapses. An addition/subtraction circuit or the like is provided that adds or subtracts the contents of the comparison register at each elapsed time. The means for processing the data may have a data holding function.

【0010】0010

【作用】上記した手段によれば、所定の時間が経過し、
タイマからの信号によってCPUが行うべき処理の一部
又は全部をタイマのハ−ドウェアによって行わしめるこ
とができ、CPUの負担を軽減して、シングルチップマ
イクロコンピュ−タの全体的な処理時間を向上すること
ができる。
[Operation] According to the above-mentioned means, after a predetermined period of time has elapsed,
Depending on the signal from the timer, some or all of the processing that should be performed by the CPU can be performed by the timer hardware, reducing the burden on the CPU and improving the overall processing time of single-chip microcomputers. can do.

【0011】[0011]

【実施例】図23はシングルチップマイクロコンピュ−
タのブロック図である。シングルチップマイクロコンピ
ュ−タ8は、特に制限はされないものの、タイマ1、C
PU2、プログラム保持用のROM(read onl
y memory : 読出し専用メモリ)3、デ−タ
保持用のRAM(randomaccess memo
ry : 随時呼出しメモリ)4、SCI(seria
l communication interface
 : シリアルコニュニケ−ションインタフェ−ス)5
及び入出力ポ−ト6等の機能ブロックが1つの半導体基
板上に形成されてなる。上記各ブロックは内部バス7に
よって相互に接続されている。内部バス7は、例えば、
デ−タバス、アドレスバス、リ−ド/ライト信号、シス
テムクロック及び割込み信号等から構成されている。タ
イマ1から内部バス7を経由しないでタイマ1から入出
力ポ−ト6bに直接接続されるパス9がある。CPU2
はROM3に格納された命令又はデ−タを逐次読み出し
て、タイマ1、SCI5及び入出力ポ−ト6を動作させ
て、所定の処理を実行する。
[Example] Figure 23 shows a single-chip microcomputer.
FIG. Although the single-chip microcomputer 8 is not particularly limited, the timer 1, C
PU2, ROM for program retention (read onl
y memory: read-only memory) 3, RAM for data retention (random access memory)
ry: occasional recall memory) 4, SCI (seria
l communication interface
: Serial communication interface) 5
Functional blocks such as input/output port 6 and input/output port 6 are formed on one semiconductor substrate. The above blocks are interconnected by an internal bus 7. The internal bus 7 is, for example,
It consists of a data bus, address bus, read/write signals, system clock, interrupt signals, etc. There is a path 9 that connects the timer 1 directly to the input/output port 6b without going through the internal bus 7. CPU2
sequentially reads out instructions or data stored in the ROM 3, operates the timer 1, the SCI 5, and the input/output port 6, and executes predetermined processing.

【0012】本発明のタイマをステッピングモ−タの制
御について適用した場合の実施例を以下に示す。
An embodiment in which the timer of the present invention is applied to the control of a stepping motor will be shown below.

【0013】〔実施例1〕図1は本発明に係るタイマの
第1の実施例を示すブロック図である。図1のタイマは
、特に制限はされないものの、16ビットのカウンタ1
1、16ビットの比較レジスタ12、16ビットの比較
器13、タイマコントロ−ル・ステ−タスレジスタ14
1、第2カウンタ15、制御論理ブロック101及びバ
スインタフェ−ス110等から構成されている。カウン
タ11は指定されたクロックに従ってカウントアップさ
れる。カウンタ11と比較レジスタ12の内容は比較器
13によって、常に比較されている。第2カウンタ15
は、特に制限はされないものの、16ビットのカウンタ
であり、第2カウンタ15の入力クロックは、カウンタ
11と比較レジスタ12の内容が一致したことを示すコ
ンペアマッチ信号とされ、コンペアマッチが発生する毎
に第2カウンタ15はカウントダウンされる。カウンタ
11、比較レジスタ12、タイマコントロ−ル・ステ−
タスレジスタ141及び第2カウンタ15は、特に制限
はされないものの、CPU2のメモリ空間にアドレス付
けされており、タイマモジュ−ル内デ−タレジスタTM
DB、バスインタフェ−ス110及び内部デ−タバスを
介してCPU2がリ−ド/ライト可能とされる。
[Embodiment 1] FIG. 1 is a block diagram showing a first embodiment of a timer according to the present invention. Although not particularly limited, the timer in FIG. 1 is a 16-bit counter 1.
1, 16-bit comparison register 12, 16-bit comparator 13, timer control status register 14
1, a second counter 15, a control logic block 101, a bus interface 110, etc. The counter 11 is counted up according to a designated clock. The contents of counter 11 and comparison register 12 are constantly compared by comparator 13. Second counter 15
is a 16-bit counter, although it is not particularly limited, and the input clock of the second counter 15 is a compare match signal that indicates that the contents of the counter 11 and the comparison register 12 match, and each time a compare match occurs, The second counter 15 is counted down. Counter 11, comparison register 12, timer control status
Although not particularly limited, the task register 141 and the second counter 15 are addressed to the memory space of the CPU 2, and the data register TM in the timer module
The CPU 2 can read/write data via the DB, bus interface 110, and internal data bus.

【0014】図2は第1の実施例のタイマコントロ−ル
・ステ−タスレジスタ141のビット構成を示すもので
ある。ビット1、0はクロック選択ビット1・0(CS
K1、CSK0)であり、シングルチップマイクロコン
ピュ−タのシステムクロックを分周した内部クロック3
種類又は外部クロックのいずれかをカウンタ11の入力
クロックとして使用するかを選択する。ビット2はカウ
ンタクリアビット(CCLR)であり、カウンタ11と
比較レジスタ12の内容が一致したときにカウンタ11
をクリアするか否かを選択する。ビット3はカウンタ許
可ビット(CNTE)であり、カウンタ11がカウント
アップ動作を行うか停止するかを選択する。ビット13
はゼロ検出フラグ(ZF)であり、第2カウンタ15の
内容がH’0000に一致したときに、ゼロ検出フラグ
(ZF)が”1”にセットされる(H’は16進数を表
す)。ビット14はオ−バフロ−フラグ(OVF)であ
り、カウンタ11の内容がH’FFFF⇒H’0000
となると、オ−バフロ−フラグ(OVF)が”1”にセ
ットされる。ビット15はコンペアマッチフラグ(CM
F)であり、カウンタ11と比較レジスタ12の内容が
一致すると、コンペアマッチフラグ(CMF)が”1”
にセットされる。これらのフラグが”1”にセットされ
ると、CPU2に対して割込みを要求する。
FIG. 2 shows the bit configuration of the timer control status register 141 in the first embodiment. Bits 1 and 0 are clock selection bits 1 and 0 (CS
K1, CSK0), which is an internal clock 3 which is the frequency-divided system clock of a single-chip microcomputer.
Select whether to use the type or external clock as the input clock for the counter 11. Bit 2 is a counter clear bit (CCLR), which clears the counter 11 when the contents of the counter 11 and comparison register 12 match.
Select whether to clear or not. Bit 3 is a counter enable bit (CNTE), which selects whether the counter 11 performs a count-up operation or stops. bit 13
is a zero detection flag (ZF), and when the contents of the second counter 15 match H'0000, the zero detection flag (ZF) is set to "1"(H' represents a hexadecimal number). Bit 14 is an overflow flag (OVF), and the content of counter 11 is H'FFFF⇒H'0000.
Then, the overflow flag (OVF) is set to "1". Bit 15 is the compare match flag (CM
F), and when the contents of the counter 11 and the comparison register 12 match, the compare match flag (CMF) is set to "1".
is set to When these flags are set to "1", an interrupt is requested to the CPU 2.

【0015】ステッピングモ−タの制御を行う場合は、
CPU2はROM3上のソフトウェアに基づいて、ステ
ッピングモ−タの動作速度に対応する値を比較レジスタ
12に設定し、ステッピングモ−タが回転するステップ
数に対応する値を第2カウンタ15に設定する。また、
タイマコントロ−ル・ステ−タスレジスタ141のクロ
ック選択ビット1・0(CSK1、CSK0)にステッ
ピングモ−タの動作速度に対応する値を、カウンタクリ
アビット(CCLR)に”1”を設定する。クロック選
択ビット1・0(CSK1、CSK0)によって、特に
制限はされないものの、システムクロックを2分周した
信号を選択したものとする。その後、カウンタ許可ビッ
ト(CNTE)を”1”にセットしてタイマの動作を開
始させる。カウンタ11はH’0000から計数を開始
し、上記システムクロックを2分周した信号の、特に制
限はされないものの、立ち下がり時に1ずつカウントア
ップを行う。カウンタ11と比較レジスタ12の内容が
一致すると、第2カウンタ15の内容をカウントダウン
するとともに、タイマコントロ−ル・ステ−タスレジス
タ141のコンペアマッチフラグ(CMF)を”1”に
セットして、CPU2に割込みを要求する。CPU2は
割込みを受け付けると、ポ−トに出力しているデ−タを
1回ロ−テ−トし、このデ−タをポ−トに出力する。こ
れにより、ステッピングモ−タが1ステップ進むことに
なる。
When controlling a stepping motor,
Based on the software on the ROM 3, the CPU 2 sets a value corresponding to the operating speed of the stepping motor in the comparison register 12, and sets a value corresponding to the number of steps in which the stepping motor rotates in the second counter 15. Also,
The clock selection bits 1 and 0 (CSK1, CSK0) of the timer control status register 141 are set to a value corresponding to the operating speed of the stepping motor, and the counter clear bit (CCLR) is set to "1". Although not particularly limited, it is assumed that the clock selection bits 1 and 0 (CSK1, CSK0) select a signal obtained by dividing the system clock by two. Thereafter, the counter enable bit (CNTE) is set to "1" to start the timer operation. The counter 11 starts counting from H'0000, and counts up by one at each falling edge of the signal obtained by dividing the frequency of the system clock by two, although this is not particularly limited. When the contents of the counter 11 and the comparison register 12 match, the contents of the second counter 15 are counted down, the compare match flag (CMF) of the timer control status register 141 is set to "1", and the CPU 2 request an interrupt. When the CPU 2 receives an interrupt, it rotates the data being output to the port once, and outputs this data to the port. This causes the stepping motor to advance one step.

【0016】カウンタ11と比較レジスタ12のコンペ
アマッチが第2カウンタ15に設定した回数発生すると
、第2カウンタ15がH’0000になり、上記コンペ
アマッチフラグ(CMF)の他にゼロ検出フラグ(ZF
)が”1”にセットされ、CPU2に割込みを要求する
。これにより、ステッピングモ−タは所定のステップ回
転したので、CPU2は上記ゼロ検出割込みを受け付け
ると、特に制限はされないものの、上記カウンタ許可ビ
ット(CNTE)を”0”にクリアしてタイマの動作を
停止させる。特に制限はされないものの、この時、カウ
ンタ11はH’0000、第2カウンタ15はH’FF
FFの状態で停止する。その後CPU2は次の動作を指
示する。
When a compare match between the counter 11 and the comparison register 12 occurs the number of times set in the second counter 15, the second counter 15 becomes H'0000 and a zero detection flag (ZF) is set in addition to the compare match flag (CMF).
) is set to "1" and requests an interrupt to the CPU2. As a result, the stepping motor has rotated in a predetermined step, so when the CPU 2 receives the zero detection interrupt, it clears the counter permission bit (CNTE) to "0" and stops the timer operation, although there are no particular restrictions. let Although there is no particular restriction, at this time, the counter 11 is H'0000 and the second counter 15 is H'FF.
Stops in FF state. After that, the CPU 2 instructs the next operation.

【0017】特に制限はされないものの、コンペアマッ
チ割込みが発生する毎に、CPU2の命令実行により、
比較レジスタ12の値を減少すれば、コンペアマッチの
頻度が高くなり、ステッピングモ−タの速度を次第に上
げていくことができ、モ−タのトルクを軽減して、装置
を円滑に動作させることができる。
Although there is no particular restriction, each time a compare match interrupt occurs, the CPU 2 executes an instruction to
By decreasing the value of the comparison register 12, the frequency of compare matches increases, the speed of the stepping motor can be gradually increased, the torque of the motor can be reduced, and the device can operate smoothly. can.

【0018】この第1の実施例においては、CPU2が
ステッピングモ−タの回転数を管理する必要がなく、C
PUの負担を軽減することができる。
In this first embodiment, there is no need for the CPU 2 to manage the rotational speed of the stepping motor;
The load on the PU can be reduced.

【0019】また、第1の実施例において、第2カウン
タ15をカウンタと比較器とで構成してもよい。ゼロ検
出回路付きのカウンタよりもハ−ドウェアの規模が増大
するものの、ステッピングモ−タの制御以外の目的にも
本タイマを使用する場合には、柔軟性が増加するであろ
う。
Furthermore, in the first embodiment, the second counter 15 may be composed of a counter and a comparator. Although the scale of the hardware is greater than a counter with a zero detection circuit, flexibility may be increased if the timer is used for purposes other than controlling a stepping motor.

【0020】〔実施例2〕図3は本発明に係るタイマの
第2の実施例を示すブロック図である。図3のタイマは
、特に制限はされないものの、カウンタ11、比較レジ
スタ12、比較器13、タイマコントロ−ル・ステ−タ
スレジスタ142、デ−タレジスタ16、シフト回路1
7、制御論理ブロック102及びバスインタフェ−ス1
10等から構成されている。この実施例が図1の第1の
実施例と異なる主な点は、第2カウンタ15の替わりに
デ−タレジスタ16及びシフト回路17を付加した点で
ある。デ−タレジスタ16は、特に制限はされないもの
の、図4に示すように8ビットのレジスタであり、ビッ
ト0、2、4及び6が、タイマデ−タ出力端子の0、1
、2、3にそれぞれ接続され、上記2本のコイルの両端
の制御が可能とされる。シフト回路17はコンペアマッ
チが発生する毎に左又は右方向にロ−テ−トされる。 デ−タレジスタ16は、第1の実施例特と同様にCPU
2のメモリ空間にアドレス付けされており、タイマモジ
ュ−ル内デ−タレジスタTMDB、バスインタフェ−ス
110及び内部デ−タバスを介してCPU2がリ−ド/
ライト可能とされる。
[Embodiment 2] FIG. 3 is a block diagram showing a second embodiment of a timer according to the present invention. Although not particularly limited, the timer in FIG.
7. Control logic block 102 and bus interface 1
It is composed of 10 mag. The main difference between this embodiment and the first embodiment shown in FIG. 1 is that a data register 16 and a shift circuit 17 are added in place of the second counter 15. Although not particularly limited, the data register 16 is an 8-bit register as shown in FIG.
, 2, and 3, respectively, and it is possible to control both ends of the two coils. The shift circuit 17 is rotated to the left or right every time a compare match occurs. The data register 16 is connected to the CPU as in the first embodiment.
The CPU 2 reads/writes the data via the timer module internal data register TMDB, the bus interface 110, and the internal data bus.
It is considered writable.

【0021】図5は第2の実施例のタイマコントロ−ル
・ステ−タスレジスタ142のビット構成を示すもので
ある。ビット1、0のクロック選択ビット1・0(CS
K1、CSK0)、ビット2のカウンタクリアビット(
CCLR)、ビット3のカウンタ許可ビット(CNTE
)、ビット14のオ−バフロ−フラグ(OVF)及びビ
ット15のコンペアマッチフラグ(CMF)については
第1の実施例と同様である。しかし、ビット13のゼロ
検出フラグ(ZF)の代わりに、ビット4にシフト方向
選択ビット(SHD)が追加され、シフト回路17のシ
フト方向の選択を行う。
FIG. 5 shows the bit configuration of the timer control status register 142 in the second embodiment. Clock selection bits 1 and 0 of bits 1 and 0 (CS
K1, CSK0), bit 2 counter clear bit (
CCLR), bit 3 counter enable bit (CNTE
), the overflow flag (OVF) of bit 14, and the compare match flag (CMF) of bit 15 are the same as in the first embodiment. However, instead of the zero detection flag (ZF) in bit 13, a shift direction selection bit (SHD) is added in bit 4 to select the shift direction of the shift circuit 17.

【0022】第1の実施例と同様に、ステッピングモ−
タの制御を行う場合は、CPU2はROM3上のソフト
ウェアに基づいて、ステッピングモ−タの動作速度に対
応する値を比較レジスタ12に設定し、ステッピングモ
−タが回転するステップ数に対応する値をRAM3に設
定する。また、タイマコントロ−ル・ステ−タスレジス
タ142のクロック選択ビット1・0(CSK1、CS
K0)にステッピングモ−タの動作速度に対応する値を
、カウンタクリアビット(CCLR)に”1”を、シフ
ト方向選択ビット(SHD)に”0”を設定する。シフ
ト方向選択ビット(SHD)によって、特に制限はされ
ないものの、左方向シフトを選択したものとする。その
後、カウンタ許可ビット(CNTE)を”1”にセット
してタイマの動作を開始させる。カウンタ11はH’0
000から計数を開始し、上記システムクロックを2分
周した信号の、特に制限はされないものの、立ち下がり
時に1ずつカウントアップを行う。カウンタ11と比較
レジスタ12の内容が一致すると、デ−タレジスタ16
の内容をシフト回路17によって左方向に1回シフトす
るとともに、タイマコントロ−ル・ステ−タスレジスタ
142のコンペアマッチフラグ(CMF)を”1”にセ
ットして、CPU2に割込みを要求する。CPU2は割
込みを受け付けると、RAM3に記憶させたステッピン
グモ−タの回転数を更新する。これにより、ステッピン
グモ−タが1ステップ進むことになる。
Similar to the first embodiment, the stepping mode
When controlling the motor, the CPU 2 sets a value corresponding to the operating speed of the stepping motor in the comparison register 12 based on the software on the ROM 3, and sets a value corresponding to the number of steps in which the stepping motor rotates in the RAM 3. Set to . Also, clock selection bits 1 and 0 (CSK1, CS
A value corresponding to the operating speed of the stepping motor is set in K0), "1" is set in the counter clear bit (CCLR), and "0" is set in the shift direction selection bit (SHD). It is assumed that a leftward shift is selected by the shift direction selection bit (SHD), although there is no particular restriction. Thereafter, the counter enable bit (CNTE) is set to "1" to start the timer operation. Counter 11 is H'0
Counting is started from 000, and the count is increased by 1 at the falling edge of the signal obtained by dividing the frequency of the system clock by 2, although this is not particularly limited. When the contents of the counter 11 and the comparison register 12 match, the data register 16
The shift circuit 17 shifts the contents of 1 to the left once, sets the compare match flag (CMF) of the timer control status register 142 to "1", and requests an interrupt to the CPU 2. When the CPU 2 receives the interrupt, it updates the number of rotations of the stepping motor stored in the RAM 3. This causes the stepping motor to advance one step.

【0023】RAM3に記憶させたステッピングモ−タ
の回転数が所定回転数に達すると、CPU2は上記カウ
ンタ許可ビット(CNTE)を”0”にクリアしてタイ
マの動作を停止させ、次の動作を指示する。
When the number of rotations of the stepping motor stored in the RAM 3 reaches a predetermined number of rotations, the CPU 2 clears the counter permission bit (CNTE) to "0", stops the timer operation, and starts the next operation. Instruct.

【0024】この第2の実施例においては、CPU2が
デ−タのロ−テ−ト等の制御を行う必要がなく、CPU
の負担を軽減することができる。
In this second embodiment, there is no need for the CPU 2 to control data rotation, etc.
can reduce the burden of

【0025】〔実施例3〕図6は本発明に係るタイマの
第3の実施例を示すブロック図である。図6のタイマは
、特に制限はされないものの、カウンタ11、比較レジ
スタ12、比較器13、タイマコントロ−ル・ステ−タ
スレジスタ143、第2カウンタ15、デ−タレジスタ
16、シフト回路17、制御論理ブロック103及びバ
スインタフェ−ス110等から構成されている。第3の
実施例は第1の実施例と第2の実施例を組み合わせたも
のである。
[Embodiment 3] FIG. 6 is a block diagram showing a third embodiment of a timer according to the present invention. Although not particularly limited, the timer in FIG. It is composed of a block 103, a bus interface 110, and the like. The third embodiment is a combination of the first and second embodiments.

【0026】図7は第3の実施例のタイマコントロ−ル
・ステ−タスレジスタ143のビット構成を示すもので
ある。ビット1、0のクロック選択ビット1・0(CS
K1、CSK0)、ビット2のカウンタクリアビット(
CCLR)、ビット3のカウンタ許可ビット(CNTE
)、ビット4のシフト方向選択ビット(SHD)、ビッ
ト13のゼロ検出フラグ(ZF)、ビット14のオ−バ
フロ−フラグ(OVF)及びビット15のコンペアマッ
チフラグ(CMF)については第1の実施例及び第2の
実施例と同様である。
FIG. 7 shows the bit configuration of the timer control status register 143 in the third embodiment. Clock selection bits 1 and 0 of bits 1 and 0 (CS
K1, CSK0), bit 2 counter clear bit (
CCLR), bit 3 counter enable bit (CNTE
), bit 4 shift direction selection bit (SHD), bit 13 zero detection flag (ZF), bit 14 overflow flag (OVF), and bit 15 compare match flag (CMF) according to the first implementation. This is similar to the example and the second embodiment.

【0027】この動作は第1の実施例及び第2の実施例
と同様であるので詳細な説明は省略する。
Since this operation is similar to the first embodiment and the second embodiment, detailed explanation will be omitted.

【0028】この第3の実施例においては、デ−タのロ
−テ−ト及びステップ数の計数等をタイマがCPU2の
介在なしに行うことができる。
In this third embodiment, the timer can rotate data, count the number of steps, etc. without the intervention of the CPU 2.

【0029】〔実施例4〕図8は本発明に係るタイマの
第4の実施例を示すブロック図である。図8のタイマは
、特に制限はされないものの、カウンタ11、比較レジ
スタ120、比較器13、タイマコントロ−ル・ステ−
タスレジスタ144、定数レジスタ18、加減算器19
、制御論理ブロック104及びバスインタフェ−ス11
0等から構成されている。この実施例が図1の第1の実
施例と異なる主な点は、第2カウンタ15の替わりに定
数レジスタ18及び加減算器19を付加した点である。 定数レジスタ18は、特に制限はされないものの、16
ビットのレジスタであり、また、加減算器19は、16
ビットの算術演算器である。コンペアマッチが発生する
毎に比較レジスタ12の内容と定数レジスタ18の内容
が加減算器19によって加減算され、結果を比較レジス
タ120に格納することが可能とされる。定数レジスタ
18は、第1の実施例特と同様にCPU2のメモリ空間
にアドレス付けされており、タイマモジュ−ル内デ−タ
レジスタTMDB、バスインタフェ−ス110及び内部
デ−タバスを介してCPU2がリ−ド/ライト可能とさ
れる。
[Embodiment 4] FIG. 8 is a block diagram showing a fourth embodiment of a timer according to the present invention. Although not particularly limited, the timer in FIG. 8 includes a counter 11, a comparison register 120, a comparator 13, and a timer control status.
task register 144, constant register 18, adder/subtractor 19
, control logic block 104 and bus interface 11
It is composed of 0, etc. The main difference between this embodiment and the first embodiment shown in FIG. 1 is that a constant register 18 and an adder/subtractor 19 are added in place of the second counter 15. Although the constant register 18 is not particularly limited, the number of constant registers 18 is 16.
The adder/subtractor 19 is a bit register, and the adder/subtractor 19 is a 16-bit register.
It is a bit arithmetic unit. Every time a compare match occurs, the contents of the comparison register 12 and the contents of the constant register 18 are added or subtracted by an adder/subtractor 19, and the result can be stored in the comparison register 120. The constant register 18 is addressed to the memory space of the CPU 2 as in the first embodiment, and the CPU 2 is read via the timer module internal data register TMDB, the bus interface 110 and the internal data bus. - Can be read/written.

【0030】図9は第4の実施例のタイマコントロ−ル
・ステ−タスレジスタ144のビット構成を示すもので
ある。ビット1、0のクロック選択ビット1・0(CS
K1、CSK0)、ビット2のカウンタクリアビット(
CCLR)、ビット3のカウンタ許可ビット(CNTE
)、ビット14のオ−バフロ−フラグ(OVF)及びビ
ット15のコンペアマッチフラグ(CMF)については
第1の実施例と同様である。さらに、ビット5に加減算
選択ビット(A/S)及びビット6に加減算許可ビット
(ASE)が追加されている。加減算選択ビット(A/
S)は、加減算器19が加算を行うのか減算を行うのか
の選択を行い、加減算許可ビット(ASE)は加減算器
19が加減算を行うか否かの選択を行う。
FIG. 9 shows the bit configuration of the timer control status register 144 in the fourth embodiment. Clock selection bits 1 and 0 of bits 1 and 0 (CS
K1, CSK0), bit 2 counter clear bit (
CCLR), bit 3 counter enable bit (CNTE
), the overflow flag (OVF) of bit 14, and the compare match flag (CMF) of bit 15 are the same as in the first embodiment. Furthermore, an addition/subtraction selection bit (A/S) is added to bit 5, and an addition/subtraction enable bit (ASE) is added to bit 6. Addition/subtraction selection bit (A/
S) selects whether the adder/subtractor 19 performs addition or subtraction, and the addition/subtraction permission bit (ASE) selects whether the adder/subtractor 19 performs addition or subtraction.

【0031】本実施例において、ステッピングモ−タの
制御を行い、回転速度を次第に増加させる場合は、第1
の実施例と同様に、CPU2はROM3上のソフトウェ
アに基づいて、ステッピングモ−タの初期動作速度に対
応する値を比較レジスタ12に設定し、ステッピングモ
−タが回転するステップ数に対応する値をRAM3に設
定し、さらに、ステッピングモ−タの動作速度の1ステ
ップあたりの増加量に対応する値を定数レジスタ18に
設定する。また、タイマコントロ−ル・ステ−タスレジ
スタ142のクロック選択ビット1・0(CSK1、C
SK0)にステッピングモ−タの動作速度に対応する値
を、カウンタクリアビット(CCLR)に”1”を、加
減算選択ビット(A/S)に”0”を、及び加減算許可
ビット(ASE)に”1”を設定する。その後、カウン
タ許可ビット(CNTE)を”1”にセットしてタイマ
の動作を開始させる。カウンタ11はH’0000から
計数を開始し、1ずつカウントアップを行う。カウンタ
11と比較レジスタ12の内容が一致すると、比較レジ
スタ12の内容から定数レジスタ18の内容を減算する
とともに、タイマコントロ−ル・ステ−タスレジスタ1
44のコンペアマッチフラグ(CMF)を”1”にセッ
トして、CPU2に割込みを要求する。CPU2は割込
みを受け付けると、RAM3に記憶させたステッピング
モ−タの回転数を更新する。これにより、ステッピング
モ−タが1ステップ進むことになる。
In this embodiment, when controlling the stepping motor and gradually increasing the rotational speed, the first
Similarly to the embodiment described above, the CPU 2 sets a value corresponding to the initial operating speed of the stepping motor in the comparison register 12 based on the software on the ROM 3, and sets a value corresponding to the number of steps in which the stepping motor rotates in the RAM 3. Further, a value corresponding to the amount of increase per step in the operating speed of the stepping motor is set in the constant register 18. Also, the clock selection bits 1 and 0 (CSK1, CSK
Set the value corresponding to the operating speed of the stepping motor to SK0), "1" to the counter clear bit (CCLR), "0" to the addition/subtraction selection bit (A/S), and "0" to the addition/subtraction enable bit (ASE). Set 1”. Thereafter, the counter enable bit (CNTE) is set to "1" to start the timer operation. The counter 11 starts counting from H'0000 and counts up one by one. When the contents of the counter 11 and the comparison register 12 match, the contents of the constant register 18 are subtracted from the contents of the comparison register 12, and the contents of the timer control status register 1 are subtracted from the contents of the comparison register 12.
The compare match flag (CMF) of 44 is set to "1" and an interrupt is requested to the CPU 2. When the CPU 2 receives the interrupt, it updates the number of rotations of the stepping motor stored in the RAM 3. This causes the stepping motor to advance one step.

【0032】RAM3に記憶させたステッピングモ−タ
の回転数が所定回転数に達すると、CPU2は上記カウ
ンタ許可ビット(CNTE)を”0”にクリアしてタイ
マの動作を停止させ、次の動作を指示する。
When the number of rotations of the stepping motor stored in the RAM 3 reaches a predetermined number of rotations, the CPU 2 clears the counter permission bit (CNTE) to "0", stops the timer operation, and starts the next operation. Instruct.

【0033】この第4の実施例においては、CPU2が
回転速度の増加等の制御を行う必要がなく、CPUの負
担軽減できる。
In this fourth embodiment, there is no need for the CPU 2 to perform control such as increasing the rotational speed, and the burden on the CPU can be reduced.

【0034】〔実施例5〕図10は本発明に係るタイマ
の第5の実施例の変形例を示すブロック図である。図1
0のタイマは、特に制限はされないものの、カウンタ1
1、比較レジスタ120、比較器13、タイマコントロ
−ル・ステ−タスレジスタ145、第2カウンタ15、
デ−タレジスタ16、シフト回路17、定数レジスタ1
8、加減算器19、制御論理ブロック105及びバスイ
ンタフェ−ス110等から構成されている。この実施例
が図1の第1の実施例と異なる主な点は、デ−タレジス
タ16、シフト回路17、定数レジスタ18及び加減算
器19を付加した点である。すなわち、第3の実施例と
第4の実施例を組み合わせたものである。
[Embodiment 5] FIG. 10 is a block diagram showing a modification of the fifth embodiment of the timer according to the present invention. Figure 1
Although there are no particular restrictions on the timer 0, the timer
1, comparison register 120, comparator 13, timer control status register 145, second counter 15,
Data register 16, shift circuit 17, constant register 1
8, an adder/subtractor 19, a control logic block 105, a bus interface 110, etc. The main difference between this embodiment and the first embodiment shown in FIG. 1 is that a data register 16, a shift circuit 17, a constant register 18, and an adder/subtractor 19 are added. That is, this embodiment is a combination of the third embodiment and the fourth embodiment.

【0035】図11は第5の実施例のタイマコントロ−
ル・ステ−タスレジスタ145のビット構成を示すもの
である。ビット1、0のクロック選択ビット1・0(C
KS1、CKS0)、ビット2のカウンタクリアビット
(CCLR)、ビット3のカウンタ許可ビット(CNT
E)、ビット4のビット方向選択ビット(SHD)、ビ
ット5の加減算選択ビット(A/S)、ビット6の加減
算許可ビット(ASE)、ビット13のゼロ検出フラグ
(ZF)、ビット14のオ−バフロ−フラグ(OVF)
及びビット15のコンペアマッチフラグ(CMF)につ
いては第3の実施例及び第4の実施例と同様である。
FIG. 11 shows the timer control of the fifth embodiment.
2 shows the bit configuration of the file status register 145. Clock selection bits 1 and 0 (C
KS1, CKS0), bit 2 counter clear bit (CCLR), bit 3 counter enable bit (CNT
E), bit direction selection bit (SHD) of bit 4, addition/subtraction selection bit (A/S) of bit 5, addition/subtraction enable bit (ASE) of bit 6, zero detection flag (ZF) of bit 13, bit 14 bit -Bufflow Flag (OVF)
and the compare match flag (CMF) of bit 15 are the same as in the third and fourth embodiments.

【0036】本実施例において、ステッピングモ−タの
制御を行い、回転速度を次第に増加させる場合は、第4
の実施例と同様に、CPU2はROM3上のソフトウェ
アに基づいて、ステッピングモ−タの初期動作速度に対
応する値を比較レジスタ120に設定し、ステッピング
モ−タが回転するステップ数に対応する値を第2カウン
タ15に設定し、さらに、ステッピングモ−タの動作速
度の1ステップあたりの増加量に対応する値を定数レジ
スタ18に設定する。また、タイマコントロ−ル・ステ
−タスレジスタ145のクロック選択ビット1・0(C
KS1、CKS0)にステッピングモ−タの動作速度に
対応する値を、カウンタクリアビット(CCLR)に”
1”を、シフト方向選択ビット(SHD)に”0”を、
加減算選択ビット(A/S)に”0”を、及び加減算許
可ビット(ASE)に”1”を設定する。その後、カウ
ンタ許可ビット(CNTE)を”1”にセットしてタイ
マの動作を開始させる。カウンタ11はH’0000か
ら計数を開始し、1ずつカウントアップを行う。カウン
タ11と比較レジスタ12の内容が一致すると、デ−タ
レジスタ16の内容をシフト回路17によって左方向に
1回シフトし、第2カウンタ15をカウントダウンし、
比較レジスタ12の内容から定数レジスタ18の内容を
減算するとともに、タイマコントロ−ル・ステ−タスレ
ジスタ145のコンペアマッチフラグ(CMF)を”1
”にセットして、CPU2に割込みを要求する。この割
込み要求に対してCPU2は行うべき処理は存在しない
ので、この割込みを無視してよい。例えば、CPU2内
部に有する割込みマスクビットを”1”にセットするこ
とによって割込みを禁止してもよいし、タイマコントロ
−ル・ステ−タスレジスタ145にコンペアマッチ割込
み許可ビットを設けて、このビットを”0”に設定する
ことによって禁止してもよい。この割込みの禁止方法に
ついては、上記(株)日立製作所昭和63年12月発行
の『H8/532HD6475328  HD6435
328  ハ−ドウェアマニュアル』等によって公知で
あるので詳細な説明は省略する。
In this embodiment, when controlling the stepping motor and gradually increasing the rotational speed, the fourth
Similarly to the embodiment described above, the CPU 2 sets a value corresponding to the initial operating speed of the stepping motor in the comparison register 120 based on the software on the ROM 3, and sets a value corresponding to the number of steps in which the stepping motor rotates in the comparison register 120. 2 counter 15, and a value corresponding to the amount of increase per step in the operating speed of the stepping motor is set in constant register 18. Also, clock selection bits 1 and 0 (C
Set the value corresponding to the operating speed of the stepping motor in KS1, CKS0) and the counter clear bit (CCLR).
1”, and “0” to the shift direction selection bit (SHD).
Set the addition/subtraction selection bit (A/S) to "0" and the addition/subtraction permission bit (ASE) to "1". Thereafter, the counter enable bit (CNTE) is set to "1" to start the timer operation. The counter 11 starts counting from H'0000 and counts up one by one. When the contents of the counter 11 and the comparison register 12 match, the contents of the data register 16 are shifted once to the left by the shift circuit 17, and the second counter 15 is counted down.
The contents of the constant register 18 are subtracted from the contents of the comparison register 12, and the compare match flag (CMF) of the timer control status register 145 is set to "1".
" to request an interrupt from the CPU2. Since there is no processing that the CPU2 should do in response to this interrupt request, this interrupt can be ignored. For example, set the interrupt mask bit inside the CPU2 to "1". Interrupts may be disabled by setting this to "0", or by providing a compare match interrupt enable bit in the timer control status register 145 and setting this bit to "0". Regarding how to disable this interrupt, please refer to the above-mentioned "H8/532HD6475328 HD6435" published by Hitachi, Ltd. in December 1988.
328 Hardware Manual, etc., so a detailed explanation will be omitted.

【0037】この第5の実施例においては、CPU2が
回転速度変化及び回転数の管理、デ−タのロ−テ−ト等
の制御を行う必要がなく、CPUの負担軽減できる。
In the fifth embodiment, there is no need for the CPU 2 to control changes in rotational speed, management of rotational speed, rotation of data, etc., and the burden on the CPU can be reduced.

【0038】〔実施例6〕図12は本発明に係るタイマ
の第6の実施例を示すブロック図である。図12のタイ
マは、図9の第5の実施例のタイマに対し、比較レジス
タ12、タイマコントロ−ル・ステ−タスレジスタ14
5、定数レジスタ18がそれぞれレジスタ2本で1組と
され、いわゆるダブルバッファ構成とされる。
[Embodiment 6] FIG. 12 is a block diagram showing a sixth embodiment of a timer according to the present invention. The timer in FIG. 12 has a comparison register 12, a timer control/status register 14, and a comparison register 12, a timer control/status register 14, and
5. The constant registers 18 are each made up of two registers, forming a so-called double buffer configuration.

【0039】本実施例において、ステッピングモ−タの
制御を行い、回転速度を次第に増加させる場合は、第5
の実施例と同様に、CPU2はROM3上のソフトウェ
アに基づいて、ステッピングモ−タの初期動作速度に対
応する値を較レジスタ121に設定し、ステッピングモ
−タが回転するステップ数に対応する値を第2カウンタ
15に設定し、さらに、ステッピングモ−タの動作速度
の1ステップあたりの増加量に対応する値を定数レジス
タ181に設定する。また、タイマコントロ−ル・ステ
−タスレジスタ1451のクロック選択ビット1・0(
CKS1、CKS0)にステッピングモ−タの動作速度
に対応する値を、カウンタクリアビット(CCLR)に
”1”を、シフト方向選択ビット(SHD)に”0”を
、加減算選択ビット(A/S)に”0”を、及び加減算
許可ビット(ASE)に”1”を設定する。その後、カ
ウンタ許可ビット(CNTE)を”1”にセットすると
、これらのデ−タは比較レジスタ122、定数レジスタ
182及びタイマコントロ−ル・ステ−タスレジスタ1
452に格納されるとともに、タイマの動作を開始させ
る。その後、CPU2はタイマの次の動作のためのデ−
タを比較レジスタ121、定数レジスタ181及びタイ
マコントロ−ル・ステ−タスレジスタ1451に設定す
る。カウンタ11はH’0000から計数を開始し、1
ずつカウントアップを行う。カウンタ11と比較レジス
タ122の内容が一致すると、デ−タレジスタ16の内
容をシフト回路17によって左方向に1回シフトし、第
2カウンタ15をカウントダウンし、比較レジスタ12
2の内容から定数レジスタ182の内容を減算するとと
もに、タイマコントロ−ル・ステ−タスレジスタ145
のコンペアマッチフラグ(CMF)を”1”にセットし
て、CPU2に割込みを要求する。この割込み要求に対
してCPU2は行うべき処理は存在しないので、この割
込みを無視してよい。
In this embodiment, when controlling the stepping motor and gradually increasing the rotational speed, the fifth
Similarly to the embodiment described above, the CPU 2 sets a value corresponding to the initial operating speed of the stepping motor in the comparison register 121 based on the software on the ROM 3, and sets a value corresponding to the number of steps in which the stepping motor rotates in the comparison register 121. 2 counter 15, and a value corresponding to the amount of increase per step in the operating speed of the stepping motor is set in constant register 181. Also, the clock selection bits 1 and 0 of the timer control status register 1451 (
CKS1, CKS0), set the value corresponding to the operating speed of the stepping motor, set the counter clear bit (CCLR) to "1", set the shift direction selection bit (SHD) to "0", and add/subtract selection bit (A/S). Set "0" to "0" and set "1" to the addition/subtraction enable bit (ASE). After that, when the counter enable bit (CNTE) is set to "1", these data are transferred to the comparison register 122, constant register 182 and timer control status register 1.
452 and starts the operation of the timer. After that, CPU2 reads the data for the next operation of the timer.
The data is set in the comparison register 121, constant register 181, and timer control status register 1451. The counter 11 starts counting from H'0000, and
Count up step by step. When the contents of the counter 11 and the comparison register 122 match, the contents of the data register 16 are shifted once to the left by the shift circuit 17, the second counter 15 is counted down, and the contents of the comparison register 122 are shifted once to the left by the shift circuit 17.
The contents of the constant register 182 are subtracted from the contents of the timer control status register 145.
The compare match flag (CMF) of the CPU 2 is set to "1" and an interrupt is requested to the CPU 2. Since there is no process that the CPU 2 should perform in response to this interrupt request, this interrupt may be ignored.

【0040】カウンタ11と比較レジスタ122のコン
ペアマッチが第2カウンタ15に格納した回数発生する
と、ゼロ検出フラグ(ZF)が”1”にセットされ、比
較レジスタ121、定数レジスタ181及びタイマコン
トロ−ル・ステ−タスレジスタ1451のデ−タがそれ
ぞれ比較レジスタ122、定数レジスタ182及びタイ
マコントロ−ル・ステ−タスレジスタ1452に転送さ
れる。上記同様にCPU2に割込みを要求する。CPU
2は上記ゼロ検出割込みを受け付ける、タイマの次の動
作のためのデ−タを比較レジスタ121、定数レジスタ
181及びタイマコントロ−ル・ステ−タスレジスタ1
451に設定する。特に制限はされないものの、カウン
タ許可ビット(CNTE)を”0”にクリアしてタイマ
の動作を停止させる。この時、カウンタ11はH’00
00の状態で停止する。
When a compare match between the counter 11 and the comparison register 122 occurs the number of times stored in the second counter 15, the zero detection flag (ZF) is set to "1", and the comparison register 121, constant register 181 and timer control - Data in status register 1451 is transferred to comparison register 122, constant register 182 and timer control status register 1452, respectively. Similarly to the above, an interrupt is requested to the CPU 2. CPU
2 accepts the zero detection interrupt, and compares data for the next operation of the timer with a register 121, a constant register 181, and a timer control status register 1.
Set to 451. Although not particularly limited, the counter permission bit (CNTE) is cleared to "0" to stop the timer operation. At this time, the counter 11 is H'00
It will stop at 00.

【0041】この第6の実施例においては、回転速度を
増加させつつ、モ−タを回転させ、後に定速度で回転さ
せる動作を連続して行わせることができる。割込み要求
に対しても即座に受け付ける必要がなく、CPUの負担
を大きく軽減できる。
In the sixth embodiment, the motor can be rotated while increasing the rotational speed, and then rotated at a constant speed. There is no need to immediately accept an interrupt request, and the load on the CPU can be greatly reduced.

【0042】〔実施例7〕図13は本発明に係るタイマ
の第7の実施例を示すブロック図である。図13のタイ
マは、図6の第3の実施例に対し、タイマコントロ−ル
・ステ−タスレジスタ14が、それぞれ8ビットのレジ
スタ、タイマコントロ−ル・ステ−タスレジスタ147
、タイマコントロ−ルレジスタ148、タイマモ−ドレ
ジスタ149で構成され、第2カウンタ15が、第2カ
ウンタ151、第2比較レジスタ152、第2比較器1
53で構成され、タイマデ−タ出力端子4本の他に、タ
イマ出力端子が付加されている。第2カウンタ151、
第2比較レジスタ152、タイマコントロ−ル・ステ−
タスレジスタ147、タイマコントロ−ルレジスタ14
8及びタイマモ−ドレジスタ149は、第1の実施例と
同様にCPU2のメモリ空間にアドレス付けされており
、タイマモジュ−ル内デ−タレジスタTMDB、バスイ
ンタフェ−ス110及び内部デ−タバスを介してCPU
2がリ−ド/ライト可能とされる。
[Embodiment 7] FIG. 13 is a block diagram showing a seventh embodiment of a timer according to the present invention. The timer in FIG. 13 differs from the third embodiment in FIG. 6 in that the timer control status register 14 is an 8-bit register, and the timer control status register 147 is
, a timer control register 148, and a timer mode register 149.
53, and in addition to four timer data output terminals, a timer output terminal is added. second counter 151,
Second comparison register 152, timer control status
task register 147, timer control register 14
8 and the timer mode register 149 are addressed to the memory space of the CPU 2 as in the first embodiment, and are connected to the CPU via the timer module internal data register TMDB, the bus interface 110, and the internal data bus.
2 can be read/written.

【0043】図14は第7の実施例のタイマコントロ−
ル・ステ−タスレジスタ147、タイマコントロ−ルレ
ジスタ148及びタイマモ−ドレジスタ149のビット
構成を示すものである。タイマコントロ−ル・ステ−タ
スレジスタ147のビット3〜0はアウトプットセレク
ト3〜0ビット(OS3〜OS0)であり、コンペアマ
ッチ又は第2コンペアマッチによりタイマ出力端子の出
力レベルをどのように変化させるかを選択する。アウト
プットセレクト3、2ビット(OS3、OS2)が第2
コンペアマッチによる出力レベルを選択し、アウトプッ
トセレクト1、0ビット(OS1、OS0)がコンペア
マッチによる出力レベルを選択する。アウトプットセレ
クト1、0ビット(OS1、OS0)がいずれも”0”
のときコンペアマッチが発生してもタイマ出力端子の出
力レベルは変化しない。アウトプットセレクト1ビット
(OS1)が”0”かつ、アウトプットセレクト0ビッ
ト(OS0)が”1”のときはコンペアマッチが発生す
るとタイマ出力端子の出力レベルはロウレベルとされる
。アウトプットセレクト1ビット(OS1)が”1”か
つ、アウトプットセレクト0ビット(OS0)が”0”
のときはコンペアマッチが発生するとタイマ出力端子の
出力レベルはハイレベルとされる。アウトプットセレク
ト1、0ビット(OS1、OS0)がいずれも”1”の
ときコンペアマッチが発生してもタイマ出力端子の出力
レベルは反転される。アウトプットセレクト3、2ビッ
ト(OS3、OS2)についても同様である。特に制限
はされないものの、コンペアマッチ、第2コンペアマッ
チが同時に発生すると反転出力、ハイレベル出力、ロウ
レベル出力の順に優先されてタイマ出力レベルは変化す
る。また、アウトプットセレクト3〜0ビット(OS3
〜OS0)が全て”0”のときはタイマ出力は行われず
、当該端子は入出力ポ−トとして使用される。 ビット4は第2オ−バフロ−フラグ(OVF2)であり
、第2カウンタ151がH’FFFF⇒H’0000と
なったとき”1”にセットされる。ビット5は第2コン
ペアマッチフラグ(CMF2)であり第2コンペアマッ
チが発生したとき”1”にセットされる。ビット6はオ
−バフロ−フラグ(OVF)、ビット7はコンペアマッ
チフラグ(CMF)であり、これらについては上記同様
であるので詳細な説明は省略する。
FIG. 14 shows the timer control of the seventh embodiment.
2 shows the bit configurations of a timer status register 147, a timer control register 148, and a timer mode register 149. Bits 3 to 0 of the timer control status register 147 are output select bits 3 to 0 (OS3 to OS0), which determine how the output level of the timer output terminal is changed by a compare match or a second compare match. choose whether to do so. Output select bits 3 and 2 (OS3, OS2) are the second
The output level based on the compare match is selected, and the output select 1 and 0 bits (OS1, OS0) select the output level based on the compare match. Output select 1 and 0 bits (OS1, OS0) are both “0”
Even if a compare match occurs when , the output level of the timer output pin does not change. When the output select 1 bit (OS1) is "0" and the output select 0 bit (OS0) is "1", when a compare match occurs, the output level of the timer output terminal is set to low level. Output select 1 bit (OS1) is “1” and output select 0 bit (OS0) is “0”
When a compare match occurs, the output level of the timer output terminal becomes high level. Even if a compare match occurs when the output select 1 and 0 bits (OS1, OS0) are both "1", the output level of the timer output terminal is inverted. The same applies to the output select 3 and 2 bits (OS3, OS2). Although not particularly limited, if a compare match and a second compare match occur simultaneously, the timer output level changes in the order of inverted output, high level output, and low level output. In addition, output select bits 3 to 0 (OS3
~OS0) are all "0", no timer output is performed and the terminal is used as an input/output port. Bit 4 is a second overflow flag (OVF2) and is set to "1" when the second counter 151 becomes H'FFFF⇒H'0000. Bit 5 is a second compare match flag (CMF2) and is set to "1" when a second compare match occurs. Bit 6 is an overflow flag (OVF), and bit 7 is a compare match flag (CMF), and since these are the same as above, detailed explanation will be omitted.

【0044】タイマコントロ−ルレジスタ148のビッ
ト1、0の第2カウンタクロック選択ビット1・0(C
KS21、CKS20)であり、第2カウンタ151の
入力クロックを選択する。第2カウンタクロック選択ビ
ット1・0(CKS21、CKS20)がいずれも”0
”のとき第2カウンタ151は16ビットカウンタ11
のオ−バフロ−によって、第2カウンタクロック選択ビ
ット1(CKS21)が”0”かつ、第2カウンタクロ
ック選択ビット0(CKS20)が”1”のとき第2カ
ウンタ151はカウンタ11のコンペアマッチによって
、第2カウンタクロック選択ビット1(CKS21)が
”1”かつ、第2カウンタクロック選択ビット0(CK
S20)が”0”のとき第2カウンタ151はカウンタ
11と同一のクロックで、第2カウンタクロック選択ビ
ット1・0(CKS21、CKS20)がいずれも”1
”のときタイマクロック入力端子から入力される外部ク
ロックによって、それぞれカウントアップされる。ビッ
ト3、2はクロック選択ビット3・2(CKS1、CK
S0)であり、カウンタ11の入力クロックを選択する
。クロック選択ビット3・2(CKS1、CKS0)が
いずれも”0”のときカウンタ11はシステムクロック
を図示はされない分周器によって2分周したクロックに
よって、クロック選択ビット3(CKS1)が”0”か
つ、クロック選択ビット2(CKS0)が”1”のとき
システムクロックを4分周したクロックによって、クロ
ック選択ビット3(CKS1)が”1”かつ、クロック
選択ビット2(CKS0)が”0”のときシステムクロ
ックを8分周したクロックによって、クロック選択ビッ
ト3・2(CKS1、CKS0)がいずれも”1”のと
きタイマクロック入力端子から入力される外部クロック
によって、それぞれカウントアップされる。ビット7〜
4はコンペアマッチ割込み許可(CMIE)、オ−バフ
ロ−割込み許可(OVIE)、第2コンペアマッチ割込
み許可(CMI2E)、第2オ−バフロ−割込み許可(
OVI2E)ビットであり、それぞれ、コンペアマッチ
フラグ(CMF)、オ−バフロ−フラグ(OVF)、第
2コンペアマッチフラグ(CMF2)、第2オ−バフロ
−フラグ(OVF2)が”1”にセットされたときにC
PU2に対して割込みを要求するかしないかを選択する
Second counter clock selection bits 1 and 0 (C
KS21, CKS20) and selects the input clock of the second counter 151. Second counter clock selection bits 1 and 0 (CKS21, CKS20) are both “0”
”, the second counter 151 is the 16-bit counter 11
Due to the overflow of the counter 11, when the second counter clock selection bit 1 (CKS21) is "0" and the second counter clock selection bit 0 (CKS20) is "1", the second counter 151 is , second counter clock selection bit 1 (CKS21) is “1” and second counter clock selection bit 0 (CKS21) is “1” and second counter clock selection bit 0 (CK
S20) is "0", the second counter 151 uses the same clock as the counter 11, and the second counter clock selection bits 1 and 0 (CKS21, CKS20) are both "1".
”, the external clock input from the timer clock input terminal counts up. Bits 3 and 2 are clock selection bits 3 and 2 (CKS1, CK
S0) and selects the input clock of the counter 11. When clock selection bits 3 and 2 (CKS1, CKS0) are both "0", the counter 11 uses a clock obtained by dividing the system clock by two using a frequency divider (not shown), and sets clock selection bit 3 (CKS1) to "0". Also, when clock selection bit 2 (CKS0) is "1", a clock obtained by dividing the system clock by 4 causes clock selection bit 3 (CKS1) to be "1" and clock selection bit 2 (CKS0) to be "0". When the clock selection bits 3 and 2 (CKS1, CKS0) are both "1", the external clock input from the timer clock input terminal is counted up using a clock obtained by dividing the system clock by eight. Bit 7~
4 is compare match interrupt enable (CMIE), overflow interrupt enable (OVIE), second compare match interrupt enable (CMI2E), second overflow interrupt enable (
OVI2E) bit, and the compare match flag (CMF), overflow flag (OVF), second compare match flag (CMF2), and second overflow flag (OVF2) are set to "1", respectively. When C
Select whether or not to request an interrupt to PU2.

【0045】タイマモ−ドレジスタ149のビット0は
第2カウンタクリアビット(CCLR2)であり、本ビ
ットが”1”にセットされた状態で第2コンペアマッチ
が発生するとカウンタ11及び第2カウンタ151がH
’0000にクリアされる。本ビットが”0”のときは
コンペアマッチが発生してもカウント動作に影響を与え
ない。ビット1はカウンタクリアビット(CCLR)で
あり、本ビットが”1”にセットされた状態でコンペア
マッチが発生するとカウンタ11のみがH’0000に
クリアされる。本ビットが”0”のときはコンペアマッ
チが発生してもカウント動作に影響を与えない。ビット
3、2はカウント許可1、0ビット(CNTE1、0)
であり、カウント許可1、0ビット(CNTE1、0)
がいずれも”0”の状態ではカウンタ11及び第2カウ
ンタ151のいずれも停止状態とされる。カウント許可
1ビット(CNTE1)が”0”かつカウント許可0ビ
ット(CNTE0)が”1”のときは、第2コンペアマ
ッチフラグ(CMF2)”0”のときカウンタ11及び
第2カウンタ151のカウント動作を行い、第2コンペ
アマッチフラグ(CMF2)が”1”のときカウンタ1
1及び第2カウンタ151のいずれも停止状態とされる
。カウント許可1ビット(CNTE1)が”1”のとき
はカウント許可0ビット(CNTE0)の値に関係なく
カウンタ11及び第2カウンタ151のカウント動作を
行う。ビット4はビット方向選択ビット(SHD)であ
り、コンペアマッチが発生したときデ−タレジスタ16
の内容を左方向にロ−テ−トするか右方向にロ−テ−ト
するかを選択する。ビット5はタイマデ−タアウトプッ
ト許可ビット(TMOE)であり、デ−タレジスタ16
の内容をタイマデ−タ出力端子に出力するかしないかを
選択する。
Bit 0 of the timer mode register 149 is the second counter clear bit (CCLR2), and when a second compare match occurs with this bit set to "1", the counter 11 and the second counter 151 go high.
Cleared to '0000. When this bit is "0", the count operation is not affected even if a compare match occurs. Bit 1 is a counter clear bit (CCLR), and when a compare match occurs with this bit set to "1", only the counter 11 is cleared to H'0000. When this bit is "0", the count operation is not affected even if a compare match occurs. Bits 3 and 2 enable counting 1 and 0 bits (CNTE1 and 0)
and count permission 1, 0 bits (CNTE1, 0)
When both are "0", both the counter 11 and the second counter 151 are stopped. When the count permission 1 bit (CNTE1) is “0” and the count permission 0 bit (CNTE0) is “1”, the count operation of the counter 11 and the second counter 151 is performed when the second compare match flag (CMF2) is “0”. is performed, and when the second compare match flag (CMF2) is “1”, the counter 1 is
Both the first and second counters 151 are stopped. When the count permission 1 bit (CNTE1) is "1", the counter 11 and the second counter 151 perform counting operations regardless of the value of the count permission 0 bit (CNTE0). Bit 4 is a bit direction selection bit (SHD), and when a compare match occurs, the data register 16
Select whether to rotate the contents to the left or right. Bit 5 is the timer data output enable bit (TMOE) and is the data register 16 bit.
Select whether or not to output the contents to the timer data output terminal.

【0046】図15に本実施例のタイマをステッピング
モ−タの制御に利用した動作タイミング例を示す。まず
、モ−タの回転速度に対応した内容を比較レジスタ12
に、モ−タの回転数に対応する内容を第2比較レジスタ
152に設定する。第2カウンタ151の入力クロック
をカウンタ11のコンペアマッチ信号とするように第2
カウンタクロック選択ビット1・0(CKS21、CK
S20)をそれぞれ”0”、”1”にする。デ−タレジ
スタ16の内容をタイマデ−タ出力端子に出力するよう
にタイマデ−タアウトプット許可ビット(TMOE)を
”1”にセットする。デ−タレジスタ16にH’07を
設定する。第2コンペアマッチによりカウンタ11及び
第2カウンタ151を停止するようにカウント許可1、
0ビット(CNTE1、0)をそれぞれ”0”、”1”
、カウンタクリアビット(CCLR)を”1”、第2カ
ウンタクリアビット(CCLR2)を”1”にして、タ
イマの動作を開始する。カウンタ11がコンペアマッチ
を発生する毎にデ−タレジスタ16の内容が左方向にロ
−テ−トし、モ−タは1ステップづつ回転する。 第2コンペアマッチが発生すると所定回転数回転したこ
とになり、タイマの動作は停止する。
FIG. 15 shows an example of operation timing when the timer of this embodiment is used to control a stepping motor. First, the contents corresponding to the rotational speed of the motor are stored in the comparison register 12.
Then, the contents corresponding to the rotational speed of the motor are set in the second comparison register 152. The second counter 151 inputs a second clock so that the input clock of the second counter 151 becomes the compare match signal of the counter 11.
Counter clock selection bits 1 and 0 (CKS21, CK
S20) are set to "0" and "1", respectively. The timer data output enable bit (TMOE) is set to "1" so that the contents of the data register 16 are output to the timer data output terminal. Set H'07 in the data register 16. count permission 1 so that the counter 11 and the second counter 151 are stopped by the second compare match;
0 bit (CNTE1, 0) as “0” and “1” respectively
, the counter clear bit (CCLR) is set to "1", the second counter clear bit (CCLR2) is set to "1", and the timer operation is started. Each time the counter 11 generates a compare match, the contents of the data register 16 are rotated to the left, and the motor rotates one step at a time. When the second compare match occurs, it means that the motor has rotated a predetermined number of revolutions, and the operation of the timer stops.

【0047】図16に、本実施例のタイマをPWM(P
ulse WidthModulation)出力に利
用した動作タイミング例を示す。カウンタ11と第2カ
ウンタ151に同一のクロックが入力するように、例え
ば第2カウンタクロック選択ビット1・0(CKS21
、CKS20)を”1”、”0”に、クロック選択ビッ
ト3・2(CKS1、CKS0)を”0”、”0”にす
る。第2コンペアマッチによってカウンタ11及び第2
カウンタ151がH’0000にクリアされすように第
2カウンタクリアビット(CCLR2)を”1”にする
。コンペアマッチによりロウレベル出力、第2コンペア
マッチによりハイレベル出力となるようにアウトプット
セレクト3〜0ビット(OS3〜OS0)を”0”、”
1”、”1”、”0”にする。その後、カウント許可1
ビット(CNTE1)を”1”にする。これにより、周
期が第2比較レジスタ152、パルス幅が比較レジスタ
12の波形がCPU2の介在なく出力することができる
。本利用例では、デ−タレジスタ16、シフト回路17
は使用しないので削除すればハ−ドウェア規模を縮小す
ることができる。
FIG. 16 shows the timer of this embodiment in PWM (P
An example of the operation timing used for output (ulse WidthModulation) is shown below. For example, the second counter clock selection bits 1 and 0 (CKS21
, CKS20) to "1" and "0", and clock selection bits 3 and 2 (CKS1, CKS0) to "0" and "0". The second compare match causes the counter 11 and the second
The second counter clear bit (CCLR2) is set to "1" so that the counter 151 is cleared to H'0000. Set the output select bits 3 to 0 (OS3 to OS0) to "0" so that a compare match results in a low level output, and a second compare match results in a high level output.
1", "1", "0". Then, count permission 1
Set the bit (CNTE1) to “1”. As a result, the waveform whose period is the second comparison register 152 and whose pulse width is the comparison register 12 can be output without the intervention of the CPU 2. In this usage example, the data register 16, shift circuit 17
Since it is not used, the hardware scale can be reduced by deleting it.

【0048】〔実施例8〕図17は本発明に係るタイマ
の第8の実施例を示すブロック図である。図17のタイ
マは、図13の第7の実施例に対し、第2カウンタ15
1が上位8ビットと下位8ビットに分割可能とされ、さ
らに、第2比較器153が上位8ビット比較器1532
、下位8ビット比較器1531に分割可能とされて構成
される。第2カウンタ151及び第2比較器153が上
位8ビット、下位8ビットに分割した場合には下位8ビ
ットのコンペアマッチによりCPU2に割込みを要求可
能とされ、下位8ビットのコンペアマッチにより、第2
カウンタ151の下位8ビットをH’00にクリアする
とともに上位8ビットをカウントアップする。
[Embodiment 8] FIG. 17 is a block diagram showing an eighth embodiment of a timer according to the present invention. The timer in FIG. 17 differs from the seventh embodiment in FIG.
1 can be divided into upper 8 bits and lower 8 bits, and the second comparator 153 is divided into upper 8 bits comparator 1532.
, a lower 8-bit comparator 1531. When the second counter 151 and the second comparator 153 are divided into upper 8 bits and lower 8 bits, it is possible to request an interrupt to the CPU 2 by a compare match of the lower 8 bits, and by a compare match of the lower 8 bits, the second
The lower 8 bits of the counter 151 are cleared to H'00, and the upper 8 bits are counted up.

【0049】モ−タのトルクを小さくしつつモ−タを回
転させるには比較レジスタ12の内容を順次変更してい
けばよい。これを、コンペアマッチ所定回毎に比較レジ
スタ12の内容を変更するようにすればソフトウェアの
負担を更に軽減できる。例えば、上記下位8ビットのコ
ンペアマッチを利用して、第2比較レジスタの下位にH
’4を設定すればコンペアマッチ4回毎に割込みを受付
けることができる。この下位8ビットのコンペアマッチ
毎に、比較レジスタ12の内容を変更するようにすれば
、CPU2が割込み処理を行う時間間隔が4倍になり、
この間にCPU2が他の処理を行うことができる。
In order to rotate the motor while reducing the torque of the motor, the contents of the comparison register 12 may be sequentially changed. The burden on the software can be further reduced by changing the contents of the comparison register 12 every predetermined number of compare matches. For example, using the above compare match of the lower 8 bits, write H to the lower half of the second comparison register.
If '4 is set, an interrupt can be accepted every four compare matches. If the contents of the comparison register 12 are changed every time the lower 8 bits are compared, the time interval at which the CPU 2 performs interrupt processing will be quadrupled.
During this time, the CPU 2 can perform other processing.

【0050】〔論理回路例〕図18は論理回路例に用い
る特殊な記号を示す表である。図19はカウンタ回路の
具体的な論理回路例でである。図19には代表的な2ビ
ット分のカウンタ回路が示されている。カウンタ回路は
タイマモジュ−ル内デ−タバスTMDBと接続され、常
にリ−ド/ライト可能とされ、また、カウンタクリア信
号により、全ビット”0”にクリア可能とされている。 特に制限はされないものの、クロック選択ビットで選択
されたクロックの立ち下がりエッジによって生成される
カウンタクロックによって桁上がりが許可される。直列
に接続されたnチャネルMOSFET( metal 
oxide semiconductor field
 effect transistor)回路を通じて
、下位ビットから桁上がりがあると、そのビットのデ−
タはENOR(exclusivenor:イクスクル
−シブノア)回路によって反転される。また、そのビッ
トも”1”であると上位に桁上がりを生ずる。全ビット
が”1”であると、次にカウンタクロックが発生したと
きにオ−バフロ−信号が発生する。
[Logic circuit example] FIG. 18 is a table showing special symbols used in logic circuit examples. FIG. 19 shows a specific logic circuit example of the counter circuit. FIG. 19 shows a typical 2-bit counter circuit. The counter circuit is connected to the timer module internal data bus TMDB and is always readable/writable, and can be cleared to all bits "0" by a counter clear signal. Although not particularly limited, carry is permitted by the counter clock generated by the falling edge of the clock selected by the clock selection bit. Series connected n-channel MOSFET (metal
oxide semiconductor field
When there is a carry from the lower bit through the effect transistor) circuit, the data of that bit is
The data is inverted by an ENOR (exclusive nor) circuit. Further, if that bit is also "1", a carry occurs to the higher order. If all bits are "1", an overflow signal will be generated the next time the counter clock is generated.

【0051】図20は比較回路、図21は加減算回路、
図22はシフト回路の具体的な論理回路例である。図2
0〜22には代表的に、それぞれ2ビット分の回路が示
されている。
FIG. 20 shows a comparison circuit, FIG. 21 shows an addition/subtraction circuit,
FIG. 22 shows a specific logic circuit example of the shift circuit. Figure 2
0 to 22 typically each show a circuit for 2 bits.

【0052】上記実施例によれば以下の効果を得るもの
である。すなわち、所定の時間が経過したときに、その
タイマカウンタとは別のデ−タを加工する手段を設ける
ことにより、CPU2がステッピングモ−タの回転速度
変化、回転数の管理及びデ−タの制御等を行う必要がな
く、CPUの負担を軽減することができる。
According to the above embodiment, the following effects can be obtained. That is, by providing means for processing data other than the timer counter when a predetermined time has elapsed, the CPU 2 can change the rotational speed of the stepping motor, manage the number of rotations, and control the data. etc., and the load on the CPU can be reduced.

【0053】以上本発明者によってなされた発明は実施
例に限定されるものではなく、その要旨を逸脱しない範
囲において種々変更可能である。
The invention made by the present inventors is not limited to the embodiments described above, and can be modified in various ways without departing from the spirit thereof.

【0054】例えば、シングルチップマイクロコンピュ
−タに内蔵されるその他の機能ブロックの数、種類又は
内部バスの構成等については何等限定されない。また、
カウンタ回路及び比較回路等のタイマの各ブロックの具
体的構成は上記実施例に限定されず、その他種々変更可
能である。さらに、実施例を相互に組合せせ構成するこ
とも可能であり、実施例の1部を取り出して利用するこ
とも可能である。
For example, there are no limitations on the number or type of other functional blocks built into the single-chip microcomputer, or the configuration of the internal bus. Also,
The specific configuration of each block of the timer, such as the counter circuit and the comparison circuit, is not limited to the above embodiment, and can be modified in various other ways. Furthermore, it is also possible to configure the embodiments by combining them with each other, and it is also possible to take out and utilize a part of the embodiments.

【0055】以上の説明では主として本発明者によって
なされた発明をその背景となった利用分野であるシング
ルチップマイクロコンピュ−タに内蔵されるタイマに適
用した場合について説明したが、それに限定されるもの
ではなく、その他のデ−タ処理装置にも適用可能であり
、本発明は少なくともタイマとタイマを制御する処理装
置を有するデ−タ処理装置に適用することができる。 例えば、CPU、ROM、RAM及びタイマ等が単一の
半導体基板上に構成される必要はなく、マルチチップマ
イクロコンピュ−タシステム等にも適用できる。
[0055] In the above explanation, the invention made by the present inventor was mainly applied to a timer built in a single-chip microcomputer, which is the background field of application, but the present invention is not limited to this. However, the present invention is also applicable to other data processing devices, and the present invention can be applied to data processing devices having at least a timer and a processing device that controls the timer. For example, the CPU, ROM, RAM, timer, etc. do not need to be configured on a single semiconductor substrate, and can also be applied to multi-chip microcomputer systems.

【0056】また、本タイマの応用もステッピングモ−
タに限定されるものではなく、パワ−MOSFET等の
パワ−ドライブ素子といっしょに用いることでOA機器
、AV機器、カメラ等に用いられるブラシレスモ−タ等
各種小形モ−タの制御にも適用できる。さらに、モ−タ
の制御だけでなく種々の応用が可能である。
[0056] This timer can also be applied to stepping mode.
It is not limited to motors, but can also be used to control various small motors such as brushless motors used in OA equipment, AV equipment, cameras, etc. by using it together with power drive elements such as power MOSFETs. can. Furthermore, various applications other than motor control are possible.

【0057】[0057]

【発明の効果】本願において開示される発明のうち代表
的なものによって得られる効果を簡単に説明すれば下記
のとおりである。
Effects of the Invention The effects obtained by typical inventions disclosed in this application are briefly explained below.

【0058】すなわち、所定の時間が経過し、タイマか
らの信号によってCPUが行うべき処理の一部又は全部
をタイマのハ−ドウェアによって行わしめることにより
、CPUの介在が少なくなり、タイマがシステムバス(
内部バス7)から分離して動作することができるので、
その間CPUは別の処理ができ、マイクロコンピュ−タ
の全体的な処理時間を向上することができる。
In other words, when a predetermined period of time has elapsed, by having the timer hardware perform part or all of the processing that should be performed by the CPU in response to a signal from the timer, the intervention of the CPU is reduced, and the timer is connected to the system bus. (
Since it can operate separately from the internal bus 7),
Meanwhile, the CPU can perform other processing, improving the overall processing time of the microcomputer.

【0059】また、ソフトウェアの量を減少することが
できるので、シングルチップマイクロコンピュ−タに内
蔵されるプログラムを格納するROMの容量を少なくす
ることができ、シングルチップマイクロコンピュ−タの
チップサイズが小さくなり、シングルチップマイクロコ
ンピュ−タのコストを下げることが可能になる。一方、
シングルチップマイクロコンピュ−タに内蔵されるプロ
グラムを格納するROMの容量をそのままにした場合は
、別の処理をするためのプログラムを格納することがで
き、システムアプリケ−ションが広がる。
Furthermore, since the amount of software can be reduced, the capacity of the ROM for storing programs built into the single-chip microcomputer can be reduced, and the chip size of the single-chip microcomputer can be reduced. This makes it possible to reduce the cost of single-chip microcomputers. on the other hand,
If the capacity of the ROM for storing programs built into a single-chip microcomputer is left as is, programs for other processing can be stored, expanding the range of system applications.

【0060】さらに、プログラムが簡単になり、ソフト
ウェアの量も減少することができるので、シングルチッ
プマイクロコンピュ−タを用いたシステムの開発期間を
短縮することができ、シングルチップマイクロコンピュ
−タで制御されるシステムのコストも下げることが可能
になる。
Furthermore, since the program becomes simpler and the amount of software can be reduced, the development period for a system using a single-chip microcomputer can be shortened, and the system can be controlled using a single-chip microcomputer. It is also possible to reduce the cost of the system.

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

【図1】第1の実施例のタイマのブロック図[Figure 1] Block diagram of a timer in the first embodiment

【図2】第
1の実施例のタイマコントロ−ルレジスタのビット構成
[Figure 2] Bit configuration diagram of the timer control register of the first embodiment

【図3】第2の実施例のタイマのブロック図[Figure 3] Block diagram of a timer in the second embodiment

【図4】デ
−タレジスタ16及びシフト回路17の詳細ブロック図
[FIG. 4] Detailed block diagram of the data register 16 and shift circuit 17

【図5】第2の実施例のタイマコントロ−ルレジスタの
ビット構成図
[Fig. 5] Bit configuration diagram of the timer control register of the second embodiment

【図6】第3の実施例のタイマのブロック図[Fig. 6] Block diagram of a timer in the third embodiment

【図7】第
3の実施例のタイマコントロ−ルレジスタのビット構成
[Fig. 7] Bit configuration diagram of the timer control register of the third embodiment

【図8】第4の実施例のタイマのブロック図[Fig. 8] Block diagram of a timer of the fourth embodiment

【図9】第
4の実施例のタイマコントロ−ルレジスタのビット構成
[Fig. 9] Bit configuration diagram of the timer control register of the fourth embodiment

【図10】第5の実施例のタイマのブロック図FIG. 10 is a block diagram of a timer according to the fifth embodiment.

【図11
】第5の実施例のタイマコントロ−ルレジスタのビット
構成図
[Figure 11
] Bit configuration diagram of the timer control register of the fifth embodiment

【図12】第6の実施例のタイマのブロック図[Fig. 12] Block diagram of a timer in the sixth embodiment

【図13
】第7の実施例のタイマのブロック図
[Figure 13
] Block diagram of the timer of the seventh embodiment

【図14】第7の
実施例のタイマコントロ−ルレジスタ等のビット構成図
[Fig. 14] Bit configuration diagram of timer control register, etc. of the seventh embodiment

【図15】ステッピングモ−タの制御に利用した動作タ
イミング例図
[Figure 15] Example diagram of operation timing used to control a stepping motor

【図16】PWM出力に利用した動作タイミング例図[Figure 16] Example diagram of operation timing used for PWM output


図17】第8の実施例のタイマのブロック図
[
FIG. 17: Block diagram of a timer in the eighth embodiment

【図18】
論理回路例に用いる記号
[Figure 18]
Symbols used in logic circuit examples

【図19】カウンタ回路の論理回路例[Figure 19] Logic circuit example of counter circuit

【図20】比較回路の論理回路例[Figure 20] Logic circuit example of comparison circuit

【図21】加減算回路の論理回路例[Figure 21] Logic circuit example of addition/subtraction circuit

【図22】シフト回路の論理回路例[Figure 22] Logic circuit example of shift circuit

【図23】シングルチップマイクロコンピュ−タのブロ
ック図
[Figure 23] Block diagram of single-chip microcomputer

【図24】ステッピングモ−タの駆動回路例[Figure 24] Example of stepping motor drive circuit

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

1…タイマ、2…CPU、3…ROM、4…RAM、5
…SCI、6…入出力ポ−ト、7…内部バス、8…シン
グルチップマイクロコンピュ−タ、9…タイマ出力、1
1…カウンタ、12…比較レジスタ、13…比較器、1
41〜149…コントロ−ル・ステ−タスレジスタ、1
5…第2カウンタ、16…デ−タレジスタ、17…シフ
ト回路、18…定数レジスタ、19…加減算回路、10
1〜108…制御論理ブロック、110…バスインタフ
ェ−ス
1...Timer, 2...CPU, 3...ROM, 4...RAM, 5
...SCI, 6...I/O port, 7...Internal bus, 8...Single chip microcomputer, 9...Timer output, 1
1...Counter, 12...Comparison register, 13...Comparator, 1
41-149...Control status register, 1
5... Second counter, 16... Data register, 17... Shift circuit, 18... Constant register, 19... Addition/subtraction circuit, 10
1 to 108...Control logic block, 110...Bus interface

Claims (14)

【特許請求の範囲】[Claims] 【請求項1】計数手段と計数値が所定値に達したことを
判定する手段とを備えたタイマにおいて、デ−タ保持手
段とデ−タ加工手段とを有し、上記計数手段が計数する
計数値が所定値に達したことを契機として、上記デ−タ
保持手段に保持したデ−タを上記デ−タ加工手段によっ
て加工することを可能とするようにされてなることを特
徴とするタイマ。
Claim 1: A timer comprising a counting means and a means for determining whether a counted value has reached a predetermined value, the timer comprising a data holding means and a data processing means, wherein the counting means counts. It is characterized in that the data held in the data holding means can be processed by the data processing means when the count value reaches a predetermined value. timer.
【請求項2】上記デ−タ加工手段は減算処理をするよう
にされてなること特徴とする請求項1記載のタイマ。
2. The timer according to claim 1, wherein said data processing means is adapted to perform subtraction processing.
【請求項3】上記デ−タ加工手段は加算処理をするよう
にされてなること特徴とする請求項1記載のタイマ。
3. The timer according to claim 1, wherein said data processing means is adapted to perform addition processing.
【請求項4】上記デ−タ加工手段はシフト処理をするよ
うにされてなること特徴とする請求項1記載のタイマ。
4. The timer according to claim 1, wherein said data processing means is adapted to perform shift processing.
【請求項5】上記加工したデ−タを上記デ−タ保持手段
に保持するようにされてなること特徴とする請求項1乃
至請求項4記載のタイマ。
5. The timer according to claim 1, wherein the processed data is held in the data holding means.
【請求項6】上記デ−タ保持手段に保持したデ−タの一
部又は全部を外部に出力するようにされてなること特徴
とする請求項1乃至請求項5記載のタイマ。
6. The timer according to claim 1, wherein part or all of the data held in the data holding means is outputted to the outside.
【請求項7】上記デ−タ保持手段に保持したデ−タが所
定値に達したことを判定する手段を有することを特徴と
する請求項1乃至請求項6記載のタイマ。
7. The timer according to claim 1, further comprising means for determining that the data held in said data holding means has reached a predetermined value.
【請求項8】計数手段と、計数値が所定値に達したこと
を判定する手段と、デ−タ保持手段とデ−タ加工手段と
を有し、上記計数手段が計数する計数値が所定値に達し
たことを契機として、上記デ−タ保持手段に保持したデ
−タを上記デ−タ加工手段によって加工することを可能
とするようにされてなるタイマと、更にデ−タ処理手段
を有し、上記デ−タ処理手段の制御によって上記タイマ
が動作するようにされてなること特徴とするマイクロコ
ンピュ−タシステム。
8. A counting means, a means for determining whether the counted value has reached a predetermined value, a data holding means, and a data processing means, wherein the counted value counted by the counting means is a predetermined value. a timer configured to enable the data held in the data holding means to be processed by the data processing means upon reaching the value, and further comprising a data processing means. A microcomputer system characterized in that the timer is operated under the control of the data processing means.
【請求項9】上記計数手段の計数する計数値を上記デ−
タ処理装置が読み出し可能とするようにされてなること
を特徴とする請求項8のマイクロコンピュ−タシステム
9. The count value counted by the counting means is calculated by the data.
9. The microcomputer system according to claim 8, wherein the microcomputer system is adapted to be readable by a data processing device.
【請求項10】上記デ−タ保持手段が保持するデ−タを
上記デ−タ処理装置が書き込み可能とするようにされて
なることを特徴とする請求項8のマイクロコンピュ−タ
システム。
10. A microcomputer system according to claim 8, wherein said data processing device is capable of writing data held by said data holding means.
【請求項11】上記デ−タ保持手段に保持したデ−タが
所定値に達したことを判定する手段を有することを特徴
とする請求項8乃至請求項10記載のマイクロコンピュ
−タシステム。
11. The microcomputer system according to claim 8, further comprising means for determining whether the data held in said data holding means has reached a predetermined value.
【請求項12】上記デ−タ保持手段に保持したデ−タが
所定値に達したことを上記デ−タ処理装置に伝達する手
段を有することを特徴とする請求項8乃至請求項11記
載のマイクロコンピュ−タシステム。
12. The data processing apparatus according to claim 8, further comprising means for transmitting to the data processing device that the data held in the data holding means has reached a predetermined value. microcomputer system.
【請求項13】請求項8乃至請求項12記載のマイクロ
コンピュ−タシステムが単一の半導体装置からなるよう
にされてなることを特徴とするシングルチップマイクロ
コンピュ−タ。
13. A single-chip microcomputer, characterized in that the microcomputer system according to claim 8 is made up of a single semiconductor device.
【請求項14】請求項13に記載のシングルチップマイ
クロコンピュ−タとステッピングモ−トとからなるよう
にされてなることを特徴とするシングルチップマイクロ
コンピュ−タシステム。
14. A single-chip microcomputer system comprising the single-chip microcomputer according to claim 13 and a stepping mote.
JP2407561A 1990-12-27 1990-12-27 Microcomputer system Pending JPH04225409A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2407561A JPH04225409A (en) 1990-12-27 1990-12-27 Microcomputer system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2407561A JPH04225409A (en) 1990-12-27 1990-12-27 Microcomputer system

Publications (1)

Publication Number Publication Date
JPH04225409A true JPH04225409A (en) 1992-08-14

Family

ID=18517131

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2407561A Pending JPH04225409A (en) 1990-12-27 1990-12-27 Microcomputer system

Country Status (1)

Country Link
JP (1) JPH04225409A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106774636A (en) * 2016-11-22 2017-05-31 上海华力微电子有限公司 The detecting system and method for chip internal actuation time

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106774636A (en) * 2016-11-22 2017-05-31 上海华力微电子有限公司 The detecting system and method for chip internal actuation time
CN106774636B (en) * 2016-11-22 2020-03-31 上海华力微电子有限公司 System and method for detecting chip internal action time

Similar Documents

Publication Publication Date Title
US6292888B1 (en) Register transfer unit for electronic processor
JP3171925B2 (en) Data processing device
US5410721A (en) System and method for incrementing a program counter
JPH02165721A (en) Pulse output device
JPH04225409A (en) Microcomputer system
JPH06348507A (en) Microcomputer
JP2818986B2 (en) Microcomputer with built-in motor control circuit
JPH0831033B2 (en) Data processing device
JP2990140B2 (en) Interrupt control circuit
JP3239042B2 (en) Microcomputer
JPH0443302B2 (en)
JP2903903B2 (en) Microcomputer
JPH04192037A (en) Semiconductor integrated circuit
JPH0736820A (en) I/o controller
JPH02103613A (en) Microcomputer
JPH08305564A (en) Microcomputer
JPS63170755A (en) Microcomputer
JPH05120030A (en) Interruption controller
JPH06139084A (en) Information processor
JPH0821026B2 (en) Microcomputer
JPH0675765A (en) Processing speed controller
JPH10143462A (en) Microcomputer
JPH06139076A (en) Interruption processor
JPH09237144A (en) Input and output controller
JPH0373028A (en) Processor device