JPH10198410A - Pulse generation circuit - Google Patents

Pulse generation circuit

Info

Publication number
JPH10198410A
JPH10198410A JP1470497A JP1470497A JPH10198410A JP H10198410 A JPH10198410 A JP H10198410A JP 1470497 A JP1470497 A JP 1470497A JP 1470497 A JP1470497 A JP 1470497A JP H10198410 A JPH10198410 A JP H10198410A
Authority
JP
Japan
Prior art keywords
pulse
cpu
set value
interrupt
pulse generation
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
JP1470497A
Other languages
Japanese (ja)
Inventor
Hiroaki Takeuchi
浩昭 武内
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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co 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 Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP1470497A priority Critical patent/JPH10198410A/en
Publication of JPH10198410A publication Critical patent/JPH10198410A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To reduce the load of a system controlling CPU without preparing a CPU only for pulse generation and to increase operation speed. SOLUTION: The pulse generation circuit is provided with a CPU 1 for controlling the whole system, a pulse generation part 2 for counting up the pulse generation frequency of an original clock signal and generating a pulse every when its count value reaches a set point, and a pulse counter part 3 for counting the pulse generation frequency from the pulse generation part 2 and generating an interruption for changing the frequency of a pulse to the CPU 1 at every time when its count value reaches a set point. Since the frequency of a pulse and the generation timing of an interruption to the CPU 1 can be changed by changing those set points, the load of the CPU 1 can be sharply reduced.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、複写機やイメージ
リーダなど高精度の動作制御が要求される駆動機構のモ
ータ等を駆動制御するためのパルス発生回路に関するも
のである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a pulse generating circuit for driving and controlling a motor of a driving mechanism requiring high-precision operation control such as a copying machine or an image reader.

【0002】[0002]

【従来の技術】複写機やイメージリーダなどに装備され
る画像走査機構などの駆動機構のアクチュエータにはパ
ルス駆動型のモータが使用される。この種のモータの駆
動パルスの加減速制御は、複写機などのシステム全体を
制御するCPUのタイマー割り込み処理を利用して行わ
れる。すなわち、割り込み処理の度毎にパルス(Hig
hまたはLow)を発生させ、その割り込み処理が発生
する時間間隔を逐次変化させることにより、パルスの発
生から次のパルスの発生までの時間を変化させ、結果と
してパルス幅を変化させて駆動パルスの加減速制御を行
う。
2. Description of the Related Art A pulse drive type motor is used as an actuator of a drive mechanism such as an image scanning mechanism provided in a copying machine or an image reader. This type of motor drive pulse acceleration / deceleration control is performed using a timer interrupt process of a CPU that controls the entire system such as a copying machine. That is, a pulse (Hig
h or Low) and sequentially changing the time interval at which the interrupt processing occurs, thereby changing the time from the generation of a pulse to the generation of the next pulse, and consequently changing the pulse width to change the drive pulse. Perform acceleration / deceleration control.

【0003】[0003]

【発明が解決しようとする課題】しかし、上述した従来
の割り込み処理を利用した制御方法では、発生させるパ
ルスの周波数が非常に高い場合、割り込み処理が頻繁に
発生することになり、割り込み以外の処理の動作スピー
ドが下り、いわゆる重い状態になるという問題があっ
た。このことは1つのCPUで複数のアクチュエータに
対しての加減速制御を行う場合などにより深刻な問題と
なってくる。また、より滑らかな加減速制御を行おうと
するとますます割り込みが頻繁に発生してしまう。この
ような問題を解消するために、例えば特開平2−159
879号公報に記載の画像走査装置では、システム制御
用のCPUの他にモータを駆動するためのパルスを発生
する専用のCPUを備えている。このようにパルス発生
専用のCPUを使用すれば、システム制御用のCPUの
動作スピードに影響を与えることなく、モータの細かな
制御が可能になるが、パルス発生専用のCPUを実装し
たことによりコストが高くなる他、システム制御用のC
PUとパルス発生専用のCPU間のデータのやりとりの
ために制御が煩雑になる可能性がある。本発明の課題
は、パルス発生専用のCPUを備えずに、システム制御
用のCPUの負担を軽くして動作スピードを向上できる
パルス発生回路を提供することにある。
However, in the above-described control method using the conventional interrupt processing, if the frequency of the pulse to be generated is very high, the interrupt processing occurs frequently, and the processing other than the interrupt processing is performed. However, there is a problem that the operation speed of the device is lowered, and a so-called heavy condition is caused. This poses a serious problem when a single CPU performs acceleration / deceleration control for a plurality of actuators. Further, if smoother acceleration / deceleration control is performed, interrupts are more frequently generated. In order to solve such a problem, for example, Japanese Patent Laid-Open No. 2-159
The image scanning apparatus described in Japanese Patent No. 879 has a CPU dedicated to generating pulses for driving a motor, in addition to a CPU for system control. Using a CPU dedicated to pulse generation in this way enables fine control of the motor without affecting the operating speed of the CPU for system control, but the cost is reduced by mounting the CPU dedicated to pulse generation. And C for system control
Control may be complicated due to data exchange between the PU and the CPU dedicated to pulse generation. An object of the present invention is to provide a pulse generation circuit which can reduce the load on a system control CPU and improve the operation speed without providing a CPU dedicated to pulse generation.

