JPH08162933A - Period signal generator - Google Patents

Period signal generator

Info

Publication number
JPH08162933A
JPH08162933A JP6303369A JP30336994A JPH08162933A JP H08162933 A JPH08162933 A JP H08162933A JP 6303369 A JP6303369 A JP 6303369A JP 30336994 A JP30336994 A JP 30336994A JP H08162933 A JPH08162933 A JP H08162933A
Authority
JP
Japan
Prior art keywords
value
signal
comparator
signals
period
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
JP6303369A
Other languages
Japanese (ja)
Inventor
Tetsuya Otaki
哲也 大▲滝▼
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.)
Denso Corp
Original Assignee
NipponDenso 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 NipponDenso Co Ltd filed Critical NipponDenso Co Ltd
Priority to JP6303369A priority Critical patent/JPH08162933A/en
Publication of JPH08162933A publication Critical patent/JPH08162933A/en
Pending legal-status Critical Current

Links

Landscapes

  • Electronic Switches (AREA)
  • Combined Controls Of Internal Combustion Engines (AREA)

Abstract

PURPOSE: To generate the pulse width signals (period signals) of a cycle exceeding the circulation period of a counter while minimizing the processing loads of a CPU. CONSTITUTION: When a value set to a comparator 23 by the CPU 18 and the counted value of a free-running timer 24 match, the comparator 23 outputs matching signals to a pulse generation circuit 25 as trigger signals and outputs them to the CPU 18 as interruption signals. When the interruption signals are inputted, the CPU 18 sets the level of pulse signals to be outputted at the time of the input of the trigger signals at the next time to the pulse generation circuit 25 and sets the value corresponding to a time interval for outputting the matching signals next to the comparator 23. In the case of generating the pulse width signals of the cycle exceeding the circulation cycle of the free- running timer 24, the CPU 18 divides the cycle of the pulse width signals and sets the value to the comparator 23 so as to minimize the number of times of the matching signals outputted by the comparator 23.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、クロック信号のパルス
数を一定の計数範囲で循環的に計数するカウンタと、設
定された値とカウンタの計数値とを比較して、一致する
と一致信号を出力する比較器とを制御手段により制御す
ることによって、カウンタの循環周期を超える所定周期
の期間信号を発生させる期間信号発生装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention compares a counter for cyclically counting the number of pulses of a clock signal within a certain counting range with a set value and the count value of the counter, and when they match, a coincidence signal is generated. The present invention relates to a period signal generating device for generating a period signal having a predetermined cycle exceeding the circulation cycle of a counter by controlling an output comparator and a control means.

【0002】[0002]

【従来の技術】従来のこのような期間信号発生装置は、
例えば、特開平4−262614に開示されており、発
生させようとする期間信号の周期Tを、単位時間TZR
で分割した数nと、その剰余であるTrestとによってT
=n×TZR+Trestと表し、制御手段であるCPUに
単位時間TZR毎に割込みが入る度に比較器の設定値に
1を加算して行き、CPUの内部カウンタがnになる
と、剰余Trestに相当するカウント値を比較器に設定
し、その後比較器より一致信号が出力されることによ
り、周期Tの期間信号を得るようにしている。
2. Description of the Related Art A conventional signal generator for such a period is
For example, as disclosed in Japanese Patent Laid-Open No. 4-262614, the period T of the period signal to be generated is set to the unit time TZR.
T divided by the number n divided by and the remainder Trest
= N × TZR + Trest, 1 is added to the set value of the comparator every time the CPU as the control means is interrupted every unit time TZR, and when the internal counter of the CPU becomes n, it corresponds to the surplus Trest. The count value is set in the comparator, and then the coincidence signal is output from the comparator to obtain the period signal of the cycle T.

【0003】[0003]

【発明が解決しようとする課題】しかしながら、この様
な従来の装置においては、制御手段であるCPUに対し
て単位時間TZR毎に割込みを入れる必要があり、その
頻繁に生じる割込み処理によって、CPUの機能はこの
期間信号の発生のみに略占有されてしまうという不具合
があった。
However, in such a conventional device, it is necessary to interrupt the CPU as the control means every unit time TZR, and due to the frequently occurring interrupt processing, the CPU is interrupted. There is a problem that the function is almost exclusively occupied by the signal generation during this period.

【0004】本発明は上記問題を解決するもので、その
目的は、最小限の割込み処理によって、カウンタの循環
周期を超える所定周期の期間信号を発生させることがで
きる期間信号発生装置を提供するにある。
The present invention solves the above problems, and an object thereof is to provide a period signal generator capable of generating a period signal of a predetermined period exceeding the circulation period of a counter with a minimum of interrupt processing. is there.

【0005】[0005]

【課題を解決するための手段】上記目的を達成するた
め、請求項1記載の期間信号発生装置は、入力されるク
ロック信号のパルス数を一定の計数範囲で循環的に計数
するカウンタと、所定の値に設定可能で、その設定され
た値とカウンタの計数値とを比較して、一致すると一致
信号を出力する比較器と、割込み信号として与えられる
一致信号に基づいて期間信号を発生させるように設けら
れ、発生させようとする期間信号の周期が前記カウンタ
の循環周期を超える場合には、一致信号の出力間隔が循
環周期以下であって且つその出力回数が最小となるよう
に、期間信号の周期を分割して比較器に設定する値を決
定する制御手段とを具備したことを特徴とするものであ
る。この場合、期間信号発生装置は、内燃機関の制御に
関連して使用すると良い(請求項2)。
In order to achieve the above object, a period signal generator according to a first aspect of the present invention includes a counter for cyclically counting the number of pulses of an input clock signal within a certain counting range, and a predetermined counter. Can be set to the value of, and the set value is compared with the count value of the counter, and a comparator that outputs a match signal when they match, and a period signal is generated based on the match signal given as an interrupt signal. When the cycle of the period signal to be generated exceeds the circulation cycle of the counter, the period signal is output so that the output interval of the coincidence signal is equal to or less than the circulation cycle and the number of times of output is minimized. And a control means for determining a value to be set in the comparator by dividing the period. In this case, the period signal generator may be used in connection with the control of the internal combustion engine (claim 2).

【0006】[0006]

【作用】請求項1記載の期間信号発生装置によれば、制
御手段は、発生させようとする期間信号の周期がカウン
タの循環周期を超える場合には、一致信号の出力間隔が
循環周期以下であって且つその出力回数が最小となるよ
うに期間信号の周期を分割して比較器に設定する値を決
定し、比較器が出力する一致信号を割込み処理すること
により期間信号を発生させるので、最小限の割込み処理
による期間信号の発生が可能となる。
According to the period signal generator of the present invention, when the period of the period signal to be generated exceeds the circulation cycle of the counter, the control means sets the output interval of the coincidence signal to be equal to or less than the circulation cycle. Since the period signal is generated by dividing the cycle of the period signal so that the number of outputs is the minimum and determining the value to be set in the comparator, the coincidence signal output by the comparator is interrupted. It is possible to generate a period signal with a minimum of interrupt processing.

【0007】この場合、期間信号発生装置は、内燃機関
の制御に関連して使用するようにすれば、各種バルブの
制御などに有効に応用できる(請求項2)。
In this case, if the period signal generator is used in connection with the control of the internal combustion engine, it can be effectively applied to the control of various valves (claim 2).

【0008】[0008]

【実施例】以下本発明を、自動車の内燃機関であるガソ
リンエンジン(以下エンジンと称す)における電子式燃
料噴射装置に適用した一実施例につき、図面を参照しな
がら説明する。エンジンの簡略化された機械的構成を示
す図2において、エンジン本体1は、複数個のシリンダ
2及びそのシリンダ2の内壁に接して上下動するピスト
ン3を中心に構成されており、ここでは、代表して1つ
のみを示している。シリンダ2とピストン3の上面との
間の空間に形成される燃焼室4の上方部位には、シリン
ダ2の上部右側の吸気弁5によって燃焼室4への連通が
制御される吸気通路6及び、同様にシリンダ2の上部左
側の排気弁7によって燃焼室4への連通が制御される排
気通路8が形成されている。また、燃焼室4内上部に
は、吸気弁5と排気弁7との間に位置して、点火プラグ
16が設けられている。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment in which the present invention is applied to an electronic fuel injection device in a gasoline engine (hereinafter referred to as an engine) which is an internal combustion engine of an automobile will be described with reference to the drawings. In FIG. 2 showing a simplified mechanical structure of an engine, an engine main body 1 is mainly composed of a plurality of cylinders 2 and a piston 3 which vertically moves in contact with an inner wall of the cylinders 2. Only one is shown as a representative. At an upper portion of the combustion chamber 4 formed in a space between the cylinder 2 and the upper surface of the piston 3, an intake passage 6 whose communication to the combustion chamber 4 is controlled by an intake valve 5 on the upper right side of the cylinder 2, Similarly, an exhaust passage 8 whose communication with the combustion chamber 4 is controlled by an exhaust valve 7 on the upper left side of the cylinder 2 is formed. A spark plug 16 is provided in the upper part of the combustion chamber 4 between the intake valve 5 and the exhaust valve 7.

