JPH0221302A - Output method for pulse width modulation signal - Google Patents

Output method for pulse width modulation signal

Info

Publication number
JPH0221302A
JPH0221302A JP17209888A JP17209888A JPH0221302A JP H0221302 A JPH0221302 A JP H0221302A JP 17209888 A JP17209888 A JP 17209888A JP 17209888 A JP17209888 A JP 17209888A JP H0221302 A JPH0221302 A JP H0221302A
Authority
JP
Japan
Prior art keywords
output
pulse width
time
width modulation
internal timer
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
JP17209888A
Other languages
Japanese (ja)
Inventor
Hidetoshi Yasu
安 秀俊
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP17209888A priority Critical patent/JPH0221302A/en
Publication of JPH0221302A publication Critical patent/JPH0221302A/en
Pending legal-status Critical Current

Links

Landscapes

  • Feedback Control In General (AREA)

Abstract

PURPOSE:To realize the highly accurate modulation of the pulse width together with reduction of the cost by using only an internal timer to output a pulse width modulation signal and using no external timer. CONSTITUTION:When a CPU 1 sets a prescribed time at an internal timer 3, the timer 3 applies the interruptions to the CPU 1 in said fixed time cycle. The CPU 1 outputs a signal to an output part 6 to turn on the output of the part 6 concurrently with reception of an interruption based on a duty ratio command given from an input device 2. At the same time, the CPU 1 sets the time point at a comparison OUT register 4 to turn off the output of the register 4. A comparison part 5 compares the lapse time of the timer 3 with the OFF time of the register 4. If the coincidence is obtained between both times, a signal is outputted to the part 6 to turn off the output of the part 6. Thus the part 6 outputs a pulse width modulation output signal in response to the duty ratio command received from the device 2.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は内部タイマとコンベアアウト機能を有するマイ
クロコンピュータを使用した制御装置のパルス幅変調信
号出力方法に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a pulse width modulation signal output method for a control device using a microcomputer having an internal timer and a conveyor-out function.

〔従来技術〕[Prior art]

従来、マイクロコンビエータを具備する制御装置におけ
るパルス幅変調信号出力方法には、外部に専用のカウン
タを設けて行なう方法又は内部タイマで行なう方法があ
った。
Conventionally, as a method for outputting a pulse width modulated signal in a control device equipped with a micro combinator, there has been a method using an external dedicated counter or a method using an internal timer.

外部に専用のカウンタを設けて行なう方法は、例えば第
4図に示すように、CPU41の外部に専用の外部カウ
ンタ42を設け、入力装置43からのパルス幅変調要因
信号によりCPU41は外部カウンタ42に所定のデユ
ーティ比の出力信号が得られるようにパルス幅をセット
し、CPU41からの指令により出力をONし、セット
したパルス幅の時間経過後に該出力をOFFする。これ
により入力装置43からの入力信号に応じたパルス幅変
調信号を出力する。
For example, as shown in FIG. 4, a method of providing a dedicated external counter is to provide a dedicated external counter 42 external to the CPU 41, and the CPU 41 controls the external counter 42 by a pulse width modulation factor signal from an input device 43. The pulse width is set so that an output signal with a predetermined duty ratio is obtained, the output is turned on according to a command from the CPU 41, and the output is turned off after the set pulse width has elapsed. As a result, a pulse width modulation signal corresponding to the input signal from the input device 43 is output.

また、内部タイマで行なう方法は、例えば第5図に示す
ように入力装置(図示せず)からのパルス幅変調の要因
信号により、出力をON及びOFFする時間を算出し、
このON及びOFFの算出時間を使って内部タイマを動
作させることにより、入力装置の信号に応じたパルス幅
変調信号を出力する。
Furthermore, as shown in FIG. 5, for example, a method using an internal timer calculates the time for turning the output ON and OFF based on a pulse width modulation factor signal from an input device (not shown).
By operating an internal timer using this ON and OFF calculation time, a pulse width modulation signal corresponding to the signal from the input device is output.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

しかしながら上記従来のパルス幅変調信号出力方法にお
いて、外部カウンタを使用する場合は、外部カウンタを
用いる分コストが高くなるという問題があり、内部タイ
マを使用する場合でもデユーティの周期が短い場合、計
算の頻度が増し、精度が悪くなるという問題があって技
術的に満足できる方法ではなかった。
However, in the conventional pulse width modulation signal output method described above, when using an external counter, there is a problem that the cost increases due to the use of the external counter, and even when using an internal timer, if the duty cycle is short, the calculation This was not a technically satisfactory method because of the problems of increased frequency and decreased accuracy.