【0004】[0004]

【課題を解決するための手段】上記課題を解決するため
に、請求項1記載の発明に係るパルス発生回路は、例え
ばパルス駆動型のモータなどを含むシステム全体を制御
するCPUと、源クロック信号のパルス発生回数をカウ
ントし、そのカウント数が設定値に達する毎に前記モー
タなどを駆動するパルスを発生するパルス発生部と、該
パルス発生部からのパルス発生回数をカウントし、その
カウント数が設定値に達する毎に、前記CPUに対して
前記モータなどを駆動するパルスの周波数を変更するた
めの割り込みを発生させるパルスカウンタ部とを備えた
ことを特徴としている。また、請求項2記載の発明に係
るパルス発生回路は、請求項1を前提にして、前記パル
ス発生部に保持される前記設定値が前記CPUによって
変更されるようになしたことを特徴としている。また、
請求項3記載の発明に係るパルス発生回路は、請求項1
を前提にして、前記パルスカウンタ部に保持される前記
設定値が前記CPUによって変更されるようになしたこ
とを特徴としている。また、請求項4記載の発明に係る
パルス発生回路は、請求項2または3を前提にして、前
記設定値の変更が前記CPUの割り込み処理内で行われ
るようになしたことを特徴としている。また、請求項5
記載の発明に係るパルス発生回路は、請求項1を前提に
して、前記パルス発生部は前記設定値を保持しておくた
めの第1及び第2の設定保持回路を具備してなることを
特徴としている。また、請求項6記載の発明に係るパル
ス発生回路は、請求項1を前提にして、前記パルスカウ
ンタ部は前記設定値を保持しておくための第1及び第2
の設定保持回路を具備してなることを特徴としている。
また、請求項7記載の発明に係るパルス発生回路は、請
求項5または6を前提にして、前記第1の設定保持回路
に保持された設定値は前記CPUにより変更可能であ
り、前記第2の設定保持回路に保持された設定値は起動
時及び前記CPUへの割り込み発生時に前記第1の保持
回路から転送されたものであることを特徴としている。
また、請求項8記載の発明に係るパルス発生回路は、請
求項7を前提にして、前記第2の設定保持回路に保持さ
れた設定値に基づいて動作することを特徴としている。
In order to solve the above-mentioned problems, a pulse generating circuit according to the first aspect of the present invention includes a CPU for controlling an entire system including, for example, a pulse drive type motor and a source clock signal. A pulse generator that generates a pulse for driving the motor or the like each time the count reaches a set value, and counts the number of pulses generated from the pulse generator, and the count is A pulse counter for generating an interrupt for changing a frequency of a pulse for driving the motor or the like to the CPU each time the set value is reached. According to a second aspect of the present invention, based on the first aspect, the set value held in the pulse generator is changed by the CPU. . Also,
According to a third aspect of the present invention, there is provided a pulse generation circuit.
On the premise that the set value held in the pulse counter unit is changed by the CPU. A pulse generating circuit according to a fourth aspect of the present invention is characterized in that, based on the second or third aspect, the change of the set value is performed within an interrupt process of the CPU. Claim 5
The pulse generation circuit according to the invention described above is characterized in that, on the premise of claim 1, the pulse generation section includes first and second setting holding circuits for holding the set value. And According to a sixth aspect of the present invention, in the pulse generation circuit according to the first aspect, the pulse counter unit includes a first and a second circuit for holding the set value.
Is provided.
In the pulse generation circuit according to the present invention, the setting value held in the first setting holding circuit can be changed by the CPU and the second value can be changed by the CPU. The setting values held in the setting holding circuit are transferred from the first holding circuit at the time of startup and when an interrupt to the CPU occurs.
The pulse generating circuit according to the invention of claim 8 is characterized in that it operates based on the setting value held in the second setting holding circuit based on claim 7.

【0005】[0005]

【発明の実施の形態】以下、本発明の実施の形態につい
て説明する。図1は本発明に係るパルス発生回路の実施
の形態の一例を示す回路構成図である。図中、1は電子
写真式の複写機のシステム全体を統括制御するCPU、
2はCPU1の発する源クロック信号のパルス発生回数
をカウントし、そのカウント数が設定値に達する毎に複
写機の画像走査機構の駆動用モータの駆動パルスを発生
するパルス発生部、3はパルス発生部2からのパルス発
生回数をカウントし、そのカウント数が設定値に達する
毎に、CPU1に対して前記モータの駆動パルスの周波
数を変更するための割り込みを発生させるパルスカウン
タ部である。パルス発生部2は、CPU1よリ与えられ
る設定値を記憶保持する第1のレジスタ4、パルス発生
部2の動作中の実際の動作を決定する設定値を記憶保持
する第2のレジスタ5、源クロック信号のパルス発生回
数をカウントするクロックカウンタ6、第2のレジスタ
5に保持されている設定値N1とクロックカウンタ6の
カウント値n1とを比較するコンパレータ7、及び、コ
ンパレータ7からの信号に応じてモータ駆動パルスを発
生するパルスジェネレータ8等で構成される。
Embodiments of the present invention will be described below. FIG. 1 is a circuit diagram showing an example of an embodiment of a pulse generating circuit according to the present invention. In the drawing, reference numeral 1 denotes a CPU that controls the entire system of an electrophotographic copying machine;
A pulse generator 2 counts the number of pulse generations of the source clock signal generated by the CPU 1, and generates a driving pulse for a driving motor of an image scanning mechanism of a copying machine every time the counted number reaches a set value. A pulse counter unit that counts the number of pulse generations from the unit 2 and generates an interrupt for changing the frequency of the motor drive pulse to the CPU 1 each time the counted number reaches a set value. The pulse generator 2 includes a first register 4 that stores and holds a set value given by the CPU 1, a second register 5 that stores and holds a set value that determines an actual operation during operation of the pulse generator 2, A clock counter 6 that counts the number of clock signal pulse generations, a comparator 7 that compares a set value N1 held in the second register 5 with a count value n1 of the clock counter 6, and a signal from the comparator 7. And a pulse generator 8 for generating a motor drive pulse.