【0009】そして、吸気通路6には、吸気量を計測す
る空気量センサ9及び図示しないアクセルペダルと連動
するスロットル弁10並びに吸気した空気を図示しない
他のシリンダにも分配するサージタンク11がある。そ
して、サージタンク11と吸気弁5との間の吸気通路6
の上部には、燃料を吸気通路6内に噴射する燃料噴射弁
12が設置されている。
In the intake passage 6, there are an air amount sensor 9 for measuring the intake air amount, a throttle valve 10 interlocking with an accelerator pedal (not shown), and a surge tank 11 for distributing the intake air to other cylinders (not shown). . Then, the intake passage 6 between the surge tank 11 and the intake valve 5
A fuel injection valve 12 for injecting fuel into the intake passage 6 is installed above the.

【0010】サージタンク11の下部には、図示しない
燃料タンクより気化してキャニスタに貯留された燃料
(エバポガス)を吸気通路6に導入するための、エバポ
ガス排出ポート13が設けられ、エバポガスの吸気通路
6への排出は、パージバルブ14によって制御される。
そして、各シリンダ毎に設けられている燃料噴射弁12
と、パージバルブ14とは、その開閉を制御装置15か
ら出力される電気的なパルス信号である制御信号によっ
て制御されるようになっている。
An evaporative gas exhaust port 13 for introducing the fuel (evaporative gas) vaporized from a fuel tank (not shown) and stored in the canister into the intake passage 6 is provided in the lower portion of the surge tank 11, and the evaporative gas intake passage is provided. The discharge to 6 is controlled by the purge valve 14.
The fuel injection valve 12 provided for each cylinder
The opening and closing of the purge valve 14 are controlled by a control signal which is an electric pulse signal output from the controller 15.

【0011】ディストリビュータ17内に設けられたク
ランク角センサ17a及び17bからは、図示しないク
ランク軸の回転角が180度及び720度になる毎にパ
ルス信号がそれぞれ出力され、各々の出力信号は、空気
量センサ9の出力信号と共に制御装置15に与えられる
ようになっている。
From the crank angle sensors 17a and 17b provided in the distributor 17, a pulse signal is output each time the rotation angle of a crankshaft (not shown) becomes 180 degrees and 720 degrees, and each output signal is an air signal. The output signal of the quantity sensor 9 is provided to the control device 15.

【0012】制御装置15の電気的構成を示す図3にお
いて、制御手段としてのCPU18は、ROM19,R
AM20,A/D変換器21,I/Oインターフェイス
22a及び22bとアドレス及びデータバスライン並び
に制御信号線を介して接続されている。そして、空気量
センサ9及び図示しない他のセンサの出力信号は、A/
D変換器21の入力端子に与えられ、CPU18により
与えられる指示信号に応じてA/D変換される。
In FIG. 3 showing the electrical construction of the control device 15, the CPU 18 as a control means is provided with a ROM 19, R
It is connected to the AM 20, the A / D converter 21, and the I / O interfaces 22a and 22b via address and data bus lines and control signal lines. The output signals of the air amount sensor 9 and other sensors (not shown) are A /
The signal is given to the input terminal of the D converter 21 and is A / D converted according to the instruction signal given by the CPU 18.

【0013】また、クランク角センサ17aからの出力
信号は、I/Oインターフェイス22aの入力端子に与
えられるとともに、CPU18に対しての割込み要求信
号となり、加えて、CPU18内に設けられたタイミン
グカウンタのクロック信号となる。そして、クランク角
センサ17bからの出力信号も、同様にI/Oインター
フェイス22aの入力端子に与えられ、これは上記タイ
ミングカウンタのリセット信号となる。CPU18は、
タイミングカウンタから得られるタイミング信号に基い
て噴射用パルス幅信号を出力してI/Oインターフェイ
ス22bに与えるようになっている。
The output signal from the crank angle sensor 17a is applied to the input terminal of the I / O interface 22a and becomes an interrupt request signal to the CPU 18. In addition, the output signal from the timing counter of the CPU 18 is provided. It becomes a clock signal. The output signal from the crank angle sensor 17b is also given to the input terminal of the I / O interface 22a, which serves as a reset signal for the timing counter. The CPU 18
An injection pulse width signal is output based on the timing signal obtained from the timing counter and given to the I / O interface 22b.

【0014】そして、I/Oインターフェイス22bの
内部には、その入力された噴射用パルス幅信号のタイミ
ング及びパルス幅に応じた駆動信号に変換する駆動回路
を有しており、この駆動回路からの駆動信号は、燃料噴
射弁12に与えられ、燃料噴射弁12から噴射用パルス
幅信号に応じた量の燃料が噴射されるようになっている
(図5参照)。
The I / O interface 22b has a drive circuit for converting it into a drive signal corresponding to the timing and pulse width of the input pulse width signal for injection. The drive signal is given to the fuel injection valve 12, and the fuel injection valve 12 injects an amount of fuel according to the injection pulse width signal (see FIG. 5).

【0015】さて、図1には、CPU18を中心とする
期間信号発生装置27の電気的構成が示されている。こ
の図1において、CPU18と、比較器23,入力され
るクロック信号のパルス数を循環的に計数するカウンタ
であるフリーラン・タイマ(FreeRun Timer ,以下FR
T)24及びパルス発生回路25とは、データバスライ
ン及び制御信号線で接続されており、また、図示しない
アドレスデコーダとは、アドレスバスライン及び制御信
号線で接続されている。また、アドレスデコーダからは
チップセレクト信号が比較器23,FRT24及びパル
ス発生回路25に対して与えられるようになっている。
Now, FIG. 1 shows an electrical configuration of the period signal generator 27 centering on the CPU 18. In FIG. 1, a CPU 18, a comparator 23, and a free run timer (FR), which is a counter that cyclically counts the number of pulses of an input clock signal.
T) 24 and the pulse generation circuit 25 are connected by a data bus line and a control signal line, and an address decoder (not shown) is connected by an address bus line and a control signal line. Also, a chip select signal is applied from the address decoder to the comparator 23, the FRT 24 and the pulse generating circuit 25.

【0016】FRT24のクロック入力端子には、クロ
ック回路26よりクロック信号が与えられるようになっ
ており、FRT24はそのクロック信号の立上がりエッ
ジでカウント行う。FRT24は、例えば16ビットの
ビット幅を有し、0000H 〜FFFFH までカウントすると、
再び0000H に戻って循環的にカウントを続行する。ま
た、CPU18はFRT24のカウンタビットをデータ
バスラインを介して読出すことができるようになってい
る。
A clock signal is supplied from the clock circuit 26 to the clock input terminal of the FRT 24, and the FRT 24 counts at the rising edge of the clock signal. The FRT 24 has a bit width of 16 bits, for example, and when counting from 0000H to FFFFH,
It returns to 0000H again and continues counting cyclically. Further, the CPU 18 can read the counter bit of the FRT 24 via the data bus line.

【0017】比較器23の一方のデータ入力端子には、
FRT24のカウンタビットが入力されており、他方の
データ入力端子には、CPU18から書き込まれたデー
タが、図示しないラッチ回路によりラッチされて入力さ
れる。そして、両方のデータ入力端子のデータが一致す
ると、比較器23は一致信号をパルス発生回路25のト
リガ入力端子に与えると同時に、CPU18の割込み入
力端子にも与えるようになっている。
At one data input terminal of the comparator 23,
The counter bit of the FRT 24 is input, and the data written from the CPU 18 is latched and input to the other data input terminal by a latch circuit (not shown). When the data at both data input terminals match, the comparator 23 applies a match signal to the trigger input terminal of the pulse generation circuit 25 and at the same time to the interrupt input terminal of the CPU 18.