本発明は上述の点に鑑みてなされたもので、従来のパル
ス幅変調信号出力方法の欠点であるコスト高又は精度が
悪いという点を除去し、内部タイマを使用し且つ精度の
良いデユーティ出力が得られるパルス幅変調信号出力方
法を提供することにある。
The present invention has been made in view of the above points, and eliminates the drawbacks of the conventional pulse width modulation signal output method, such as high cost and poor accuracy, and uses an internal timer and provides a highly accurate duty output. An object of the present invention is to provide a method for outputting a pulse width modulated signal.

〔課題を解決するための手段〕[Means to solve the problem]

上記課題を解決するため本発明は、コンベアアウト出力
の機能を持ったマイクロコンピュータを使用した制御装
置において、マイクロコンビ1−タの内部タイマにより
一定周期で割込みを発生させ、その時出力をONするプ
ログラムとコンベアアウトレジスタにOFFの時間をス
トアするプログラムを設けて、パルス幅変調信号出力方
法を構成した。
In order to solve the above-mentioned problems, the present invention provides a control device using a microcomputer with a conveyor-out output function, in which an internal timer of the microcomputer generates an interrupt at a constant cycle, and a program that turns on the output at that time. A pulse width modulation signal output method was constructed by providing a program that stores the OFF time in the conveyor out register.

〔作用〕[Effect]

パルス幅変調信号出力方法を上記の゛如く構成すること
により、内部タイマにより一定周期で割込みを発生させ
その時出力をONするプログラムにより出力をONする
と共に、コンベアアウトレジスタにOFFの時間をスト
アするプログラムによりOFFの時間をセットし、内部
タイマの時間が該OFF時間になったら出力をOFFす
るから、一定周期でONL、所定の時間経過するとOF
Fする、所謂所定のデユーティ比のパルス幅変調信号が
精度良く出力できる。
By configuring the pulse width modulation signal output method as described above, a program that generates an interrupt at a fixed period using an internal timer, turns on the output at that time, and stores the OFF time in the conveyor out register. The OFF time is set by , and the output is turned OFF when the internal timer reaches the OFF time, so it is ON at a certain period and OFF after a predetermined period of time.
A pulse width modulated signal having a so-called predetermined duty ratio can be outputted with high precision.

〔実施例〕〔Example〕

以下、本発明の一実施例を図面に基づいて説明する。 Hereinafter, one embodiment of the present invention will be described based on the drawings.

第1図は本発明のパルス幅変調信号出力方法を適用する
制御装置の機能ブロック図である。10はマイクロコン
ピュータであり、内部タイマとコンベアアウト機能を有
するもので、例えば沖電気工業株式会社製のMSM93
H001(商品名)を用いる。CPUIは内部タイマ3
により一定周期で割込みを発生させ、その時出力部6の
出力をONするプログラムと、フンペアアウトレジスタ
4に出力をOFFする時間をストアするプログラムを具
備している。出力部6はマイクロコンピュータ10出力
ポートOPに接続されている。
FIG. 1 is a functional block diagram of a control device to which the pulse width modulation signal output method of the present invention is applied. 10 is a microcomputer, which has an internal timer and a conveyor out function, such as MSM93 manufactured by Oki Electric Industry Co., Ltd.
Use H001 (product name). CPUI uses internal timer 3
This includes a program that generates an interrupt at a constant period and turns on the output of the output section 6 at that time, and a program that stores the time for turning off the output in the humpair out register 4. The output section 6 is connected to the microcomputer 10 output port OP.

CPUIにより内部タイマ3に所定の時間をセットする
ことにより、内部タイマ3はCPUIにこの所定時間の
周期で割込みをかける。入力装置2からのデユーティ比
指令により、CPUIは前記割込みがかかると同時に出
力部6にその出力をONする信号を出力すると共に、コ
ンベアアウトレジスタ4にこの出力をOFFする時間を
セットする。比較部5では内部タイマ3の経過時間とコ
ンベアアウトレジスタ4のOFF時間とを比較し、内部
タイマ3の経過時間がOFF時間と一致したら出力部6
にその出力をOFFする信号を出力する。これにより出
力部6より、入力装置2からのデユーティ比指令に応じ
たパルス幅変調出力信号が出力きれる。以下第2図を用
いて上記動作を詳細に説明する。
By setting a predetermined time in the internal timer 3 using the CPU, the internal timer 3 interrupts the CPU at the cycle of this predetermined time. In response to a duty ratio command from the input device 2, the CPU outputs a signal to turn on the output to the output unit 6 at the same time as the interrupt occurs, and sets a time to turn off this output in the conveyor out register 4. The comparison section 5 compares the elapsed time of the internal timer 3 and the OFF time of the conveyor out register 4, and if the elapsed time of the internal timer 3 matches the OFF time, the output section 6
A signal is output to turn off the output. As a result, the output section 6 can output a pulse width modulated output signal according to the duty ratio command from the input device 2. The above operation will be explained in detail below using FIG. 2.