【0006】クロックカウンタ6は、源クロック信号の
パルスが入る毎にカウントアップし、そのカウント値を
常にコンパレータ7へ出力している。コンパレータ7
は、第2のレジスタ5に保持されている設定値N1とク
ロックカウンタ6のカウント値n1とを常時比較し、設
定値N1とカウント値n1とが等しくなる度毎に信号を
出力する。コンパレータ7の出力信号はクロックカウン
タ6のクリア端子とパルスジェネレータ8とに入力さ
れ、それによってクロックカウンタ6がクリア(リセッ
ト)されると同時に、パルスジェネレータ8によりパル
スが出力される。パルスカウンタ部3は、CPU1より
与えられる設定値を記憶保持する第1のレジスタ9、パ
ルスカウンタ部3の動作中の実際の動作を決定する設定
値を記憶保持する第2のレジスタ10、パルス発生部2
のパルス発生回数をカウントするパルスカウンタ11、
第2のレジスタ10に保持されている設定値N2とパル
スカウンタ11のカウント値n2とを比較するコンパレ
ータ12、及びコンパレータ12からの信号に応じて割
り込み発生信号を出力する割込みコントローラ13等で
構成される。
The clock counter 6 counts up each time a pulse of the source clock signal is received, and constantly outputs the count value to the comparator 7. Comparator 7
Always compares the set value N1 held in the second register 5 with the count value n1 of the clock counter 6, and outputs a signal every time the set value N1 becomes equal to the count value n1. The output signal of the comparator 7 is input to a clear terminal of the clock counter 6 and the pulse generator 8, whereby the clock counter 6 is cleared (reset), and at the same time, a pulse is output by the pulse generator 8. The pulse counter unit 3 has a first register 9 for storing and holding a set value given from the CPU 1, a second register 10 for storing and holding a set value for determining an actual operation of the pulse counter unit 3 during operation, a pulse generation. Part 2
A pulse counter 11 for counting the number of occurrences of the pulse
The comparator 12 includes a comparator 12 that compares the set value N2 held in the second register 10 with the count value n2 of the pulse counter 11, and an interrupt controller 13 that outputs an interrupt generation signal in accordance with a signal from the comparator 12. You.

【0007】パルスカウンタ11は、パルスジェネレー
タ8からパルスが入力される度毎に抽出信号を作成し、
その信号をイネーブルとして使用してパルス発生回数を
カウントする(図6参照)。パルスカウンタ11のカウ
ント値と第2のレジスタ10の設定値は常時コンパレー
タ12に入力されている。コンパレータ12は、第2の
レジスタ10に保持されている設定値N2とパルスカウ
ンタ11のカウント値n2とを常時比較し、設定値N2
とカウント値n2とが等しくなる度毎に割込みコントロ
ーラ13に信号を出力する。割込みコントローラ13
は、コンパレータ12から信号を受けるとCPU1へ割
込み発生信号を出力する。以上の構成において、パルス
発生部2の第1及び第2のレジスタ4、5の設定値を変
更すれば、コンパレータ7が信号を出力するタイミング
が変化するので、パルスジェネレータ8により発生され
るパルスの周波数(あるいは幅)を可変にすることがで
きる。また、パルスカウンタ部3の第1及び第2のレジ
スタ9、10の設定値を変更すれば、コンパレータ12
が信号を出力するタイミングが変化するので、割込みコ
ントローラ13による割込み発生信号の発生タイミング
を可変とすることができる。
The pulse counter 11 generates an extraction signal every time a pulse is input from the pulse generator 8,
Using the signal as an enable, the number of times of pulse generation is counted (see FIG. 6). The count value of the pulse counter 11 and the set value of the second register 10 are always input to the comparator 12. The comparator 12 constantly compares the set value N2 held in the second register 10 with the count value n2 of the pulse counter 11, and sets the set value N2
And outputs a signal to the interrupt controller 13 each time the count value n2 becomes equal. Interrupt controller 13
Outputs an interrupt generation signal to the CPU 1 upon receiving a signal from the comparator 12. In the above configuration, when the set values of the first and second registers 4 and 5 of the pulse generator 2 are changed, the timing at which the comparator 7 outputs a signal changes. The frequency (or width) can be made variable. If the set values of the first and second registers 9 and 10 of the pulse counter unit 3 are changed, the comparator 12
Since the timing at which the signal is output changes, the timing at which the interrupt controller 13 generates the interrupt generation signal can be made variable.