【0018】パルス発生回路25には、トリガ入力があ
った時に出力する開閉用パルス幅信号のハイまたはロー
のレベルを、CPU18より書込まれて設定されるよう
になっており、出力される開閉用パルス幅信号は、前記
I/Oインターフェイス22bの入力端子に与えられる
ようになっている。そして、I/Oインターフェイス2
2bは、駆動回路から開閉用パルス幅信号に応じた駆動
信号を出力してパージバルブ14に与えるようになって
おり、パージバルブ14はこれによって開閉制御され
る。
In the pulse generator 25, the high or low level of the opening / closing pulse width signal output when a trigger is input is written and set by the CPU 18, and the output opening / closing is performed. The pulse width signal for use is applied to the input terminal of the I / O interface 22b. And I / O interface 2
2b outputs a drive signal corresponding to the opening / closing pulse width signal from the drive circuit and supplies it to the purge valve 14, and the purge valve 14 is controlled to open / close by this.

【0019】次に本実施例の作用について、図4乃至図
12をも参照して説明する。制御装置15は、タイミン
グカウンタのクロック信号及びそのリセット信号として
与えられるクランク角センサ17a及び17bからの出
力信号に基いて噴射用パルス幅信号を出力して燃料の噴
射制御処理を行う。
Next, the operation of this embodiment will be described with reference to FIGS. 4 to 12. The control device 15 outputs the injection pulse width signal based on the output signals from the crank angle sensors 17a and 17b given as the clock signal of the timing counter and the reset signal thereof to perform the fuel injection control process.

【0020】即ち、各シリンダ2毎に設けられている燃
料噴射弁12は、その開閉を制御装置15のI/Oイン
ターフェイス22bから出力される駆動信号(噴射用パ
ルス幅信号)によって制御され、図示しない燃料供給系
より送られる加圧燃料を吸気通路6内に間欠的に噴射す
る。
That is, the opening and closing of the fuel injection valve 12 provided for each cylinder 2 is controlled by the drive signal (injection pulse width signal) output from the I / O interface 22b of the control device 15, and is shown in the drawing. The pressurized fuel sent from the fuel supply system is intermittently injected into the intake passage 6.

【0021】吸気通路6内に噴射された燃料は、吸気弁
5が開くとスロットル弁10を介して吸気される空気と
共に燃焼室4内に供給され、点火プラグ16によって点
火されて燃焼され、その爆発力によってピストン3を押
下し、図示しないクランクを回転させる。そして、燃焼
室4内で燃焼された後の排気ガスは、開いた排気弁7を
介して排気通路8に送出され、図示しない触媒コンバー
タを介して大気中に排出される。この燃焼サイクルを繰
返すことによって、エンジンは回転して負荷を駆動す
る。
The fuel injected into the intake passage 6 is supplied into the combustion chamber 4 together with the air taken in through the throttle valve 10 when the intake valve 5 is opened, ignited by the ignition plug 16 and burned. The explosive force pushes down the piston 3 to rotate a crank (not shown). Then, the exhaust gas after being burned in the combustion chamber 4 is sent to the exhaust passage 8 through the open exhaust valve 7 and is discharged into the atmosphere through a catalytic converter (not shown). By repeating this combustion cycle, the engine rotates to drive the load.

【0022】パージバルブ14の制御サブルーチンのフ
ローチャートを示す図4において、これはCPU18の
ベース処理により周期65ms毎に行われ、「デュ−テ
ィDwを計算」の処理ステップP1でパージバルブ14
を1周期(駆動周期T)中に開制御する割合のデュ−テ
ィ比Dwを、エンジンの入出力情報,即ち、空気量セン
サ9から得られる吸気量及びクランク角センサ17a若
しくは17bからのパルス信号をカウントすることによ
り得られる回転数に基いて計算するもので、例えば、ア
イドリング時には0%に設定し、回転数が高く且つ吸気
量が多くなるに従って(即ち高負荷になるに従って)大
となるように設定されるものである。この様にして、デ
ュ−ティ比Dwの計算が終了すると、処理を抜けてメイ
ンルーチンにリターンする。
In FIG. 4 showing a flow chart of the control subroutine of the purge valve 14, this is performed by the base processing of the CPU 18 at intervals of 65 ms, and the purge valve 14 is executed in the processing step P1 of "calculate duty Dw".
The duty ratio Dw, which is the ratio of opening control during one cycle (driving cycle T), is the input / output information of the engine, that is, the intake air amount obtained from the air amount sensor 9 and the pulse signal from the crank angle sensor 17a or 17b. It is calculated based on the number of revolutions obtained by counting, for example, it is set to 0% during idling, and becomes larger as the number of revolutions increases and the intake amount increases (that is, as the load increases). Is set to. When the calculation of the duty ratio Dw is completed in this way, the process is exited and the process returns to the main routine.

【0023】ここで計算されたデュ−ティ比Dwは、後
述するように期間信号としての開閉用パルス幅信号に対
する時間に計算されると、パルス発生回路25よりその
時間だけローレベルになるパルス信号としてI/Oイン
ターフェイス22bに対して出力され、パージバルブ1
4を開閉制御する(図5参照)。
When the duty ratio Dw calculated here is calculated at the time for the opening / closing pulse width signal as the period signal, as will be described later, the pulse signal which becomes low level by the pulse generation circuit 25 for that time. Is output to the I / O interface 22b as the purge valve 1
4 is controlled to open and close (see FIG. 5).

【0024】ここで、FRT24に与えられているクロ
ック信号の周期は1μsとすると、カウント値は0〜6
5535であるから、循環周期Tmは65.536ms
となる。そして、駆動周期Tを100ms、ローレベル
の出力パルス幅をTwmsとする。また、比較器23の
設定データのビット幅は、FRT24と同じ16ビット
とする。パージバルブ14の制御信号である開閉用パル
ス幅信号の作成は、比較器23からの一致信号により発
生するCPU18への割込み処理に基づいて行われる。
If the cycle of the clock signal given to the FRT 24 is 1 μs, the count value is 0 to 6
Since it is 5535, the circulation cycle Tm is 65.536 ms.
Becomes Then, the driving cycle T is 100 ms, and the low-level output pulse width is Twms. The bit width of the setting data of the comparator 23 is 16 bits, which is the same as that of the FRT 24. Creation of the opening / closing pulse width signal which is the control signal of the purge valve 14 is performed based on the interrupt processing to the CPU 18 generated by the coincidence signal from the comparator 23.

【0025】まず、最初のパルスを作成する前に発生す
る割込みは、CPU18が適当な値を比較器23に書込
むことにより発生する。また、パルス発生回路25に対
しては、イニシャライズ処理においてレベル”ロー”が
設定されており、最初一致信号が出力された時点では、
パルス発生回路25はローを出力するようになってい
る。尚、以下ではms単位の時間をFRT24のカウン
ト値に換算して表した値を、Cに添字を付加して表すこ
とにする。例えば、時間50msをカウント値で表した
ものは、C50と表記する。また、FRT24の最大周期
Tmに対応する最大カウント値をCm(=FFFFH )とす
る。
First, the interrupt generated before the first pulse is generated is generated by the CPU 18 writing an appropriate value in the comparator 23. Further, the level "low" is set in the pulse generation circuit 25 in the initialization process, and at the time when the match signal is first output,
The pulse generation circuit 25 outputs low. In the following, the value expressed by converting the time in ms unit into the count value of the FRT 24 will be expressed by adding a subscript to C. For example, a count value of 50 ms is expressed as C50. The maximum count value corresponding to the maximum cycle Tm of the FRT 24 is Cm (= FFFFH).

【0026】その割込み処理の制御内容のフローチャー
トを示す図6において、CPU18は、「CINT=0
?」の判断ステップS1において、割込み回数のカウン
タであるCINTの値が0か否かが判断される。CIN
Tはイニシャライズ処理において0クリアされているの
で、まず、「YES」と判断して、次の「DwよりTw
を計算」の処理ステップS2に移行する。
In FIG. 6 showing a flow chart of the control contents of the interrupt processing, the CPU 18 causes "CINT = 0".
? In a determination step S1 of "," it is determined whether or not the value of CINT, which is a counter of the number of interrupts, is 0. CIN
Since T has been cleared to 0 in the initialization processing, first, it is determined to be "YES" and the next "Dw to Tw
Calculation step S2.