第2図はCPUIのコンベアアウトで使用するボート出
力に、2mS周期、レベルH’(高)出力で出力ONを
出力する場合のタイミングチャートを示す図である。内
部タイマ3は16ビツト長で1μs毎にインクリメント
され、オーバーフロー時に割り込みを発生する。ここで
タイマー割込ミ時に出力ポートOPの出力a1”にセッ
トし、内部タイマ3に2000μsの補数F830Hを
セットし、デユーティ出力を25%とする場合、500
7ZS(01F4H)+F830H−FEOCHをコン
ベアアウトレジスタ4にセットする。
FIG. 2 is a diagram showing a timing chart when an output ON is outputted at a level H' (high) output at a cycle of 2 mS to the boat output used for conveyor out of the CPUI. The internal timer 3 has a length of 16 bits and is incremented every 1 μs, and generates an interrupt upon overflow. Here, when setting the output a1 of the output port OP at the timer interrupt, and setting the complement F830H of 2000 μs to the internal timer 3, and setting the duty output to 25%, 500
Set 7ZS (01F4H)+F830H-FEOCH in conveyor out register 4.

これを第2図の■で行なった場合、500μs後の■で
内部タイマ3とコンベアアウトレジスタ4が一致し、出
力ポートOPの出力が“0”となる、■で内部タイマ3
を再設定した時デユーティの08時間の変更がなければ
同じ動作を繰り返す。次の■でのタイマ割込みでデユー
ティ時間が40%(FCEOH)に変更する場合、コン
ベアアウトレジスタ4を書き替えることにより、■のタ
イミングで出力ポートOPの出力が“O”となリ40%
のデユーティ出力が得られる0以上によって得られた出
力ボートOPの出力波形を第2図のBに示す、また、デ
ユーティ出力のON時間の変更は入力条件の変化等で必
要に応じて算出すればよく、変更する必要がなければ一
度設定するだけでよい。
If this is done at ■ in Figure 2, the internal timer 3 and conveyor out register 4 match at ■ after 500 μs, and the output of the output port OP becomes "0".
When resetting , the same operation will be repeated if the duty is not changed for 08 hours. When the duty time is changed to 40% (FCEOH) by the timer interrupt at the next time ■, by rewriting the conveyor out register 4, the output of the output port OP becomes “O” at the timing of ■ to 40%.
The output waveform of the output boat OP obtained when the duty output of Often, you only need to set it once if you don't need to change it.

第3図は内部タイマの割込により行なう上記処理の流れ
を示すフローチャートである。内部タイマにより割込み
がかかり、内部タイマ3がオーバーフローしたか否かを
判断(ステップ101)し、オーバーフローしていない
場合は、コンベアアウト割込要求フラグをリセットする
(ステップ102)、オーバーフローした場合は出力ボ
ートOPを′1”しくステップ103)、内部タイマ3
に2mSをセットしくステップ104)、次にON時間
(出力をOFFする時間)の変更か否かを判断しくステ
ップ105)、変更でなかったら上記処理を繰り返えし
、変更であったらコンベアアウトレジスタ4にON時間
をセットする。
FIG. 3 is a flowchart showing the flow of the above processing performed by an interrupt of an internal timer. An interrupt is generated by the internal timer, and it is determined whether or not internal timer 3 has overflowed (step 101). If it has not overflowed, the conveyor out interrupt request flag is reset (step 102), and if it has overflowed, it is output. Change the boat OP by '1' step 103), internal timer 3
Set 2mS to step 104), then judge whether the ON time (time to turn off the output) has changed or not (step 105), if not, repeat the above process, and if it has changed, turn the conveyor out. Set the ON time in register 4.

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

以上、説明したように本発明のパルス幅変調信号出力方
法は、パルス幅変調信号出力を外部タイマを使用せず内
部タイマのみで行なうのでコスト低減ができると共に、
コンベアアウト機能を使用することにより精度の良い〉
くルス幅変調を行なうことが可能となる等の優れた効果
を有する。
As explained above, the pulse width modulation signal output method of the present invention performs the pulse width modulation signal output using only the internal timer without using an external timer, so it is possible to reduce costs, and
High accuracy achieved by using the conveyor out function
This has excellent effects such as making it possible to perform pulse width modulation.

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