【0008】図2にパルス発生部2及びパルスカウンタ
部3の各々のレジスタに設定値を記憶保持させるための
回路構成例を示す。CPU1からはアドレスバス、デー
タバス、リード、ライトなどのコントロール信号(図中
では/WR)が出力されている。各レジスタはCPU1
から見たときに、それぞれ所定のアドレス上に定義され
ており、CPU1がそのアドレスにアクセスすると、デ
コーダ14の出力のうち、レジスタのイネーブル端子に
接続されているものがアクティブになり、CPU1の/
WR信号をクロックとして、出力側に伝達される。そし
て、次に同じアドレスへアクセスがあるまでの間、設定
値が保持される。前述したように、パルスカウンタ部3
の第2のレジスタ10に保持されている設定値N2とパ
ルスカウンタ11のカウント値n2とがコンパレータ1
2により常時比較され、設定値N2とカウント値n2と
が等しくなる度毎に割込みコントローラ13に信号が出
力される。したがって、この信号を利用することによ
り、パルス発生回路がある設定幅のパルスを所定回数発
生したことを、割り込みという形でCPU1に通知する
ことができ、割り込み処理によって、次のパルス周波数
(あるいはパルス幅)、及びパルスカウント数を決定す
るための設定値を各レジスタに設定することができる。
FIG. 2 shows an example of a circuit configuration for storing a set value in each register of the pulse generator 2 and the pulse counter 3. The CPU 1 outputs control signals (/ WR in the figure) such as an address bus, a data bus, read, and write. Each register is CPU1
When the CPU 1 accesses the address, one of the outputs of the decoder 14 that is connected to the enable terminal of the register becomes active, and
The WR signal is transmitted to the output side as a clock. The set value is held until the next access to the same address. As described above, the pulse counter unit 3
The set value N2 held in the second register 10 and the count value n2 of the pulse counter 11
2 and a signal is output to the interrupt controller 13 every time the set value N2 becomes equal to the count value n2. Therefore, by using this signal, it is possible to notify the CPU 1 in the form of an interrupt that the pulse generation circuit has generated a pulse having a certain set width a predetermined number of times, and to execute the next pulse frequency (or pulse Width) and a set value for determining the pulse count number can be set in each register.

【0009】図3にCPU1における割り込み処理動作
のフローを示す。CPU1は割り込みを通知されると、
通常のフローを中断し、割り込み処理を開始する(S
1)。実際にモータ等の駆動パルスを発生する場合、特
にモータの加減速制御をする場合等には、パルス幅設定
値、パルスカウント設定値を割り込みが実行されるたび
に順次変更していく必要がある。そのため、あらかじめ
これらの設定値を決定するためのテーブルをプログラム
が格納されているROM(図示せず)にデータとして用
意しておき、そのテーブルの参照場所を制御するため
に、ソフトウェアで実現されるテーブル参照カウンタ
を、割り込み処理を実行するたびにインクリメントする
(S2)。そして、その都度テーブル参照カウンタの値
を調べ、上記テーブルを最後まで参照したか否かを判断
し(S3)、最後ならは(S3でYes)、パルス発生
部2のレジスタ(パルス幅レジスタ)及びパルスカウン
タ部3のレジスタ(パルスカウントレジスタ)をクリア
し(S4)、モータ制止制御及び割込み禁止処理(S
5)を行う。そうでない場合は(S3でNo)、次のテ
ーブルの値を参照して、レジスタに設定する。
FIG. 3 shows a flow of the interrupt processing operation in the CPU 1. When the CPU 1 is notified of the interrupt,
The normal flow is interrupted and interrupt processing is started (S
1). When actually generating a drive pulse of a motor or the like, particularly when controlling acceleration / deceleration of a motor, it is necessary to sequentially change the pulse width set value and the pulse count set value each time an interrupt is executed. . Therefore, a table for determining these set values is prepared in advance in a ROM (not shown) in which a program is stored as data, and is implemented by software to control a reference location of the table. The table reference counter is incremented each time interrupt processing is executed (S2). Each time, the value of the table reference counter is checked to determine whether or not the table has been referenced to the end (S3). If the table has been referenced (Yes in S3), the register (pulse width register) of the pulse generator 2 and The register (pulse count register) of the pulse counter unit 3 is cleared (S4), and the motor stop control and the interrupt prohibition process (S4) are performed.
Perform 5). Otherwise (No in S3), the value is set in the register by referring to the value in the next table.

