JPH0366847B2 - - Google Patents

Info

Publication number
JPH0366847B2
JPH0366847B2 JP13217086A JP13217086A JPH0366847B2 JP H0366847 B2 JPH0366847 B2 JP H0366847B2 JP 13217086 A JP13217086 A JP 13217086A JP 13217086 A JP13217086 A JP 13217086A JP H0366847 B2 JPH0366847 B2 JP H0366847B2
Authority
JP
Japan
Prior art keywords
data
duty
output
output pulse
interrupt
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired
Application number
JP13217086A
Other languages
Japanese (ja)
Other versions
JPS62289012A (en
Inventor
Seiji Yamashita
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Home Electronics Ltd
Original Assignee
NEC Home Electronics 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 NEC Home Electronics Ltd filed Critical NEC Home Electronics Ltd
Priority to JP13217086A priority Critical patent/JPS62289012A/en
Publication of JPS62289012A publication Critical patent/JPS62289012A/en
Publication of JPH0366847B2 publication Critical patent/JPH0366847B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Pulse Circuits (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、出力信号のデユーテイ比を0%〜
100%まで制御できるデユーテイ制御パルス発生
回路に関する。
[Detailed Description of the Invention] [Industrial Application Field] The present invention provides a method for adjusting the duty ratio of an output signal from 0% to
Regarding a duty control pulse generation circuit that can control up to 100%.

〔従来の技術〕[Conventional technology]

出力信号のデユーテイ比(一周期Tに対するオ
ン時間の占める割合、以下デユーテイと省略)を
0%〜100%まで制御するには、大別して2つの
手段がある。1つは、能動素子やCR部品を組み
合わせた電気回路によりハード的に発生させる方
法である。今1つは、CPUと周辺回路とを組み
合わせたソフト的に発生させる方法である。
There are roughly two methods for controlling the duty ratio (ratio of on-time to one period T, hereinafter abbreviated as duty) of the output signal from 0% to 100%. One method is to generate it using hardware using an electric circuit that combines active elements and CR components. The other method is to generate it using software that combines the CPU and peripheral circuits.

〔発明が解決しようする課題〕 従来行なわれて来た電気回路によりハード的に
発生させる方法では、コストに限界があり、低廉
化を図ることが困難である。
[Problems to be Solved by the Invention] The conventional method of generating electricity using hardware using an electric circuit has a cost limit, and it is difficult to reduce the cost.

また、ソフト的に発生させる方法では、デユー
テイ値のセツテイング等に要する時間や、クロツ
ク周波数と出力パルスのデユーテイとの関係など
から、広範囲でデユーテイ制御を行なうことがで
きない欠点がある。
Furthermore, the method of generating pulses using software has the disadvantage that duty control cannot be performed over a wide range due to the time required to set the duty value, the relationship between the clock frequency and the duty of the output pulse, and so on.

〔問題点を解決するための手段〕[Means for solving problems]

本発明は、上記の点に鑑みてなされたもので、
低価格かつ広範囲のデユーテイ制御をソフト的に
行なうことを目的とする。
The present invention has been made in view of the above points, and
The purpose is to perform low-cost and wide-ranging duty control using software.

この目的を達成するために、本発明によるデユ
ーテイ制御パルス発生回路は、クロツク信号をカ
ウントするカウント手段と、カウント手段のカウ
ント値と設定値とを比較し、両者が一致すると出
力を発生する第1および第2の比較手段と、第1
の比較手段の出力によりリセツトされ、第2の比
較手段の出力によりリセツトされるフリツプフロ
ツプ手段と、第1、第2の比較手段の出力により
割り込み処理を行なう中央制御装置とを有し、 中央制御装置は割り込み処理において入力デー
タに基づいて出力パルス信号のデユーテイ比を演
算し、出力パルスのデユーテイが所定値以下の場
合は、出力パルス信号の立ち下がりから次の立ち
上がりまでの時間を定める第1のデータと出力パ
ルス信号の立ち下がりから次の立ち下がりまでの
時間を定める第2のデータとをそれぞれ第1、第
2の比較手段に設定し、第2のデータとカウント
値が一致した時に次の割り込み処理を開始し、 出力パルスのデユーテイ比が所定値以上のとき
には出力パルス信号の立ち上がりから次の立ち下
がりまでの時間を定める第3のデータと出力パル
ス信号の立ち上がりから次の立ち上がりまでの時
間を定める第4のデータとをそれぞれ第1、第2
の比較手段に設定し、第4のデータとカウント値
が一致したときに次の割り込み処理を開始し、 また、出力パルスのデユーテイ比が所定値以下
から、以上、以上から以下と変化するときには、
第1、第3のデータとカウント値とが一致したと
きに次の割り込み処理を開始するように構成した
ものである。
In order to achieve this object, the duty control pulse generation circuit according to the present invention includes a counting means for counting clock signals, and a first pulse generating circuit that compares the count value of the counting means with a set value, and generates an output when the two match. and a second comparison means, and a first
flip-flop means that is reset by the output of the second comparing means; and a central controller that performs interrupt processing according to the outputs of the first and second comparing means; calculates the duty ratio of the output pulse signal based on the input data in interrupt processing, and if the duty of the output pulse is less than a predetermined value, the first data determines the time from the falling edge of the output pulse signal to the next rising edge. and second data that determines the time from one fall of the output pulse signal to the next fall are set in the first and second comparison means, respectively, and when the second data and the count value match, the next interrupt is generated. Processing is started, and when the duty ratio of the output pulse is equal to or greater than a predetermined value, the third data that determines the time from the rise of the output pulse signal to the next fall and the time from the rise of the output pulse signal to the next rise are determined. the fourth data and the first and second data, respectively.
When the fourth data and the count value match, the next interrupt processing is started, and when the duty ratio of the output pulse changes from below to above a predetermined value, and from above to below,
The configuration is such that the next interrupt process is started when the first and third data match the count value.

〔作用〕[Effect]

この構成において、デユーテイ検出手段の出力
により第1の設定手段または第2の設定手段のい
ずれかを選択して作動させることにより、デユー
テイが所定値を境にして大小いずれかに変化した
ときに、第1の設定手段または第2の設定手段を
切換えて、連続してデユーテイ比の変化するパル
ス信号を出力することができる。
In this configuration, by selecting and operating either the first setting means or the second setting means based on the output of the duty detection means, when the duty changes from a predetermined value to either a large or small value, By switching the first setting means or the second setting means, it is possible to output a pulse signal whose duty ratio changes continuously.

〔実施例〕〔Example〕

以下、本発明を第1〜第5図に基づいて説明す
る。
Hereinafter, the present invention will be explained based on FIGS. 1 to 5.

第1図は、本発明によるデユーテイ制御パルス
発生回路の一実施例を示すブロツク図である。
FIG. 1 is a block diagram showing one embodiment of a duty control pulse generation circuit according to the present invention.

第1図において、3は例えば温度の変化などを
検出するセンサである。1はセンサ3から測定値
を入力し、この測定値に基づいて後述するコンパ
レータへプリセツト値を出力する中央制御装置
(CPU)である。カウンタ4はゼロからインクリ
メントするアツプカウンターであり、フリーラン
ニングの状態で使用される。カウンタ4のカウン
ト値は、コンパレータ5及び6に供給される。コ
ンパレータ5および6は、CPU1によつて設定
されたブリセツト値とカウンタ4から供給される
カウント値の比較を行ない、両者の値が一致した
時ににLレベルからHレベルとなる出力をCPU
1の割り込み端子INT1,INT2に供給する。
In FIG. 1, 3 is a sensor that detects, for example, changes in temperature. 1 is a central control unit (CPU) that inputs a measured value from the sensor 3 and outputs a preset value to a comparator to be described later based on this measured value. Counter 4 is an up counter that increments from zero and is used in a free running state. The count value of counter 4 is supplied to comparators 5 and 6. Comparators 5 and 6 compare the preset value set by the CPU 1 and the count value supplied from the counter 4, and when the two values match, the CPU outputs an output that changes from L level to H level.
1 interrupt pins INT1 and INT2.

コンパレータ5および6の出力はフリツプフロ
ツプ8にも供給される。フリツプフロツプ8は
RS型のフリツプフロツプであり、コンパレータ
6の出力の立ち上がりによつてセツトされ、コン
パレータ5の出力の立ち上がりによりリセツトさ
れる。このフリツプフロツプ8のQ出力が、第1
図に示す回路の出力として出力端子9より外部に
取り出される。この出力端子9から取り出された
出力は第2図に示すようにドライバ10に入力さ
れ、ドライバ10はこれに基づいてアクチユエー
タ11を駆動する。
The outputs of comparators 5 and 6 are also supplied to flip-flop 8. Flipflop 8 is
It is an RS type flip-flop, and is set when the output of comparator 6 rises, and reset when the output of comparator 5 rises. The Q output of this flip-flop 8 is the first
It is taken out from the output terminal 9 as the output of the circuit shown in the figure. The output taken out from the output terminal 9 is input to the driver 10 as shown in FIG. 2, and the driver 10 drives the actuator 11 based on this output.

次に本実施例の基本的動作を第3図のフローチ
ヤートを用いて説明する。
Next, the basic operation of this embodiment will be explained using the flowchart shown in FIG.

尚、第3図に示したプログラムは、センサ3の
測定値に応じてデユーテイを変えたパルスをアク
チユエータ11に供給する場合の、デユーテイ制
御パルス発生回路として用いらた場合を示してい
る。
The program shown in FIG. 3 is used as a duty control pulse generation circuit for supplying pulses whose duty is changed according to the measured value of the sensor 3 to the actuator 11.

本実施例によるデユーテイ制御パルス発生回路
10のCPU1は通常は他のプログラム(メイン
プログラム)を実行しているが、コンパレータ
5,6からINT1,INT2に割に込み信号が供
給されると、メインプログラムを中断して、第3
図に示す割り込みプログラムを開始する。
The CPU 1 of the duty control pulse generation circuit 10 according to this embodiment normally executes another program (main program), but when an interrupt signal is supplied to INT1 and INT2 from the comparators 5 and 6, the main program Interrupt the third
Start the interrupt program shown in the figure.

コンパレータ5,6にはそれぞれCPU1から
センサ3の測定値に基づく設定値が設定される。
この設定値によつてこれから出力されるパルスの
デユーテイが決定されるのである。
Setting values based on the measured values of the sensor 3 are set in the comparators 5 and 6 by the CPU 1, respectively.
This set value determines the duty of the pulse that will be output from now on.

そして、割りこみ処理がスタートすると、
CPU1はステツプS101でまずコンパレータ
5および6の内、設定されている設定値の時間的
長さが長い方のコンパレータによる割り込み(以
下、割り込み2)をマスクする。このマスク処理
を具体的に説明すると、CPU1ではコンパレー
タ5,6に与えた設定値を記憶しており、ステツ
プS101になると、CPU1の処理プログラム
において、設定値の時間が長い方のコンパレータ
に接続されたINT端子(INT1または、INT2)
の入力の検出処理を停止することである。
Then, when interrupt processing starts,
In step S101, the CPU 1 first masks an interrupt (hereinafter referred to as interrupt 2) caused by the comparator of comparators 5 and 6 whose set value has a longer time length. To explain this mask processing specifically, the CPU 1 stores the set values given to the comparators 5 and 6, and at step S101, the CPU 1's processing program connects the comparator with the longer set value. INT terminal (INT1 or INT2)
This is to stop the input detection process.

次いで、ステツプS102で、コンパレータ5
および6のうち、設定されている設定値の時間的
長さが短い方のコンパレータによる割り込み(以
下、割り込み1)が解除されているか否かを判別
する。ここで割り込みを解除するということを具
体的に説明すると、CPU1の処理プログラムに
おいて、解除したい割り込み信号を送つてくるコ
ンパレータに接がつているINT端子(INT1ま
たはINT2の入力の検出処理を再開することで
ある。
Next, in step S102, the comparator 5
and 6, it is determined whether the interrupt by the comparator whose set value is shorter in time (hereinafter referred to as interrupt 1) has been canceled. To explain concretely what it means to cancel an interrupt here, in the processing program of CPU1, restart the detection process of the input of the INT pin (INT1 or INT2) connected to the comparator that sends the interrupt signal you want to cancel. It is.

次に、CPU1は割り込み1が解除されていた
場合には、解除されていたことの目印としてステ
ツプS103においてフラグを反転するととも
に、新めて割り込み1もマスクする。その後、
CPU1はステツプS104においてセンサ3か
らの設定値によりフリツプフロツプ8から出力す
るパルスのデユーテイを決定する。割り込み1が
すでにマスクされていた場合には直ちにデユーテ
イが決定される。困みに、本実施例におけるデユ
ーテイとは、第5図に示すように、一周期Tに対
するON時間の長さの割合、すなわちオンデユー
テイのことである。
Next, if interrupt 1 has been canceled, the CPU 1 inverts the flag in step S103 as a mark that it has been canceled, and also masks interrupt 1 anew. after that,
In step S104, the CPU 1 determines the duty of the pulse output from the flip-flop 8 based on the set value from the sensor 3. If interrupt 1 is already masked, the duty is determined immediately. Unfortunately, the duty in this embodiment is the ratio of the ON time to one cycle T, ie, the on-duty, as shown in FIG.

次にステツプS105において、フラグが1で
あるか否かが判別される。困みに、フラグの初期
値は“0”に設定されている。
Next, in step S105, it is determined whether the flag is 1 or not. Unfortunately, the initial value of the flag is set to "0".

S105において、フラグが“0”であつた場
合には、ステツプS106に示すように、CPU
1において、S104において求めたデユーテイ
比に基づいてデータAとデータBの2つのデータ
を演算し、データAをコンパレータ6にセツト
し、データBをコンパレータ5にセツトする。ま
た、フラグが“1”であつた場合には、ステツプ
S107に示すようにCPU1において、S10
4において求めたデユーテイ比に基づいてデータ
CとデータDの2つのデータを演算し、データC
をコンパレータ5にセツトし、データDをコンパ
レータ6にセツトする。
In S105, if the flag is "0", as shown in step S106, the CPU
In step 1, two data, data A and data B, are calculated based on the duty ratio determined in S104, data A is set in the comparator 6, and data B is set in the comparator 5. Further, if the flag is "1", the CPU 1 executes S10 as shown in step S107.
Two data, data C and data D, are calculated based on the duty ratio obtained in step 4, and data C
is set in comparator 5, and data D is set in comparator 6.

ここでデータAは第4図に示すように、出力パ
ルス信号の立ち下がりから次の立ち上がりまでの
時間すなわち周期T中の“L”期間の長さを定め
るデータであり、データBは出力パルス信号の立
ち下がりから次の立ち下がりまでの時間すなわち
出力パルスの周期Tを定めるデータである。
Here, data A is data that determines the time from the falling edge of the output pulse signal to the next rising edge, that is, the length of the "L" period in the period T, as shown in FIG. This is data that determines the time from one falling edge to the next falling edge, that is, the period T of the output pulse.

また、データCは出力パルス信号の立ち上がり
から次の立ち下がりまでの時間すなわち周期T中
の“H”期間の長さを定めるデータであり、デー
タDは出力パルス信号の立ち上がりから次の立ち
上がりまでの時間を定めるデータである。
Furthermore, data C is data that determines the time from the rising edge of the output pulse signal to the next falling edge, that is, the length of the "H" period in the period T, and data D is the data that determines the length of the "H" period in the period T. This is data that determines time.

データA,B,C,Dの各値は第5図からも分
かるように、次式により求められる。
As can be seen from FIG. 5, each value of data A, B, C, and D is determined by the following equation.

An=Tn−(Tn×dn) (1) Bn=Hn (2) Cn=Tn×do-1 (3) Dn=Cn+Tn−(Tn×do+1) (4) 以上の式からも分かるように、データCとDの
比は該当する周期でのオンデユーテイを表すもの
ではない。
An=Tn−(Tn×dn) (1) Bn=Hn (2) Cn=Tn×d o-1 (3) Dn=Cn+Tn−(Tn×d o+1 ) (4) It can be seen from the above equations As such, the ratio of data C and D does not represent the on-duty in the corresponding period.

ステツプS105において、フラグが“0”で
あつた場合には、更にステツプS108におい
て、ステツプS104でのデータからデユーテイ
が50%以上になるか否かが判別され、50%より大
きい場合には、ステツプS111において、割り
込み1を解除してメインプログラムに戻る。また
50%以下の場合には、ステツプS110において
割り込み2を解除してメインプログラムに戻る。
If the flag is "0" in step S105, it is further determined in step S108 whether the duty is 50% or more based on the data in step S104, and if it is greater than 50%, step In S111, interrupt 1 is canceled and the process returns to the main program. Also
If it is less than 50%, interrupt 2 is canceled in step S110 and the process returns to the main program.

ステツプS105において、フラグが“1”で
あつた場合には、更にステツプS109におい
て、ステツプS104でのデータからデユーテイ
が50%以上になるか否かが判別され、50%より大
きい場合にはステツプS110において割り込み
2を解除してメインプログラムに戻る。また、50
%以下の場合にはステツプS111において、割
り込み1を解除してメインプログラムに戻る。
If the flag is "1" in step S105, it is further determined in step S109 whether the duty is 50% or more based on the data in step S104, and if it is greater than 50%, step S110 is performed. At this point, interrupt 2 is canceled and the process returns to the main program. Also, 50
% or less, in step S111, interrupt 1 is canceled and the process returns to the main program.

次に、第4図に示すようにデユーテイが変化す
るパルス信号を出力する場合の動作について説明
する。
Next, the operation when outputting a pulse signal whose duty changes as shown in FIG. 4 will be explained.

初期状態においては、フラグは“0”に設定さ
れ、割り込み1,2はともにマスクされている。
このために、周期T2においては、ステツプS1
02からステツプS104に移り、センサ3から
の信号を基にデユーテイd1が決定される。フラグ
は“0”であるので、ステツプS105からステ
ツプS106に移り、デユーテイd1を基に前述の
(1),(2)式を用いてA1,B1の値が求められ、コン
パレータ5,6にセツトさる。ステツプS108
においてはデユーテイd1は50%以下であるため、
割り込み2が解除される。このために、CPU1
はコンパレータ5,6に接続されたINT端子
(INT1,INT2)の内、データB1がセツトされ
た方のINT端子を受信可能にする。ここまでの
処理は、第4図のt2の期間に行なわれ、データB1
の値とカウンタ4の値が一致したときにコンパレ
ータから次の割り込み信号が入力され、周期T3
が始まる。
In the initial state, the flag is set to "0" and both interrupts 1 and 2 are masked.
For this reason, in period T2, step S1
02, the process moves to step S104, and the duty d1 is determined based on the signal from the sensor 3. Since the flag is "0", the process moves from step S105 to step S106, and the above-mentioned process is performed based on the duty d1 .
The values of A 1 and B 1 are determined using equations (1) and (2) and set in comparators 5 and 6. Step S108
Since duty d 1 is less than 50% in
Interrupt 2 is canceled. For this purpose, CPU1
Of the INT terminals (INT1, INT2) connected to comparators 5 and 6, the INT terminal to which data B1 is set is enabled to receive. The processing up to this point is performed during the period t 2 in Figure 4, and the data B 1
When the value of counter 4 matches the value of counter 4, the next interrupt signal is input from the comparator, and the period T 3
begins.

次に、周期T3では、まだ割り込み1は解除さ
れていないので、処理はステツプS102からス
テツプS104へ移り、ステツプS104でセン
サ3からの信号に基づいて周期T3におけるデユ
ーテイd3を決定する。未だ、フラグは“0”なの
で、ステツプS105からステツプS106に移
り、デユーテイd3に基づいて、データA3,B3
求める。次のステツプS108でデユーテイd3
50%以上か否かを判別するが、周期T3における
デユーテイは50%以上であるので、処理はステツ
プS111へ移り、今度は割り込み1を解除す
る。ここまでの処理は期間t3で行なわれる。割り
込み1が解除されたので、CPU1は、コンパレ
ータ5,6の内、期間の短いデータA3をセツト
されている方に接続されているINT端子を受信
可能とし、データA3の値とカウンタ4の値が一
致したときに、周期T3はまだ終了しないが、次
の割り込みをINT端子に受ける。
Next, in cycle T3 , since interrupt 1 has not been canceled yet, the process moves from step S102 to step S104, and in step S104, duty d3 in cycle T3 is determined based on the signal from sensor 3 . Since the flag is still "0", the process moves from step S105 to step S106, and data A 3 and B 3 are obtained based on duty d 3 . In the next step S108, the duty d3 is
It is determined whether the duty is 50% or more, but since the duty in cycle T3 is 50% or more, the process moves to step S111, and interrupt 1 is canceled this time. The processing up to this point is performed during period t3 . Since interrupt 1 has been canceled, CPU 1 can receive the INT terminal connected to the one of comparators 5 and 6 to which data A 3 with a shorter period is set, and transfers the value of data A 3 and counter 4. When the values match, period T3 has not yet ended, but the next interrupt is received at the INT pin.

今度は、前回の処理において、割り込み1が解
除されているので、ステツプS103でフラグが
反転されて“1”とされる。次にステツプS10
4で周期T4のデユーテイd4が決定される。フラ
グが“1”になつたため、ステツプS105から
ステツプS107へ移り、デユーテイd4に基づい
てデータC4,D4が(3),(4)式より求められ、各々
コンパレータ5,6にセツトされる。次に、ステ
ツプS109に移り、デユーテイが50%以上か否
かが判別されるがデユーテイd4は50%以上である
ため、ステツプS110へと移り、割り込み2を
解除する。ここまでの処理は期間t4で行なわれ
る。
This time, since interrupt 1 was canceled in the previous process, the flag is inverted and set to "1" in step S103. Next step S10
4, the duty d 4 of period T 4 is determined. Since the flag has become "1", the process moves from step S105 to step S107, where data C 4 and D 4 are obtained from equations ( 3 ) and (4) based on duty d 4 and set in comparators 5 and 6, respectively. Ru. Next, the process moves to step S109, and it is determined whether the duty is 50% or more. Since the duty d4 is 50% or more, the process moves to step S110, and interrupt 2 is canceled. The processing up to this point is performed in period t4 .

期間t4では、割り込み2が解除されているの
で、CPU1はコンパレータ5,6の内、期間の
長いデータD4をセツトされた方に接続された
INT端子を受信可能とし、データD4の値とカウ
ンタ4の値が一致したときに、次の割り込み動作
を受ける。
In period t4 , interrupt 2 is released, so CPU1 is connected to the comparator 5 and 6 that is set to data D4 with a longer period.
The INT terminal is enabled for reception, and when the value of data D4 and the value of counter 4 match, the next interrupt operation is received.

次に、周期T5,T6においてはデユーテイd5
d6がいずれも50%以上であるので、周期T4と同
様の制御を繰り返す。
Next, in periods T 5 and T 6 , the duty d 5 ,
Since d 6 is all 50% or more, the same control as in period T 4 is repeated.

次に、周期T6の終わりに、次の割り込みが入
り周期T6において、期間t7が始まる。期間t7の最
初に割り込み動作がスタートすると、割り込み1
がマスクされているので、ステツプS102から
ステツプS104へ移り、センサからの信号を基
に次の周期T7のデユーテイd7が決定される。フ
ラグ期間t4で“1”とされ、そのままになつてい
るのでステツプS107へ移り、デユーテイd7
基にデータC7,D7が算出されるが、デユーテイ
d7は50%以下であるので、ステツプS109から
ステツプS111に移り、割り込み1が解除され
る。
Then, at the end of period T6 , the next interrupt enters and period t7 begins in period T6. When interrupt operation starts at the beginning of period t7 , interrupt 1
is masked, the process moves from step S102 to step S104, and the duty d7 of the next cycle T7 is determined based on the signal from the sensor. Since the flag is set to "1" during the flag period t4 and remains unchanged, the process moves to step S107, where data C7 and D7 are calculated based on the duty d7.
Since d7 is less than 50%, the process moves from step S109 to step S111, and interrupt 1 is canceled.

割り込み1が解除されたので、CPU1はカウ
ンタ5,6の内、期間の短いデータC7がセツト
された方に接続されたINT端子を受信可能とし、
データC7の値とカウンタ4の値が一致すると、
次の割り込み処理すなわち期間t8を始める。
Since interrupt 1 has been canceled, CPU 1 can receive the INT terminal connected to the one of counters 5 and 6 to which the short-term data C7 has been set.
When the value of data C 7 and the value of counter 4 match,
Next interrupt processing, period t8 , begins.

期間t8では、期間t7において、割り込み1が解
除されたためステツプS102からステツプS1
03に移り、フラグを“1”から“0”に反転す
る。ステツプS104で次周期T8のデユーテイ
d8を決定し、ステツプS105に進がフラグが
“0”になつているので、ステツプS106に移
り、データA8,B8をデユーテイd8から(1),(2)式
を用いて求め、コンパレータ5,6にセツトす
る。デユーテイd8は50以下であるため、ステツプ
S110に移り割り込み2が解除される。割り込
み2が解除されたため、CPU1はコンパレータ
5,6の内、期間の長いデータB8がセツトされ
たコンパレータに接続されたINT端子を受信可
能とし、データB8の値とカウンタ4の値が一致
したときに次の割り込みが行なわれる。
In period t8 , since interrupt 1 was canceled in period t7 , steps S102 to S1
03, the flag is inverted from "1" to "0". In step S104, the duty of the next cycle T8 is set.
d 8 is determined, and since the advance flag has become "0" in step S105, the process moves to step S106, where data A 8 and B 8 are calculated from the duty d 8 using equations (1) and (2). , comparators 5 and 6 are set. Since the duty d8 is less than 50, the process moves to step S110 and interrupt 2 is canceled. Since interrupt 2 has been released, CPU 1 can receive the INT terminal connected to the comparator of comparators 5 and 6, which is set to data B 8 with a long period, and the value of data B 8 matches the value of counter 4. The next interrupt occurs when

以下、同様にして第3図に示す動作が、反復し
て行なわれ、フリツプフロツプ回路8のQ端子か
らパルスPが連続して得られる。
Thereafter, the operation shown in FIG. 3 is repeated in the same manner, and pulses P are continuously obtained from the Q terminal of the flip-flop circuit 8.

以上のように本実施例によれば、オンデユーテ
イが50%以下の状態が連続する場合には、オフ期
間に波形作成処理を行なうので、処理時間を十分
にとることが出来る。また、オンデユーテイが50
%以上の状態が連続する場合には、オン期間に波
形作成処理を行なうので、処理時間を十分にとる
ことが出来る。さらに、オンデユーテイが50%以
下から以上に、50%以上から以下に移行する場合
には、次期間のデユーテイ変化が検出できた時点
ですぐに、波形作成処理を行なうので、連続して
パルス信号のデユーテイを可変することが出来
る。
As described above, according to this embodiment, when the on-duty is continuously 50% or less, waveform creation processing is performed during the off period, so that sufficient processing time can be taken. Also, on duty is 50
% or more continues, waveform creation processing is performed during the on period, so sufficient processing time can be taken. Furthermore, when the on-duty changes from less than 50% to more than 50%, or from more than 50% to less, waveform creation processing is performed as soon as the next period's duty change is detected, so the pulse signal is continuously Duty can be varied.

以上本発明を実施例により説明したが次のよう
な変形も可能である。
Although the present invention has been described above with reference to embodiments, the following modifications are also possible.

例えば、上記実施例では、カウンタ、コンパレ
ータ、フリツプフロツプ等は、ハードウエアとし
て説明したが、これらもソフトウエアで構成する
こともできる。
For example, in the above embodiments, the counters, comparators, flip-flops, etc. have been explained as hardware, but they may also be configured as software.

また、デユーテイをセンサの出力により定める
ものとして説明したが、例えばシグナルジエネレ
ーターに本発明を用いた場合には、センサではな
く操作ダイアルによりデユーテイを設定するよう
にできる。
Furthermore, although the duty has been described as being determined by the output of a sensor, for example, when the present invention is used in a signal generator, the duty can be set by an operation dial instead of a sensor.

更に、デユーテイの設定境界値を50%とした
が、50%以下の20%や80%とすることもできる。
Furthermore, although the duty setting boundary value is set to 50%, it can also be set to 20% or 80%, which is less than 50%.

〔発明の効果〕〔Effect of the invention〕

以上のように、本発明によれば、簡易や構成、
動作で、連続してデユーテイ比の変化するパルス
信号を出力することができる。
As described above, according to the present invention, the simplicity and configuration,
In operation, a pulse signal with a continuously changing duty ratio can be output.

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

第1図は本発明によるデユーテイ制御パルス発
生回路の一実施例を示すブロツク図、第2図は第
1図に示す回路の使用例を示す結線図、第3図は
第1図に示すCPUの動作を説明するフローチヤ
ート、第4図、第5図は第1図に示す回路の動作
を説明する波形図である。 1…CPU、4…カウンタ、5,6…コンパレ
ータ、8…フリツプフロツプ。
FIG. 1 is a block diagram showing an embodiment of the duty control pulse generation circuit according to the present invention, FIG. 2 is a wiring diagram showing an example of the use of the circuit shown in FIG. 1, and FIG. 3 is a block diagram showing an example of the use of the circuit shown in FIG. Flowcharts illustrating the operation, FIGS. 4 and 5 are waveform diagrams illustrating the operation of the circuit shown in FIG. 1. 1...CPU, 4...Counter, 5, 6...Comparator, 8...Flip-flop.

Claims (1)

【特許請求の範囲】 1 入力データの変化に対応して、出力パルス信
号のデユーテイ比を変化させて出力するデユーテ
イ制御パルス発生回路において、 クロツク信号をカウントするカウント手段と、 該カウント手段のカウント値と設定値とを比較
し、両者が一致すると出力を発生する第1及び第
2の比較手段と、 該第1の比較手段の出力によりリセツトされ、
該第2の比較手段の出力によるセツトされるフリ
ツプフロツプ手段と、 前記第1、第2の比較手段の出力により割り込
み処理を行なう中央制御装置とを有し、 前記中央制御装置は、前記割り込み処理におい
て前記入力データに基づいて前記出力パルス信号
のデユーテイ比を演算し、出力パルスのデユーテ
イ比が所定値以下の場合は、出力パルス信号の立
ち下がりから次の立ち上がりまでの時間を定める
第1のデータと出力パルス信号の立ち下がりから
次の立ち下がりまでの時間を定める第2のデータ
とをそれぞれ前記第1、第2の比較手段に設定
し、前記第2のデータと前記カウント値が一致し
たときに次の割り込み処理を開始し、 前記出力パルスのデユーテイ比が所定値以上の
ときには出力パルス信号の立ち上がりから次の立
ち下がりまでの時間を定める第3のデータと出力
パルス信号の立ち上がりから次の立ち上がりまで
の時間を定める第4のデータとをそれぞれ前記第
1、第2の比較手段に設定し、前記第4のデータ
と前記カウント値が一致したときに次の割り込み
処理を開始し、 また、出力パルスのデユーテイ比が所定値以下
から以上、以上から以下へと変化する時には、前
記第1、第3のデータと前記カウント値とが一致
したときに次の割り込み処理を開始することを特
徴とするデユーテイ制御パルス発生回路。
[Claims] 1. A duty control pulse generation circuit that changes the duty ratio of an output pulse signal in response to a change in input data and outputs the same, comprising: a count means for counting a clock signal; and a count value of the count means. and a set value, and when the two match, the first and second comparison means generate an output, and are reset by the output of the first comparison means,
a flip-flop means that is set by the output of the second comparison means; and a central control unit that performs interrupt processing according to the outputs of the first and second comparison means, and the central control unit performs interrupt processing in the interrupt processing. The duty ratio of the output pulse signal is calculated based on the input data, and if the duty ratio of the output pulse is less than or equal to a predetermined value, first data is used that determines the time from the falling edge of the output pulse signal to the next rising edge. Second data that determines the time from one fall of the output pulse signal to the next fall is set in the first and second comparing means, respectively, and when the second data and the count value match, The next interrupt processing is started, and when the duty ratio of the output pulse is greater than or equal to a predetermined value, third data that determines the time from the rise of the output pulse signal to the next fall, and from the rise of the output pulse signal to the next rise. and fourth data that determines the time of the count value are set in the first and second comparison means, respectively, and when the fourth data and the count value match, the next interrupt processing is started, and the output pulse When the duty ratio changes from below a predetermined value to above a predetermined value and from above to below a predetermined value, the next interrupt processing is started when the first and third data and the count value match. Control pulse generation circuit.
JP13217086A 1986-06-07 1986-06-07 Duty control pulse generating circuit Granted JPS62289012A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13217086A JPS62289012A (en) 1986-06-07 1986-06-07 Duty control pulse generating circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13217086A JPS62289012A (en) 1986-06-07 1986-06-07 Duty control pulse generating circuit

Publications (2)

Publication Number Publication Date
JPS62289012A JPS62289012A (en) 1987-12-15
JPH0366847B2 true JPH0366847B2 (en) 1991-10-18

Family

ID=15075003

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13217086A Granted JPS62289012A (en) 1986-06-07 1986-06-07 Duty control pulse generating circuit

Country Status (1)

Country Link
JP (1) JPS62289012A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999057811A1 (en) * 1998-05-05 1999-11-11 Akira Yokomizo Digital waveform shaping circuit, frequency multiplying circuit, external-synchronizing circuit, and external-synchronizing method

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0482412A (en) * 1990-07-25 1992-03-16 Matsushita Electric Works Ltd Pulse generator
GB2271232B (en) * 1992-10-03 1997-05-07 Motorola Inc Pulse generation/sensing arrangement for use in a microprocessor system
JP3612417B2 (en) 1997-12-17 2005-01-19 日本電気株式会社 Clock signal control circuit

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999057811A1 (en) * 1998-05-05 1999-11-11 Akira Yokomizo Digital waveform shaping circuit, frequency multiplying circuit, external-synchronizing circuit, and external-synchronizing method

Also Published As

Publication number Publication date
JPS62289012A (en) 1987-12-15

Similar Documents

Publication Publication Date Title
US6084441A (en) Apparatus for and method of processing data
JPH0366847B2 (en)
JP2000174615A (en) Method and device for automatically correcting internal clock frequency of integrated circuit
US6442704B1 (en) Ring oscillator clock frequency measuring method, ring oscillator clock frequency measuring circuit, and microcomputer
US6326825B1 (en) Accurate time delay system and method utilizing an inaccurate oscillator
JPH08139575A (en) Pulse output circuit
JP3112862B2 (en) Information processing device
JP2906254B2 (en) Programmable controller
JPS60182354A (en) Measuring device for injector driving pulse width
JPH06232699A (en) Pulse generator
JPH10255489A (en) Microcomputer
JP2631541B2 (en) Programmable controller
JP3611788B2 (en) Microcomputer timer calibration system
JPH03128677A (en) Pulse-width modulation inverter controller
JPH04262614A (en) Electronic device used to output periodic signal
JP3144811B2 (en) Monitoring timer circuit
KR950013602B1 (en) Frequency measuring device
JPH10253778A (en) Time exchanging clock system
JP2794441B2 (en) PWM controller
JPH01263740A (en) Micro-computer
JP2540544Y2 (en) Counter circuit
JPH02192315A (en) Pulse generator
JPH11214970A (en) Pwm signal gneneration circuit
JPH0973404A (en) Watchdog timer circuit
JPH04321116A (en) Interruption method for cpu system of low power consumption