【0027】処理ステップS2においては、処理ステッ
プP1で得た開閉用パルス幅信号のデュ−ティ比Dwか
ら、ローレベルのパルス幅(以下単にパルス幅と称す)
の時間Twを算出すると、次のCompの値を読み込
み、「RAM(100ms基準START時刻)←Co
mp」の処理ステップS3に移行し、現在のレジスタC
ompの値を読出して、初期値として、比較器23に値
を設定するためにRAM20内に設けた基準START
時刻値記憶領域に書込み記憶させると、次の「0<Tw
≦50ms?」の判断ステップS4に移行する。
In processing step S2, a low-level pulse width (hereinafter simply referred to as pulse width) is calculated from the duty ratio Dw of the opening / closing pulse width signal obtained in processing step P1.
When the time Tw of is calculated, the value of the next Comp is read and “RAM (100 ms reference START time) ← Co
mp ”processing step S3, and the current register C
A reference START provided in the RAM 20 for reading the value of omp and setting the value in the comparator 23 as an initial value.
When it is written and stored in the time value storage area, the next “0 <Tw
≦ 50 ms? The determination step S4 is performed.

【0028】処理ステップS4においては、パルス幅T
wが、駆動周期Tである100msの1/2である50
ms以下であるか否かが判断される。判断ステップS4
において「YES」と判断すると、次の「パルス発生回
路に”H”を設定 Comp←Comp+Cw」の処理
ステップS5に移行し、「NO」と判断すると、次の
「パルス発生回路に”L”を設定 Comp←Comp
+Cw/2」の処理ステップS6に移行する。
In the processing step S4, the pulse width T
w is 50 which is 1/2 of the driving cycle T of 100 ms.
It is determined whether or not ms or less. Judgment step S4
If “YES” is determined in step 1, the next “pulse generation circuit is set to“ H ”Comp ← Comp + Cw” processing proceeds to step S5, and if “NO” is determined, the next “pulse generation circuit is set to“ L ”. Setting Comp ← Comp
+ Cw / 2 "processing step S6.

【0029】以降は、まずパルス幅Twが0<Tw≦5
0msである場合について述べる。処理ステップS5に
おいては、CPU18は、パルス発生回路25に対して
書込みを行い、次回のトリガ信号の入力時にパルス発生
回路25が出力するパルス信号のレベルを”ハイ”
(H)に設定する。そして、ステップS3で書込んだレ
ジスタCompの値に、パルス幅Twをカウント値に換
算した値Cwを加算して、その値を再びレジスタCom
pに書込んで、それを比較器23に設定する。その後、
「CINT←CINT+1」の処理ステップS7に移行
する。処理ステップS7においては、割込み回数のカウ
ンタCINTをインクリメントすると割込み処理を終了
し、メインルーチンにリターンする。
After that, first, the pulse width Tw is 0 <Tw ≦ 5.
The case of 0 ms will be described. In processing step S5, the CPU 18 writes to the pulse generation circuit 25, and sets the level of the pulse signal output from the pulse generation circuit 25 to "high" at the next input of the trigger signal.
Set to (H). Then, the value Cw obtained by converting the pulse width Tw into a count value is added to the value of the register Comp written in step S3, and the value is added again to the register Com.
Write to p and set it in comparator 23. afterwards,
The process moves to the processing step S7 of "CINT ← CINT + 1". In the processing step S7, the interrupt processing is finished by incrementing the interrupt number counter CINT, and the process returns to the main routine.

【0030】その後、FRT24のカウントが進んで、
ステップS5で比較器23に設定した値に等しくなる
と、比較器23は一致信号をパルス発生回路25に出力
すると共に、CPU18に対して割込みを発生させる。
パルス発生回路25は、この時点でステップS5で設定
されたレベル”ハイ”を出力するので、最初の割り込み
が入った時点からここまでが、パルス幅Twに相当する
ローレベル期間の出力時間となる(図7参照)。
After that, the count of the FRT 24 progresses,
When it becomes equal to the value set in the comparator 23 in step S5, the comparator 23 outputs a coincidence signal to the pulse generation circuit 25 and causes the CPU 18 to generate an interrupt.
Since the pulse generation circuit 25 outputs the level "high" set in step S5 at this time, the time from the time when the first interrupt is input to this point is the output time of the low level period corresponding to the pulse width Tw. (See Figure 7).

【0031】再び割込み処理ルーチンに入ると、割込み
カウンタCINTは1になっているので、今度は判断ス
テップS1において「NO」と判断して、「CINT=
1?」の判断ステップS8に移行する。判断ステップS
8では「YES」と判断するので、次の「0<Tw≦5
0ms?」の判断ステップS9に移行する。
When the interrupt processing routine is entered again, the interrupt counter CINT has become 1, so this time it is judged "NO" at judgment step S1 and "CINT =
1? The determination step S8. Judgment step S
In No. 8, since it is determined as “YES”, the next “0 <Tw ≦ 5
0 ms? The determination step S9 is performed.

【0032】判断ステップでS9で「YES」と判断す
ると、「パルス発生回路に”H”設定 Comp←Co
mp+(C100 −Cw)/2」の処理ステップS10に
移行し、「NO」と判断すると、次の「パルス発生回路
に”H”設定 Comp←Comp+Cw/2」の処理
ステップS11に移行する。
If "YES" is determined in S9 in the determination step, "pulse generator circuit is set to" H "Comp ← Co
mp + (C100-Cw) / 2 "processing step S10 is performed, and if" NO "is determined, the next" pulse generator circuit "H" setting Comp ← Comp + Cw / 2 "processing step S11 is performed.

【0033】処理ステップS10においては、パルス幅
Twは0<Tw≦50msの範囲にある。従って、駆動
周期Tたる100msをカウント値に換算した値C100
から前記パルス幅カウント値Cwを減じた値をレジスタ
Compの現在値にそのまま加えると、最大カウント値
Cmを超える、即ち、C100 −Cw>Cmとなる可能性
がある。これを図7を参照して説明すると、ステップS
3でRAM値(基準時刻)を読んだ循環周期Tmを特定
するためTm(1)とすると、RAM値(基準時刻)に
よっては次の循環周期Tm(2)を超えて、更に次の循
環周期Tm(3)にかかるカウント値となる場合があ
る、ということを示す。
In the processing step S10, the pulse width Tw is in the range of 0 <Tw ≦ 50 ms. Therefore, a value C100 obtained by converting the driving period T of 100 ms into a count value
If the value obtained by subtracting the pulse width count value Cw from the above is directly added to the current value of the register Comp, the maximum count value Cm may be exceeded, that is, C100-Cw> Cm. This will be described with reference to FIG. 7. Step S
In order to specify the circulation cycle Tm in which the RAM value (reference time) is read in 3 and Tm (1), depending on the RAM value (reference time), the next circulation cycle Tm (2) is exceeded, and the next circulation cycle is further exceeded. This indicates that the count value for Tm (3) may be reached.

【0034】このとき、比較器23のビット幅はFRT
24のビット幅に等しく16ビットであるから、循環周
期Tm(2)を超えてオーバーフローした17ビット目
は無視されて、図7中の横軸でTm(3)内のa点に来
るべき時間はTm(2)内のb点に来てしまうことにな
り、正確な時間設定ができなくなる。
At this time, the bit width of the comparator 23 is FRT.
Since it is 16 bits which is equal to the bit width of 24, the 17th bit that overflows beyond the circulation period Tm (2) is ignored, and the time to come to point a in Tm (3) on the horizontal axis in FIG. 7 is ignored. Will come to point b in Tm (2), and accurate time setting will not be possible.

【0035】これを避けるため、処理ステップS10で
は、レジスタCompの値に、駆動周期のカウント値C
100 から前記パルス幅のカウント値Cwを減じて2で除
した値を加算してその値を再びレジスタCompに書込
み、それを比較器23に設定する。そして、「CINT
←CINT+1」の処理ステップS12に移行して、カ
ウンタCINTをインクリメントすると、割込み処理を
抜けてメインルーチンにリターンする。
In order to avoid this, in the processing step S10, the value of the register Comp is set to the count value C of the driving cycle.
The value obtained by subtracting the pulse width count value Cw from 100 and dividing by 2 is added, the value is again written in the register Comp, and the value is set in the comparator 23. And "CINT
When the counter CINT is incremented by going to the processing step S12 of "← CINT + 1", the interrupt processing is terminated and the process returns to the main routine.