第1図は本発明のパルス幅変調信号出力方法を適用する
制御装置の機能ブロック図、第2図は動作を説明するた
めのタイミングチャート、第3図は処理の流れを示すフ
ローチャート、第4図は従来の外部カウントを用いて行
なうパルス幅変調信号出力装置の構成例を示す図、第5
図は従来の内部タイマを用いて行なうパルス幅変調信号
出力方法を説明するための図である。 図中、1・・・・CPU、2・・・・入力装置、3・・
・・内部タイマ、4・・・・コンベアアウトレジスタ、
5・・・・レジスタ、6・・・・出力部、10・・・・
マイクロコンピュータ。 ネ1りgII−パルス丁5LIJIイ[褐士lσ朶す!
〈策、れ同第d 図 第4 図
FIG. 1 is a functional block diagram of a control device to which the pulse width modulation signal output method of the present invention is applied, FIG. 2 is a timing chart for explaining the operation, FIG. 3 is a flowchart showing the flow of processing, and FIG. 4 5 is a diagram showing a configuration example of a pulse width modulation signal output device using a conventional external count.
The figure is a diagram for explaining a conventional method of outputting a pulse width modulated signal using an internal timer. In the figure, 1...CPU, 2...Input device, 3...
...Internal timer, 4...Conveyor out register,
5...Register, 6...Output section, 10...
microcomputer. Ne1ri gII-Pulse D5LIJIi [Brown Shilσmasu!
Figure 4

Claims (1)

【特許請求の範囲】[Claims] 内部タイマとコンベアアウト機能を有するマイクロコン
ピュータを具備し、パルス幅変調信号を出力する制御装
置において、前記内部タイマにより一定周期で割込みを
発生させて出力をONし、前記コンベアアウト機能によ
り該出力をOFFすることを特徴とするパルス幅変調信
号出力方法。
In a control device that is equipped with a microcomputer having an internal timer and a conveyor-out function and outputs a pulse width modulation signal, the internal timer generates an interrupt at a fixed period to turn on the output, and the conveyor-out function turns on the output. A pulse width modulation signal output method characterized by turning OFF.
JP17209888A 1988-07-11 1988-07-11 Output method for pulse width modulation signal Pending JPH0221302A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17209888A JPH0221302A (en) 1988-07-11 1988-07-11 Output method for pulse width modulation signal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP17209888A JPH0221302A (en) 1988-07-11 1988-07-11 Output method for pulse width modulation signal

Publications (1)

Publication Number Publication Date
JPH0221302A true JPH0221302A (en) 1990-01-24

Family

ID=15935507

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17209888A Pending JPH0221302A (en) 1988-07-11 1988-07-11 Output method for pulse width modulation signal

Country Status (1)

Country Link
JP (1) JPH0221302A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5928366A (en) * 1996-09-25 1999-07-27 Nec Corporation Microcomputer based system for the fail-safe control of an electric motor or the like

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5928366A (en) * 1996-09-25 1999-07-27 Nec Corporation Microcomputer based system for the fail-safe control of an electric motor or the like

Similar Documents

Publication Publication Date Title
KR960032138A (en) Microcomputer
JPH0221302A (en) Output method for pulse width modulation signal
JPH08139575A (en) Pulse output circuit
KR950013602B1 (en) Frequency measuring device
JPH08202372A (en) Volume control method of piezoelectric buzzer
KR100494114B1 (en) Timer circuit
JP3223884B2 (en) Duty ratio determination circuit and duty ratio determination method
JPS58182924A (en) signal generation circuit
JP4345200B2 (en) Programmable controller I/O unit
JPS62131756A (en) Triac controller
KR930005650B1 (en) How to delay time using timer
KR960030597A (en) Pulse width measurement method and apparatus
JP2906254B2 (en) Programmable controller
JPS63217425A (en) Automatic loop adjusting system
JPH05302940A (en) Frequency measuring apparatus
JPH0341772B2 (en)
RU1827714C (en) Former of pulse sequence
KR100215041B1 (en) Input method of cooking time by encoder for microwave oven
JPH03100473A (en) Pulse train input processor
JPH0141944B2 (en)
JPH04337920A (en) Timer device
JPH02267642A (en) Measuring device for time exclusive for cpu
KR19990040704A (en) VSI system with time count function using external signal
JPH04339272A (en) Frequency measuring device
JPH0285792A (en) Ac period watch