【0010】例として、図4のような曲線で示されるパ
ルス周波数の加減速制御を行う場合の、テーブルデータ
の作成例を図5に示す。図4の加減速制御では1〜8の
8段階にパルス周波数が変化される。図5はメモリ上に
配置された値を表したもので、PCn がパルスカウント
のデータテーブル、fn が周波数テーブルである。周波
数とはパルス幅レジスタ、すなわちパルス発生部2のレ
ジスタに設定する値のことであり、パルスカウントとは
パルスカウントレジスタ、すなわちパルスカウンタ部3
のレジスタに設定する値のことである。テーブル値はメ
モリ上に連続して格納される。各テーブルの先頭アドレ
スをそれぞれa、bとし、これらのアドレスを記憶して
おき、このパルス発生回路の起動時にこのアドレスから
設定値を取得する。そして、割り込みが発生するたびに
テーブル参照カウンタをインクリメントし(上記ステッ
プS2に対応)、a、bのアドレスとカウンタ値を加算
したアドレスから設定値を取得する。このようにすれば
順次設定値を取得でき、各レジスタの値を変更できる。
As an example, FIG. 5 shows an example of creating table data when performing acceleration / deceleration control of a pulse frequency indicated by a curve as shown in FIG. In the acceleration / deceleration control of FIG. 4, the pulse frequency is changed in eight stages of 1 to 8. FIG. 5 shows the values arranged on the memory, where PCn is a pulse count data table and fn is a frequency table. The frequency is a value set in a pulse width register, that is, a register of the pulse generation unit 2, and the pulse count is a pulse count register, that is, a pulse counter unit 3.
Is the value to be set in the register. The table values are stored continuously on the memory. The head addresses of the tables are a and b, respectively, and these addresses are stored, and the set value is obtained from these addresses when the pulse generation circuit starts. Then, each time an interrupt occurs, the table reference counter is incremented (corresponding to the above step S2), and the set value is obtained from the address obtained by adding the addresses a and b and the counter value. In this way, the set values can be sequentially obtained, and the value of each register can be changed.

【0011】次に、パルス発生部2及びパルスカウンタ
部3の第1及び第2のレジスタの機能についてより詳細
に説明する。図7はパルス発生部2及びパルスカウンタ
部3の第1及び第2のレジスタと、両レジスタを組み合
わせて機能させるための周辺回路とを示した部分回路図
である。第1のレジスタ4、9及び第2のレジスタ5、
10はDフリップフロップで構成され、両者間にAND
ゲート16と2つのORゲート17、18とからなるロ
ジック回路が挿入されている。フリップフロップのCL
K端子にはシステムクロックが入力されるので、モータ
をONする信号の1パルス抽出信号をON1P、CPU
1へ割り込みを通知する割り込み信号の1パルス抽出信
号をIRQ1Pとし、この2つの信号の論理和をとり、
その出力と設定値信号をで論理積し、その出力と回路動
作中を示すMTON信号(プログラムに従ってCPU1
によりON/OFFされる)を論理和することにより、
回路起動時、及び割り込みが発生するたびに第1のレジ
スタ4、9の設定値を第2のレジスタ5、10に転送す
ることができる。
Next, the functions of the first and second registers of the pulse generator 2 and the pulse counter 3 will be described in more detail. FIG. 7 is a partial circuit diagram showing the first and second registers of the pulse generation unit 2 and the pulse counter unit 3 and a peripheral circuit for making both registers function in combination. A first register 4, 9 and a second register 5,
Reference numeral 10 denotes a D flip-flop, between which an AND
A logic circuit including a gate 16 and two OR gates 17 and 18 is inserted. CL of flip-flop
Since the system clock is input to the K terminal, the 1-pulse extraction signal of the signal for turning on the motor is ON1P, and the CPU
An IRQ1P is a 1-pulse extraction signal of an interrupt signal for notifying an interrupt to 1, and a logical sum of these two signals is obtained.
The output and the set value signal are ANDed with each other, and the output and an MTON signal indicating that the circuit is operating (CPU 1
Is turned ON / OFF by OR)
The set values of the first registers 4 and 9 can be transferred to the second registers 5 and 10 when the circuit is started and each time an interrupt occurs.

【0012】図8に上記回路のタイミングチャートを示
す。図示するように、回路起動時、すなわちMTON信
号がLowからHighになったとき時、及び割り込み
発生時に第1のレジスタのデータが第2のレジスタへ転
送される。第1のレジスタへのデータ設定は、割り込み
発生後ソフトウェアによって行われるので、割り込み発
生と同時にハード的にデータが転送される第2のレジス
タよりも遅れて設定される。この図から明らかなよう
に、ソフトウェア(CPUの実行するプログラム)によ
り設定される設定値と、実際にハードウエア(回路)の
動作を決定している設定値にはずれがある。その相関を
図9に示す。また、回路起動時及び割込み処理時に設定
値を設定変更する処理の動作フローを図10に示す。
FIG. 8 shows a timing chart of the above circuit. As shown, when the circuit is started, that is, when the MTON signal changes from low to high, and when an interrupt occurs, the data of the first register is transferred to the second register. Since the data setting in the first register is performed by software after the occurrence of the interrupt, the data is set later than the second register to which the data is transferred by hardware simultaneously with the occurrence of the interrupt. As is apparent from this figure, there is a difference between a set value set by software (a program executed by the CPU) and a set value that actually determines the operation of the hardware (circuit). FIG. 9 shows the correlation. FIG. 10 shows an operation flow of a process of changing the setting value at the time of starting the circuit and at the time of interrupt processing.

【0013】CPU1は、パルス発生部2及びパルスカ
ウンタ部3の回路を起動する前に、図10のステップS
11に示すように、第1のレジスタに最初の値
Before activating the circuits of the pulse generator 2 and the pulse counter 3, the CPU 1 executes step S in FIG.
As shown in FIG. 11, the first value is stored in the first register.

〔0〕を
書き込み、その後MTON信号を立ち上げてモータを起
動させる(S12)。これにより、第1のレジスタに設
定された最初の値
[0] is written, and then the MTON signal is started to start the motor (S12). As a result, the first value set in the first register