【0036】そして、また時間が経過して、FRT24
のカウント値がステップS10で比較器23に設定した
値に一致すると、比較器23は一致信号をパルス発生回
路25に出力すると共に、CPU18に対して割込みを
発生させる。パルス発生回路25は、この時点でステッ
プS10で設定されたレベル”ハイ”を出力する。
Then, after a lapse of time, the FRT 24
When the count value of 1 coincides with the value set in the comparator 23 in step S10, the comparator 23 outputs a coincidence signal to the pulse generation circuit 25 and causes the CPU 18 to generate an interrupt. The pulse generation circuit 25 outputs the level "high" set in step S10 at this point.

【0037】3度目の割込み処理ルーチンにおいてはカ
ウンタCINTは2であり、ステップS1及びS8でそ
れぞれ「NO」と判断して、「パルス発生回路に”L”
設定Comp←RAM(100ms基準START時
刻)+C100 」の処理ステップS13に移行する。処理
ステップS13においては、パルス発生回路25にレベ
ル”ロー”を設定すると、100msの駆動周期(T)
を出力するため、処理ステップS3でRAM20に記憶
させたFRT24のカウンタ初期値Cxを読出して、そ
れに駆動周期100msのカウント値C100 を加算した
値をレジスタCompに書込み記憶させ、それを比較器
23に設定する。そして、つぎの「CINT←0」の処
理ステップS14においてカウンタCINTを0クリア
すると、割込み処理を抜けてメインルーチンにリターン
する。
In the third interrupt processing routine, the counter CINT is 2, and it is judged "NO" in steps S1 and S8, and "the pulse generation circuit is" L ".
Setting Comp ← RAM (100 ms reference START time) + C100 ”processing proceeds to step S13. In the processing step S13, when the level "low" is set in the pulse generation circuit 25, the driving cycle (T) of 100 ms is set.
In order to output, the counter initial value Cx of the FRT 24 stored in the RAM 20 in the processing step S3 is read, and a value obtained by adding the count value C100 of the driving cycle of 100 ms to the register Comp is written and stored in the comparator 23. Set. Then, when the counter CINT is cleared to 0 in the next processing step S14 of "CINT ← 0", the interrupt processing is terminated and the process returns to the main routine.

【0038】更に時間が経過して、FRT24のカウン
ト値がステップS13で比較器23に設定した値に等し
くなると、比較器23は一致信号をパルス発生回路25
に出力すると共に、CPU18に対して割込みを発生さ
せて、次周期の開閉用パルス幅信号の作成処理が開始さ
れる。パルス発生回路25は、この時点でステップS1
3で設定されたレベル”ロー”を出力する。以上で1周
期分の開閉用パルス幅信号が作成される。
When a further time elapses and the count value of the FRT 24 becomes equal to the value set in the comparator 23 in step S13, the comparator 23 outputs a coincidence signal to the pulse generation circuit 25.
And the CPU 18 is caused to generate an interrupt, and the process of creating the opening / closing pulse width signal in the next cycle is started. The pulse generation circuit 25 then returns to step S1 at this point.
The level "low" set in 3 is output. As described above, the opening / closing pulse width signal for one cycle is created.

【0039】一方、パルス幅Twが50ms<Tw≦1
00msの範囲にある場合について述べる。この場合
は、判断ステップS4において「NO」と判断して処理
ステップS6に移行する。ここで、前記換算した値Cw
をレジスタCompの現在値にそのまま加えると、ステ
ップS10での説明と同様に、循環周期Tm(2)を超
えて、更に次の循環周期Tm(3)にかかるカウント値
となる場合がある(図8参照)。これを避けるため、処
理ステップS6では、レジスタCompの値に、前記換
算した値Cwを2で除したCw/2を加算して、その値
を再びレジスタCompに書込み、それを比較器23に
設定する。そして、「CINT←CINT+1」の処理
ステップS7に移行する。
On the other hand, the pulse width Tw is 50 ms <Tw ≦ 1.
The case of being in the range of 00 ms will be described. In this case, it is determined to be "NO" in the determination step S4 and the process proceeds to the processing step S6. Here, the converted value Cw
If is added to the current value of the register Comp as it is, the count value may exceed the circulation cycle Tm (2) and reach the next circulation cycle Tm (3) as in the case of step S10 (see FIG. 8). In order to avoid this, in processing step S6, Cw / 2 obtained by dividing the converted value Cw by 2 is added to the value of the register Comp, the value is written again in the register Comp, and it is set in the comparator 23. To do. Then, the process proceeds to the processing step S7 of "CINT ← CINT + 1".

【0040】次回のCINT=1での割込み処理におい
ては、判断ステップS9において「NO」と判断して
「パルス発生回路に”H”設定 Comp←Comp+
Cw/2」の処理ステップS11に移行し、レジスタC
ompの値を読出して、もう一度前記換算した値Cwを
2で除したCw/2を加算して、その値を再びレジスタ
Comp書込み、それを比較器23に設定する。そし
て、「CINT←CINT+1」の処理ステップS12
に移行する。
In the next interrupt processing at CINT = 1, it is judged "NO" in the judgment step S9 and "the pulse generating circuit is set to" H "Comp ← Comp +.
Cw / 2 ”processing step S11, and register C
The value of omp is read, Cw / 2 obtained by dividing the converted value Cw by 2 is added again, the value is written again in the register Comp, and it is set in the comparator 23. Then, the processing step S12 of "CINT ← CINT + 1"
Move to

【0041】その後、比較器23より一致信号が出力さ
れ、CINT=2での割込み処理においては、パルス発
生回路25はステップS11で設定されたレベル”ハ
イ”を出力するので、最初の割込みが入った時点からこ
こまでが、パルス幅Twに相当するローレベル期間の出
力時間となる。
Thereafter, the coincidence signal is output from the comparator 23, and in the interrupt processing at CINT = 2, the pulse generation circuit 25 outputs the level "high" set in step S11, so that the first interrupt is input. From this point to the point up to this point is the output time of the low level period corresponding to the pulse width Tw.

【0042】次に、T=150msである場合につい
て、図9乃至図12を参照して説明するに、図5と同一
部分には同一符号を付して、以下異なる部分のみ説明す
る。◎T=150msである場合の割込み処理の制御内
容のフローチャートを示す図9において、まず、パルス
幅Twが0<Tw≦50msのときは(図10参照)、
最初の割込み処理はT=100msの場合と全く同様
に、ステップS1〜S5及びS7を通過して割込み処理
を抜けてリターンする。また、2回目の割込み処理もT
=100msの場合と同様に、ステップS8〜S10及
びS12を通過して割込み処理を抜けてリターンする。
Next, the case of T = 150 ms will be described with reference to FIGS. 9 to 12. The same parts as those in FIG. 5 are designated by the same reference numerals, and only different parts will be described below. In FIG. 9 showing the flowchart of the control contents of the interrupt process when T = 150 ms, first, when the pulse width Tw is 0 <Tw ≦ 50 ms (see FIG. 10),
The first interrupt process passes through steps S1 to S5 and S7, exits the interrupt process, and returns as in the case of T = 100 ms. Also, the second interrupt processing is T
As in the case of 100 ms, the process goes through steps S8 to S10 and S12, exits the interrupt process, and returns.

【0043】3回目の割込み処理においては、「CIN
T=1?」の判断ステップS8において「NO」と判断
すると、「CINT=2?」の判断ステップS19に移
行して、割込みカウンタCINTが2であるか否かが判
断される。この場合は判断ステップS19において「Y
ES」と判断して、次の「0<Tw≦50ms?」の判
断ステップS20に移行する。そして、判断ステップS
20においても「YES」と判断するので、次の「パル
ス発生回路に”H”設定 Comp←Comp+(C10
0 −Cw)/2」の処理ステップS21に移行する。
In the third interrupt processing, "CIN
T = 1? If "NO" is determined in the determination step S8 of "," the process proceeds to determination step S19 of "CINT = 2?", And it is determined whether or not the interrupt counter CINT is 2. In this case, the determination step S19 returns "Y
When it is judged as "ES", the process proceeds to the next judgment step S20 of "0 <Tw≤50 ms?". Then, the judgment step S
Since it is determined to be “YES” also in 20, the next “H” is set in the pulse generation circuit Comp ← Comp + (C10
0-Cw) / 2 "processing step S21.