〔0〕は図8中に示すタイミングtm
0で第2のレジスタに転送される。また、MTON信号
を立ち上げた後、次の割込みが発生したときに設定する
値[ 1] を第1のレジスタに書き込む(S13)。そし
て、最初の値
[0] is the timing tm shown in FIG.
At 0, it is transferred to the second register. After the MTON signal is activated, the value [1] to be set when the next interrupt occurs is written to the first register (S13). And the first value

〔0〕での動作が終了するとハードウエア
は割り込みを発生させ(S14)、第1のレジスタに設
定してある値〔1〕を図8中に示すタイミングtm1で
第2のレジスタに転送し、その変更された値〔1〕に応
じた動作を開始する。また、この割り込み発生で割り込
みフローが実行され、次の値〔2〕が図8中に示すタイ
ミングtm2で第1のレジスタに設定される(S1
5)。
When the operation at [0] is completed, the hardware generates an interrupt (S14), and transfers the value [1] set in the first register to the second register at timing tm1 shown in FIG. The operation according to the changed value [1] is started. When the interrupt occurs, an interrupt flow is executed, and the next value [2] is set in the first register at timing tm2 shown in FIG. 8 (S1).
5).

【0014】上記の動作におけるソフトウェアにより設
定される設定値と、実際にハードウエアの動作を決定し
ている設定値との相関を示したのが図9であり、CPU
1はソフトウェアすなわちプログラムに従って、設定す
べき値が最後まで到達し、その次に割り込みが入ったと
き(図9中にPで示す状態のとき)にMTON信号をL
owにし、割り込みの受付を禁止する。ハードウエアす
なわちパルス発生部2及びパルスカウンタ部3の回路は
第2のレジスタに設定保持された最後の設定値〔n〕で
動作し、所定回数だけパルスを出力すると割り込みを発
生する。この時プログラムに従って動作するCPU1側
では割り込みの受付が禁止されているので、割り込みフ
ローは実行されない。上記のように、ハードウェアが割
り込みを発生してから、ソフトウェアがそれを認識し、
割り込みルーチンに入るまでの時間に関係なく次の値を
設定できるよにしたので、パルス波形にハザードが発生
したり、波形の数が合わなくなるという不具合を回避す
ることができる。
FIG. 9 shows the correlation between the set value set by software in the above operation and the set value that actually determines the operation of the hardware.
When the value to be set reaches the end according to software, that is, the program, the MTON signal is set to L when the next interrupt occurs (in a state indicated by P in FIG. 9).
Set to ow to disable acceptance of interrupts. The hardware, that is, the circuit of the pulse generator 2 and the pulse counter 3 operates at the last set value [n] set and held in the second register, and generates an interrupt when a pulse is output a predetermined number of times. At this time, the interrupt flow is not executed because the acceptance of the interrupt is prohibited on the CPU 1 side operating according to the program. As mentioned above, after the hardware generates an interrupt, the software recognizes it,
Since the next value can be set irrespective of the time up to the start of the interrupt routine, it is possible to avoid a problem that a hazard is generated in the pulse waveform or the number of waveforms does not match.

【0015】上記において、パルスジェネレータ8とモ
ータとの間に、例えば図11に示すように、割り込み信
号IRQ1PとMTON信号とを利用し、割り込みが発
生したときのMTON信号の状態を出力する回路20
と、その回路20の出力状態とパルスジェネレータ8か
らのパルスによりパルス出力の制御を行う回路21とを
挿入することにより、モータへのパルスを停止させるこ
とができる。また、図12に示すような回路を用いれ
ば、CPU1がプログラムに従ってMTON信号をLo
wにすると、割り込み等に関係なく、モータへのパルス
出力を停止することができる。したがって、図4のよう
にあらかじめ決められたパルスを出力するような場合で
も、センサ等の入力をトリガとしてパルスを即断するよ
うな場合でもこのパルス発生回路を利用することができ
る。なお、以上の実施の形態では1種類のパルスを発生
させる回路構成を例にとり説明したが、パルスジェネレ
−タ8内にクロックカウンタ6と連動したカウンタを付
加し、発生させるパルスを増やすことによってステッピ
ングモータの加減速制御を行うことも可能である。
In the above, between the pulse generator 8 and the motor, for example, as shown in FIG. 11, a circuit 20 for utilizing the interrupt signal IRQ1P and the MTON signal to output the state of the MTON signal when an interrupt occurs.
By inserting a circuit 21 that controls the pulse output from the output state of the circuit 20 and the pulse from the pulse generator 8, the pulse to the motor can be stopped. If the circuit as shown in FIG. 12 is used, the CPU 1 outputs the MTON signal to Lo according to a program.
When w is set, pulse output to the motor can be stopped irrespective of interruption or the like. Therefore, the pulse generating circuit can be used in a case where a predetermined pulse is output as shown in FIG. 4 or a case where the pulse is immediately interrupted by an input of a sensor or the like as a trigger. In the above embodiment, a circuit configuration for generating one kind of pulse has been described as an example. However, a counter linked to the clock counter 6 is added to the pulse generator 8 and the number of generated pulses is increased to perform stepping. It is also possible to perform acceleration / deceleration control of the motor.

【0016】[0016]

【発明の効果】以上説明したように、本発明は以下のよ
うな効果を発揮する。請求項1のパルス発生回路によれ
ば、パルス発生部における設定値を変更することによ
り、発生するパルスの周波数を変化させることができ、
また、パルスカウンタ部における設定値を変更すること
により、CPUへの割り込みの発生タイミングを可変と
することができ、さらに、CPUへの割り込みがパルス
の周波数が変わるときにのみ発生するようにできるの
で、CPUへの負荷を軽減して動作スピードを向上させ
ることができ、しかも、パルス発生専用のCPUを付加
する必要がないのでコストを低減できる。請求項2、3
のパルス発生回路によれば、上記の効果に加え、上記設
定値をCPUによって変更できるので、パルス発生部及
びパルスカウンタ部の回路規模を小さくすることがで
き、よりコストを低減できる。請求項4のパルス発生回
路によれば、請求項2、3において、動作スピードをよ
り向上をさせることができる。請求項5、6、7、8の
パルス発生回路によれば、ハードウェアが割り込みを発
生してから、プログラムに従って動作するCPUがそれ
を認識し、割り込みルーチンに入るまでの時間に関係な
く次の値を設定できるので、パルス波形にハザードが発
生したり、波形の数が合わなくなるという不具合を回避
することができる。
As described above, the present invention has the following effects. According to the pulse generation circuit of the first aspect, by changing the set value in the pulse generation unit, the frequency of the generated pulse can be changed,
Also, by changing the set value in the pulse counter section, the timing of the interrupt to the CPU can be made variable, and furthermore, the interrupt to the CPU can be generated only when the pulse frequency changes. The operation speed can be improved by reducing the load on the CPU, and the cost can be reduced because it is not necessary to add a CPU dedicated to pulse generation. Claims 2 and 3
According to the pulse generation circuit, in addition to the above effects, the set value can be changed by the CPU, so that the circuit scale of the pulse generation unit and the pulse counter unit can be reduced, and the cost can be further reduced. According to the pulse generation circuit of the fourth aspect, the operation speed can be further improved in the second and third aspects. According to the pulse generation circuit of the fifth, sixth, seventh, and eighth aspects, the following operation is performed regardless of the time from when the hardware generates an interrupt to when the CPU operating according to the program recognizes the interrupt and enters the interrupt routine. Since the value can be set, it is possible to avoid a problem that a hazard occurs in the pulse waveform or the number of waveforms does not match.

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

【図1】本発明の実施の形態の一例を示すパルス発生回
路の回路構成図である。
FIG. 1 is a circuit configuration diagram of a pulse generation circuit showing an example of an embodiment of the present invention.

【図2】図1のパルス発生回路の要部の回路図である。FIG. 2 is a circuit diagram of a main part of the pulse generation circuit of FIG. 1;

【図3】図1のパルス発生回路のCPUの割り込み処理
動作のフロー図である。
FIG. 3 is a flowchart of an interrupt processing operation of a CPU of the pulse generation circuit of FIG. 1;

【図4】図1のパルス発生回路におけるパルス周波数の
加減速制御曲線の説明図である。
FIG. 4 is an explanatory diagram of an acceleration / deceleration control curve of a pulse frequency in the pulse generation circuit of FIG. 1;

【図5】図4の加減速制御曲線に対応するテーブルデー
タの作成例を示す説明図である。
5 is an explanatory diagram showing an example of creating table data corresponding to the acceleration / deceleration control curve in FIG.

【図6】図1のパルス発生回路のパルスカウンタによる
パルス発生回数のカウント動作を示すタイミングチャー
トである。
FIG. 6 is a timing chart showing a counting operation of the number of times of pulse generation by the pulse counter of the pulse generation circuit of FIG. 1;

【図7】図1のパルス発生回路のパルス発生部及びパル
スカウンタ部の部分回路図である。
FIG. 7 is a partial circuit diagram of a pulse generator and a pulse counter of the pulse generator of FIG. 1;

【図8】図7の回路の動作を示すタイミングチャートで
ある。
FIG. 8 is a timing chart showing the operation of the circuit of FIG. 7;

【図9】ソフトウェアにより設定される設定値と、実際
にハードウエアの動作を決定している設定値との相関を
示す説明図である。
FIG. 9 is an explanatory diagram showing a correlation between a set value set by software and a set value that actually determines the operation of hardware.

【図10】図1のパルス発生回路の回路起動時及び割込
み処理時における処理動作のフロー図である。
FIG. 10 is a flowchart of a processing operation of the pulse generation circuit in FIG. 1 at the time of circuit startup and at the time of interrupt processing.

【図11】パルス出力制御回路の一例を示す回路図であ
る。
FIG. 11 is a circuit diagram illustrating an example of a pulse output control circuit.

【図12】パルス出力制御回路の別の例を示す回路図で
ある。
FIG. 12 is a circuit diagram showing another example of the pulse output control circuit.

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

1 CPU、2 パルス発生部、3 パルスカウンタ
部、4 第1のレジスタ、5 第2のレジスタ、6 ク
ロックカウンタ、7 コンパレータ、8 パルスジェネ
レータ、9 第1のレジスタ、10 第2のレジスタ、
11 パルスカウンタ11、12 コンパレータ、13
割込みコントローラ。
1 CPU, 2 pulse generators, 3 pulse counters, 4 first registers, 5 second registers, 6 clock counters, 7 comparators, 8 pulse generators, 9 first registers, 10 second registers,
11 pulse counters 11, 12 comparators, 13
Interrupt controller.