【0044】処理ステップS21においては、パルス発
生回路25にレベル”ハイ”を設定し、ステップS10
でレジスタCompの値に加算したのと同じ値(C100
−Cw)/2をレジスタCompの現在値に加えて、そ
れを比較器23に設定する。そして、「CINT←CI
NT+1」の処理ステップS25に移行して、カウンタ
CINTをインクリメントすると、割込み処理を抜けて
リターンする。
In the processing step S21, the level "high" is set in the pulse generating circuit 25, and the step S10 is performed.
The same value (C100
Add −Cw) / 2 to the current value of register Comp and set it in comparator 23. Then, "CINT ← CI
If the counter CINT is incremented by proceeding to the processing step S25 of "NT + 1", the interrupt processing is terminated and the processing returns.

【0045】4回目の割込み処理においては、カウンタ
CINTは3であるので、判断ステップS1,S8及び
S19において「NO」と判断して、「パルス発生回路
に”L”設定 Comp←RAM(150ms基準ST
ART時刻)+C150 」の処理ステップS26に移行す
る。処理ステップS26においては、パルス発生回路2
5にレベル”ハイ”を設定する。また、この時点におけ
るレジスタCompの値と周期150msを出力するた
めのカウント値との差分値は、周期150msのカウン
ト値をC150 とすると、(RAM(150ms基準ST
ART時刻)+C150 )−(RAM(150ms基準S
TART時刻)+C100 )=C50であって、最大カウン
ト値Cmを超える値とはならない。
In the fourth interrupt processing, the counter CINT is 3, so "NO" is determined in the determination steps S1, S8 and S19, and "L" is set in the pulse generation circuit Comp ← RAM (150 ms standard). ST
(ART time) + C150 "processing proceeds to step S26. In the processing step S26, the pulse generation circuit 2
Set level "high" to 5. Further, the difference value between the value of the register Comp and the count value for outputting the cycle of 150 ms at this time is (RAM (150 ms standard ST
(ART time) + C150)-(RAM (150 ms standard S
TART time) + C100) = C50, and the value does not exceed the maximum count value Cm.

【0046】従って、Comp+C50をレジスタCom
pに設定すれば良いわけだが、後述するパルス幅Twの
値による場合分けされたフローについても一括してここ
で設定するため、RAM20に記憶された150ms基
準START時刻を読出して、それにC150 を加算した
ものをレジスタCompに設定する。この処理は、上述
したように、カウント値で表すとRAM(150ms基
準START時刻)+C100 +C50=RAM(150m
s基準START時刻)+C150 であるからComp+
C50という表現と等価であり、図10の横軸(時間)で
みても、Tx+100+50=Tx+150であって両
者は同じ時間を示す。そして、次の「CINT←0」の
処理ステップS27において、カウンタCINTを0ク
リアすると、割込み処理を抜けてメインルーチンにリタ
ーンする。
Therefore, Comp + C50 is set to the register Com.
It is only necessary to set it to p, but to set the flow divided into cases according to the value of the pulse width Tw, which will be described later, collectively, read the 150 ms reference START time stored in the RAM 20 and add C150 to it. This is set in the register Comp. As described above, this process is represented by a count value RAM (150 ms reference START time) + C100 + C50 = RAM (150 m
s reference START time) + C150, so Comp +
This is equivalent to the expression C50, and even when viewed along the horizontal axis (time) in FIG. 10, Tx + 100 + 50 = Tx + 150, and both indicate the same time. Then, when the counter CINT is cleared to 0 in the next processing step S27 of "CINT ← 0", the interrupt processing is terminated and the process returns to the main routine.

【0047】次に、パルス幅Twが、50ms<Tw≦
100msの範囲にある場合の処理について図11を参
照して説明する。この場合は、最初の割込み処理で判断
ステップS4において「NO」と判断すると、「50m
s<Tw≦100ms?」の判断ステップS15に移行
する。そして、判断ステップS15において「YES」
と判断されるので、「パルス発生回路に”L”設定 C
omp←Comp+Cw/2」の処理ステップS6に移
行して、パルス周期が100msの場合と同様に処理さ
れる。
Next, the pulse width Tw is 50 ms <Tw ≦
Processing in the case of being in the range of 100 ms will be described with reference to FIG. In this case, if "NO" is determined in the determination step S4 in the first interruption process, "50 m
s <Tw ≦ 100 ms? The determination step S <b> 15 is performed. Then, in determination step S15, "YES"
Since it is determined that "L" is set in the pulse generation circuit C
The process proceeds to the processing step S6 of "omp ← Comp + Cw / 2" and is processed in the same manner as when the pulse period is 100 ms.

【0048】2回目の割込み処理では、判断ステップS
9において「NO」と判断すると、「50ms<Tw≦
100ms?」の判断ステップS17に移行する。そし
て、判断ステップS17において「YES」と判断する
ので、「パルス発生回路に”H”設定 Comp←Co
mp+Cw/2」の処理ステップS11に移行して、や
はり、パルス周期が100msの場合と同様に処理され
る。
In the second interruption process, the judgment step S
When it is judged as “NO” in 9, “50 ms <Tw ≦
100ms? The determination step S17 is performed. Then, since "YES" is determined in the determination step S17, "H" is set in the pulse generation circuit Comp ← Co
mp + Cw / 2 ”, the process proceeds to step S11, and the same process is performed as when the pulse period is 100 ms.

【0049】3回目の割込み処理においては、判断ステ
ップS20において「NO」と判断すると、「50ms
<Tw≦100ms?」の判断ステップS22に移行す
る。そして、判断ステップS22において「YES」と
判断するので、「パルス発生回路に”H”設定 Com
p←Comp+(C150 −Cw)/2」の処理ステップ
S23に移行する。この時点におけるレジスタComp
の値と周期150msとの差分値は、(RAM(150
ms基準START時刻)+C150 )−(RAM(15
0ms基準START時刻)+Cw)=C150 −Cwで
あり、カウント値Cwの値によっては最大カウント値C
mを超える可能性がある。従って、この値をレジスタC
ompの現在値にそのまま加算すると、図11中のa点
に来るべき時刻がb点になってしまい、正確な時間設定
が行われなくなるおそれがある。
In the third interrupt processing, if "NO" is determined in the determination step S20, "50 ms" is returned.
<Tw ≦ 100 ms? The determination step S22 is performed. Then, since "YES" is determined in the determination step S22, "pulse generation circuit is set to" H "Com
p ← Comp + (C150-Cw) / 2 "processing step S23. Register Comp at this point
The difference between the value of and the cycle of 150 ms is (RAM (150
ms reference START time) + C150)-(RAM (15
0 ms reference START time) + Cw) = C150-Cw, and depending on the value of the count value Cw, the maximum count value C
There is a possibility of exceeding m. Therefore, this value is
If it is added to the current value of omp as it is, the time at which point a in FIG. 11 should arrive is point b, and accurate time setting may not be performed.

【0050】よって、処理ステップS23においては、
パルス発生回路25にレベル“ハイ“を設定した後、前
記差分値を2で除した値をレジスタCompの現在値に
加算して再びレジスタCompに設定し、その値を比較
器23に設定する。そして、ステップS25に移行して
カウンタCINTをインクリメントすると、割込み処理
を抜けてメインルーチンにリターンする。
Therefore, in the processing step S23,
After the level "high" is set in the pulse generation circuit 25, the value obtained by dividing the difference value by 2 is added to the current value of the register Comp and set in the register Comp again, and the value is set in the comparator 23. Then, when the process proceeds to step S25 and the counter CINT is incremented, the interrupt process is exited and the process returns to the main routine.

【0051】4回目の割込み処理においては、その時点
で駆動周期150msを出力するために比較器23に設
定すべき残値は、最大カウント値Cm以内なので、処理
ステップS26においてパルス幅Twが50ms以下の
場合と同様の処理を行う。
In the fourth interrupt processing, the remaining value to be set in the comparator 23 to output the driving cycle of 150 ms at that time is within the maximum count value Cm, so that the pulse width Tw is 50 ms or less in the processing step S26. The same processing as in the case of is performed.

【0052】次に、パルス幅Twが100msを超える
場合について図12を参照して説明する。最初の割込み
処理においては、「50ms<Tw≦100ms?」の
判断ステップS15において「NO」と判断されるの
で、「パルス発生回路に”L”設定 Comp←Com
p+C50」の処理ステップS16に移行する。処理ステ
ップS16においては、パルス発生回路25にレベル”
ロー”を設定すると共に、FRT24の現在値に循環周
期Tm以内の値例えばC50を加算してレジスタComp
にセットする。そして、ステップS7においてカウンタ
CINTをインクリメントすると、割込み処理を抜けて
メインルーチンにリターンする。
Next, a case where the pulse width Tw exceeds 100 ms will be described with reference to FIG. In the first interrupt process, since “NO” is determined in the determination step S15 of “50 ms <Tw ≦ 100 ms?”, “Pulse generator circuit is set to“ L ”Comp ← Com
p + C50 "processing step S16. In the processing step S16, the pulse generation circuit 25 receives the level "
"Low" is set, and a value within the cycle period Tm, for example, C50 is added to the current value of the FRT 24 to register Comp.
Set to. Then, when the counter CINT is incremented in step S7, the interrupt process is terminated and the process returns to the main routine.

【0053】2回目の割込み処理においては、判断ステ
ップS17において「NO」と判断されるので、「パル
ス発生回路に”L”設定 Comp←Comp+(Cw
−C50)/2」の処理ステップS18に移行する。処理
ステップS18においては、パルス幅のカウント値Cw
からカウント値C50を減じた値は、最大カウント値Cm
を超える可能性がある。
In the second interrupt processing, since "NO" is determined in the determination step S17, "pulse generator circuit is set to" L "Comp ← Comp + (Cw
-C50) / 2 "processing step S18. In the processing step S18, the pulse width count value Cw
The value obtained by subtracting the count value C50 from is the maximum count value Cm.
May exceed.

【0054】従って、ステップS18では、パルス発生
回路25にレベル”ロー”を設定すると共に、レジスタ
Compの現在値にカウント値Cwとカウント値C50と
の差分値を2で除した値を加えてレジスタCompに再
設定を行い、そのレジスタCompの値を比較器23に
設定する。そして、ステップS12においてカウンタC
INTの値をインクリメントすると、割込み処理を抜け
てメインルーチンにリターンする。
Therefore, in step S18, the level "low" is set in the pulse generation circuit 25, and the value obtained by dividing the difference value between the count value Cw and the count value C50 by 2 is added to the current value of the register Comp and the register is added. The Comp is reset, and the value of the register Comp is set in the comparator 23. Then, in step S12, the counter C
When the INT value is incremented, the interrupt processing is terminated and the process returns to the main routine.

【0055】3回目の割込み処理においては、「50m
s<Tw≦100ms?」の判断ステップS22におい
て「NO」と判断されるので、「パルス発生回路に”
H”設定 Comp←Comp+(Cw−C50)/2」
の処理ステップS24に移行する。処理ステップS24
においては、パルス発生回路25にレベル”ハイ”を設
定すると共に、ステップS18でレジスタCompに加
算したものと同じ値(Cw−C50)/2をレジスタCo
mpの現在値に加算してレジスタCompに再びセット
する。そして、ステップS25においてカウンタCIN
Tをインクリメントすると、割込み処理を抜けてメイン
ルーチンにリターンする。
In the third interruption process, "50 m
s <Tw ≦ 100 ms? Since it is judged as "NO" in the judgment step S22 of "
H "setting Comp ← Comp + (Cw-C50) / 2"
The processing shifts to the processing step S24. Processing step S24
, The level "high" is set in the pulse generation circuit 25, and the same value (Cw-C50) / 2 added to the register Comp in step S18 is set in the register Co.
It is added to the current value of mp and set again in register Comp. Then, in step S25, the counter CIN
When T is incremented, the interrupt process is terminated and the process returns to the main routine.

【0056】4回目の割込み処理においては、その時点
で駆動周期150msを出力するために比較器23に設
定すべき残値は最大カウント値Cm以内なので、処理ス
テップS26においてパルス幅Twが50ms以下の場
合,及びパルス幅Twが50ms<Tw≦100msと
同様の処理を行う。
In the fourth interrupt processing, the remaining value to be set in the comparator 23 to output the driving cycle of 150 ms at that time is within the maximum count value Cm, so that the pulse width Tw is 50 ms or less in the processing step S26. In the case, and the pulse width Tw is 50 ms <Tw ≦ 100 ms, the same processing is performed.

【0057】以上のように本実施例によれば、比較器2
3に設定された値とFRT24のカウント値とが一致す
ると比較器23より出力される一致信号を基に、FRT
24の循環周期Tmを超える周期のパルス信号を発生さ
せる場合に、CPU18は、割込み信号として入力され
るその一致信号の出力間隔が循環周期Tm以下であって
かつその出力回数が最小となるように、パルス信号の周
期を分割して比較器23に設定する値を決定するように
した。従って、従来とは異なり、CPUに対して単位時
間毎に割込みを入れて、その割込みが入る毎に比較器に
対して値を設定し直すような繁雑な処理を行う必要がな
く、パルス信号の発生のために要するCPUの処理時間
を最小にすることができる。
As described above, according to this embodiment, the comparator 2
When the value set to 3 and the count value of the FRT 24 match, the FRT based on the match signal output from the comparator 23.
When generating a pulse signal having a cycle exceeding 24 circulation cycles Tm, the CPU 18 sets the output interval of the coincidence signal input as an interrupt signal to be less than or equal to the circulation cycle Tm and minimizes the number of outputs. The pulse signal period is divided to determine the value to be set in the comparator 23. Therefore, unlike the prior art, it is not necessary to perform a complicated process such that an interrupt is input to the CPU every unit time and a value is reset to the comparator each time the interrupt is input. It is possible to minimize the CPU processing time required for the generation.

【0058】尚、本発明は上記しかつ図面に記載した実
施例にのみ限定されるものではなく、次のような変形が
可能である。FRT24及び比較器23のビット幅を1
6ビットとしたが、これより多く若しくは少なくても良
い。FRT24に入力されるクロック信号の周期を1μ
sとしたが、これより大きく又は小さくても良い。
The present invention is not limited to the embodiments described above and shown in the drawings, but the following modifications are possible. Set the bit width of the FRT 24 and the comparator 23 to 1
Although it is set to 6 bits, more or less bits may be used. Set the cycle of the clock signal input to the FRT 24 to 1μ
However, it may be larger or smaller than this.

【0059】パルス幅Twの値による場合分けの範囲の
上限を、判断ステップS4及びS9において50msと
したが、循環周期Tm以下でTm−Twを超える値であ
れば良い。同様に、判断ステップS15,S17及びS
22において、場合分けの範囲の下限を50ms,上限
を100msとしたが、下限は循環周期Tm以下でTm
−Twを超える値であれば良く、上限は2Tm以下で2
Tm−Twを超える値であれば良い。また、それに伴っ
て、レジスタCompに値を設定する処理ステップにお
いて設定する値をC50で表しているカウント値も、最大
カウント値Cm以下でCm−Cwを超える値であれば良
く、C100 で表しているカウント値も、2Cm以下で2
Cm−Cwを超える値であれば良い。
Although the upper limit of the range of cases depending on the value of the pulse width Tw is set to 50 ms in the determination steps S4 and S9, it may be any value that is less than the circulation period Tm and exceeds Tm-Tw. Similarly, determination steps S15, S17 and S
In Fig. 22, the lower limit of the range of cases is set to 50 ms and the upper limit is set to 100 ms.
Any value that exceeds −Tw is acceptable, and the upper limit is 2 Tm or less and 2
Any value may be used as long as it exceeds Tm-Tw. Along with that, the count value represented by C50 in the process step of setting the value in the register Comp may be a value equal to or less than the maximum count value Cm and larger than Cm-Cw, and represented by C100. The counted value is 2Cm or less and 2
Any value may be used as long as it exceeds Cm-Cw.