Claims (8)

【特許請求の範囲】[Claims] 【請求項1】 システム全体を制御するCPUと、源ク
ロック信号のパルス発生回数をカウントし、そのカウン
ト数が設定値に達する毎にパルスを発生するパルス発生
部と、該パルス発生部からのパルス発生回数をカウント
し、そのカウント数が設定値に達する毎に、前記CPU
に対してパルスの周波数を変更するための割り込みを発
生させるパルスカウンタ部とを備えたことを特徴とする
パルス発生回路。
1. A CPU for controlling the entire system, a pulse generator for counting the number of pulse generations of a source clock signal, and generating a pulse each time the count reaches a set value, and a pulse from the pulse generator. The number of occurrences is counted, and each time the counted number reaches a set value, the CPU
And a pulse counter for generating an interrupt for changing the frequency of the pulse.
【請求項2】 前記パルス発生部に保持される前記設定
値が前記CPUによって変更されることを特徴とする請
求項1記載のパルス発生回路。
2. The pulse generation circuit according to claim 1, wherein said set value held in said pulse generation section is changed by said CPU.
【請求項3】 前記パルスカウンタ部に保持される前記
設定値が前記CPUによって変更されることを特徴とす
る請求項1記載のパルス発生回路。
3. The pulse generating circuit according to claim 1, wherein said set value held in said pulse counter section is changed by said CPU.
【請求項4】 前記設定値の変更が前記CPUの割り込
み処理内で行われることを特徴とする請求項2または3
記載のパルス発生回路。
4. The apparatus according to claim 2, wherein the change of the set value is performed in an interrupt process of the CPU.
A pulse generation circuit as described.
【請求項5】 前記パルス発生部は前記設定値を保持し
ておくための第1及び第2の設定保持回路を備えている
ことを特徴とする請求項1記載のパルス発生回路。
5. The pulse generation circuit according to claim 1, wherein the pulse generation unit includes first and second setting holding circuits for holding the set value.
【請求項6】 前記パルスカウンタ部は前記設定値を保
持しておくための第1及び第2の設定保持回路を備えて
いることを特徴とする請求項1記載のパルス発生回路。
6. The pulse generation circuit according to claim 1, wherein said pulse counter section includes first and second setting holding circuits for holding said set value.
【請求項7】 前記第1の設定保持回路に保持された設
定値は前記CPUにより変更可能であり、前記第2の設
定保持回路に保持された設定値は起動時及び前記CPU
への割り込み発生時に前記第1の保持回路から転送され
たものであることを特徴とする請求項5または6記載の
パルス発生回路。
7. The setting value held in the first setting holding circuit can be changed by the CPU, and the setting value held in the second setting holding circuit can be changed at the time of startup and in the CPU.
7. The pulse generating circuit according to claim 5, wherein the signal is transferred from the first holding circuit when an interrupt occurs to the pulse generator.
【請求項8】 前記第2の設定保持回路に保持された設
定値に基づいて動作することを特徴とする請求項7記載
のパルス発生回路。
8. The pulse generating circuit according to claim 7, wherein the pulse generating circuit operates based on the set value held in the second setting holding circuit.
JP1470497A 1997-01-10 1997-01-10 Pulse generation circuit Pending JPH10198410A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1470497A JPH10198410A (en) 1997-01-10 1997-01-10 Pulse generation circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1470497A JPH10198410A (en) 1997-01-10 1997-01-10 Pulse generation circuit

Publications (1)

Publication Number Publication Date
JPH10198410A true JPH10198410A (en) 1998-07-31

Family

ID=11868573

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1470497A Pending JPH10198410A (en) 1997-01-10 1997-01-10 Pulse generation circuit

Country Status (1)

Country Link
JP (1) JPH10198410A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014106594A (en) * 2012-11-26 2014-06-09 Renesas Electronics Corp Microcomputer

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014106594A (en) * 2012-11-26 2014-06-09 Renesas Electronics Corp Microcomputer

Similar Documents

Publication Publication Date Title
JP3088180B2 (en) Serial input interface circuit
JP2661222B2 (en) Pulse output device
JP3312648B2 (en) Pulse signal generating device and pulse signal generating method
KR100508581B1 (en) Method for controlling a bus and apparatus using the same
JPH0844594A (en) Data processor
JPH10198410A (en) Pulse generation circuit
JP3512571B2 (en) Pulse generator
JP2689778B2 (en) Runaway detection device for electronic control unit
JP3449189B2 (en) Programmable controller
JP4040757B2 (en) Control device
JPH07182272A (en) Dma controller circuit
JP2002278918A (en) Dma device
EP0454096B1 (en) Interrupt control circuit and microcomputer system comprising the same
JP2691560B2 (en) Refresh control method for D-RAM
JPH07146814A (en) Memory device
JPH08149889A (en) Slow up-and-down controller for stepping motor
JPS60138661A (en) Processor control system
JPH1091431A (en) Data processor
JPH0721117A (en) Dma controller
JPH06242994A (en) Timing processing system
JPH04369064A (en) Method and device for controlling interruption processing
JP2002328832A (en) Memory controller
JPH04107792A (en) Microcomputer
JPH08147213A (en) Memory device
JPH05120202A (en) Dma control system