【0060】駆動周期Tが100msの場合と150m
sの場合を示したが、これに限らず、駆動周期Tが循環
周期Tmの3倍以上の場合でも、それに応じてフローを
追加すれば適宜実施することができる。開閉用パルス幅
信号に基いてパージバルブ14の制御を行うようにした
が、アイドルアップバルブや、EGR(エギゾースト・
ガス・リサーキュレーション)バルブなどの制御を行っ
ても良い。また、エンジンのバルブ制御に限らず、要は
ある周期の期間信号を必要とするものであれば、適宜応
用が可能である。
When the driving cycle T is 100 ms and 150 m
Although the case of s is shown, the present invention is not limited to this, and even if the driving cycle T is three times or more of the circulation cycle Tm, it can be appropriately implemented by adding a flow accordingly. Although the purge valve 14 is controlled based on the opening / closing pulse width signal, the idle up valve and the EGR (exhaust
A gas recirculation valve or the like may be controlled. Further, the invention is not limited to the valve control of the engine but can be applied as appropriate as long as it requires a signal for a period of a certain cycle.

【0061】[0061]

【発明の効果】本発明は以上説明した通りであるので、
以下の効果を奏する。請求項1記載の期間信号発生装置
によれば、制御手段は、発生させようとする期間信号の
周期がカウンタの循環周期を超える場合には、一致信号
の出力間隔が循環周期以下であって且つその出力回数が
最小となるように期間信号の周期を分割して比較器に設
定する値を決定するので、制御手段の処理の負担を最小
にして期間信号を発生させることができる。
Since the present invention is as described above,
The following effects are obtained. According to the period signal generating device of claim 1, the control means, when the period of the period signal to be generated exceeds the circulation period of the counter, the output interval of the coincidence signal is equal to or less than the circulation period, and Since the period signal is divided so that the number of outputs is minimized and the value to be set in the comparator is determined, it is possible to generate the period signal while minimizing the processing load of the control means.

【0062】この場合、期間信号発生装置は、内燃機関
の制御に関連して使用するようにすれば、各種バルブの
制御などに有効に応用することができる(請求項2)。
In this case, if the period signal generator is used in connection with the control of the internal combustion engine, it can be effectively applied to the control of various valves (claim 2).

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

【図1】本発明の期間信号発生装置の電気的構成を示す
ブロック図
FIG. 1 is a block diagram showing an electrical configuration of a period signal generator of the present invention.

【図2】内燃機関の簡略化した構造図FIG. 2 is a simplified structural diagram of an internal combustion engine.

【図3】制御装置の電気的構成を示すブロック図FIG. 3 is a block diagram showing an electrical configuration of a control device.

【図4】パージバルブ制御処理の制御内容のフローチャ
ート
FIG. 4 is a flowchart of control contents of purge valve control processing.

【図5】開閉用パルス幅信号のタイミングチャートFIG. 5 is a timing chart of an opening / closing pulse width signal.

【図6】駆動周期100msの場合の一致信号割込み処
理の図4相当図
FIG. 6 is a diagram corresponding to FIG. 4 of the coincidence signal interrupt processing when the driving cycle is 100 ms.

【図7】駆動周期100msでパルス幅Twが0<Tw
≦50msの場合の、FRTのカウント値と周期との関
係を示す図
FIG. 7 shows a pulse width Tw of 0 <Tw in a driving cycle of 100 ms.
The figure which shows the relationship between the count value of FRT and a period in case of <= 50ms

【図8】駆動周期100msでパルス幅Twが50<T
w≦100msの場合の、図7相当図
FIG. 8 shows a pulse width Tw of 50 <T in a driving cycle of 100 ms.
FIG. 7 equivalent diagram when w ≦ 100 ms

【図9】駆動周期150msの場合の図6相当図FIG. 9 is a diagram corresponding to FIG. 6 when the driving cycle is 150 ms.

【図10】駆動周期150msでパルス幅Twが0<T
w≦50msの場合の図7相当図
FIG. 10 shows a pulse width Tw of 0 <T in a driving cycle of 150 ms.
FIG. 7 equivalent diagram when w ≦ 50 ms

【図11】駆動周期150msでパルス幅Twが50<
Tw≦100msの場合の図7相当図
FIG. 11 shows a pulse width Tw of 50 <with a driving cycle of 150 ms.
FIG. 7 equivalent diagram when Tw ≦ 100 ms

【図12】駆動周期150msでパルス幅Twが100
ms<Twの場合の図7相当図
FIG. 12 shows a pulse width Tw of 100 at a driving cycle of 150 ms.
Fig. 7 equivalent diagram when ms <Tw

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

1はエンジン本体、14はパージバルブ、18はCPU
(制御手段)、23は比較器、24はフリーラン・タイ
マ(カウンタ)、25はパルス発生回路、27は期間信
号発生装置を示す。
1 is an engine body, 14 is a purge valve, 18 is a CPU
(Control means), 23 is a comparator, 24 is a free-run timer (counter), 25 is a pulse generator, and 27 is a period signal generator.

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 入力されるクロック信号のパルス数を一
定の計数範囲で循環的に計数するカウンタと、 任意の値に設定可能で、その設定された値と前記カウン
タの計数値とを比較して、一致すると一致信号を出力す
る比較器と、 割込み信号として与えられる前記一致信号に基づいて期
間信号を発生させるように設けられ、発生させようとす
る期間信号の周期が前記カウンタの循環周期を超える場
合には、前記一致信号の出力間隔が循環周期以下であっ
て且つその出力回数が最小となるように、期間信号の周
期を分割して前記比較器に設定する値を決定する制御手
段とを具備したことを特徴とする期間信号発生装置。
1. A counter that cyclically counts the number of pulses of an input clock signal within a certain counting range, and a counter that can be set to an arbitrary value and that set value is compared with the count value of the counter. And a comparator which outputs a coincidence signal when they coincide with each other, and a period signal which is provided so as to generate a period signal based on the coincidence signal given as an interrupt signal. If it exceeds, the control means for dividing the cycle of the period signal so as to determine the value to be set in the comparator so that the output interval of the coincidence signal is equal to or less than the circulation cycle and the number of times of output is minimized. A period signal generator comprising:
【請求項2】 内燃機関の制御に関連して使用されるこ
とを特徴とする請求項1記載の期間信号発生装置。
2. The period signal generator according to claim 1, which is used in connection with the control of an internal combustion engine.
JP6303369A 1994-12-07 1994-12-07 Period signal generator Pending JPH08162933A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6303369A JPH08162933A (en) 1994-12-07 1994-12-07 Period signal generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6303369A JPH08162933A (en) 1994-12-07 1994-12-07 Period signal generator

Publications (1)

Publication Number Publication Date
JPH08162933A true JPH08162933A (en) 1996-06-21

Family

ID=17920172

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6303369A Pending JPH08162933A (en) 1994-12-07 1994-12-07 Period signal generator

Country Status (1)

Country Link
JP (1) JPH08162933A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100347557B1 (en) * 1998-09-17 2002-08-07 닛본 덴기 가부시끼가이샤 Pulse signal generating apparatus and pulse signal generating method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100347557B1 (en) * 1998-09-17 2002-08-07 닛본 덴기 가부시끼가이샤 Pulse signal generating apparatus and pulse signal generating method
US6504876B1 (en) 1998-09-17 2003-01-07 Nec Corporation Pulse signal generating apparatus and pulse signal generating method

Similar Documents

Publication Publication Date Title
US4310888A (en) Technique for controlling the starting operation of an electronic engine control apparatus
US4242728A (en) Input/output electronic for microprocessor-based engine control system
EP0024733A2 (en) Method and system for operating an internal combustion engine at maximum torque under varying operating conditions
US6240358B1 (en) Task control method with reduced stacked memory requirement
JPH06103005B2 (en) Electronically controlled fuel injection control method
US4515131A (en) Fuel-injection control in an internal-combustion engine
EP0017218B1 (en) Method of electronically controlling internal combustion engines
US4408279A (en) Method and apparatus for adjusting the supply of fuel to an internal combustion engine for an acceleration condition
JPS6315465B2 (en)
US4367530A (en) Control apparatus for an internal combustion engine
JPH0120301B2 (en)
JPS5937236A (en) Method of controlling fuel injection timing
JPH07197877A (en) Control device for internal combustion engine
JPS63176638A (en) Fuel injection quantity controller for internal combustion engine
JPH0723582Y2 (en) Ignition timing control device for internal combustion engine
EP0645532A2 (en) Fuel injection control system for an internal combustion engine
JPH08162933A (en) Period signal generator
US4561056A (en) Electronic control apparatus for internal combustion engine
JP2001271690A (en) Fuel supply control device for internal combustion engine
JP2591008B2 (en) Electronic distribution ignition system with fail-safe function
JP2022108110A (en) Engine control device
JPH0223268A (en) Ignition timing control device for internal combustion engine
JPH11351112A (en) Ignition timing controller for on-vehicle internal combustion engine
JP3173375B2 (en) Combustion control device for internal combustion engine
KR840000710B1 (en) Electronic engine control apparatus