JPH0627261A - Digital controller - Google Patents

Digital controller

Info

Publication number
JPH0627261A
JPH0627261A JP4073643A JP7364392A JPH0627261A JP H0627261 A JPH0627261 A JP H0627261A JP 4073643 A JP4073643 A JP 4073643A JP 7364392 A JP7364392 A JP 7364392A JP H0627261 A JPH0627261 A JP H0627261A
Authority
JP
Japan
Prior art keywords
value
memory area
time
area
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.)
Granted
Application number
JP4073643A
Other languages
Japanese (ja)
Other versions
JPH0731254B2 (en
Inventor
Sadao Takase
貞雄 高瀬
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.)
Nissan Motor Co Ltd
Original Assignee
Nissan Motor 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 Nissan Motor Co Ltd filed Critical Nissan Motor Co Ltd
Priority to JP4073643A priority Critical patent/JPH0731254B2/en
Publication of JPH0627261A publication Critical patent/JPH0627261A/en
Publication of JPH0731254B2 publication Critical patent/JPH0731254B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Measurement Of Unknown Time Intervals (AREA)
  • Debugging And Monitoring (AREA)
  • Microcomputers (AREA)

Abstract

PURPOSE:To simplify a digital controller using a programmable timer and, at the same time, to solve the problem of increasing number of interruptions, etc., resulting from the operations of the timer. CONSTITUTION:The first memory area M1 in a memory 5 is used as a free running counter by advancing the content of the area M1 in steps whenever an interruption request is made so as to actuate a program for controlling equipment to be controlled. Then, by storing the value of the area M1 at a prescribed point of time while the value is continuously counted in the second memory area M2 and comparing the stored value with the continuously changing value of the area M1, the time elapsed from the point of time at which the value of the area M1 is stored in the area M2 can be measured. In addition, when the measured value is compared with a prescribed value, whether or not the time elapsed has reached a prescribed set value can be detected.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はマイクロコンピュータを
用いたディジタル制御装置に関し、特に経過時間の計測
機能(いわゆるプログラマブル・タイマ)に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a digital controller using a microcomputer, and more particularly to a function of measuring elapsed time (so-called programmable timer).

【0002】[0002]

【従来の技術】マイクロコンピュータを用いたディジタ
ル制御装置、例えば内燃機関の制御装置においては、或
る時点からの経過時間に応じて制御内容(燃料噴射量
等)を切り換えることが頻繁に行なわれる。そのため経
過時間を計測する手段が必要であるが、従来は例えば図
3に示すごときタイマ(計時手段)が用いられていた。
図3において、1はマイクロコンピュータの中央演算装
置(以下CPUと記す)、2は適当なビットのアドレッ
シング可能なラッチ、3は同ビットのアドレッシング可
能なカウンタ、4はデータバスである。通常、ラッチ2
へ書き込み動作を行なうことによってリセットすると共
にカウンタ3を所定の値にプリセットし、その時点から
カウンタ3は、クロックパルスS1が入力するごとにプ
リセットされた内容からクロックパルス数を順次減算
し、内容が0になったとき、すなわちクロックパルス数
がプリセットした所定値に達したとき信号を発生する。
この信号を用いて適当なインタラプトフラグをセット
し、CPU1に対して割込みをかけるように構成されて
いる。
2. Description of the Related Art In a digital control device using a microcomputer, for example, a control device for an internal combustion engine, control contents (fuel injection amount, etc.) are frequently switched according to the elapsed time from a certain time. Therefore, a means for measuring the elapsed time is required, but in the past, for example, a timer (time measuring means) as shown in FIG. 3 has been used.
In FIG. 3, 1 is a central processing unit (hereinafter referred to as CPU) of a microcomputer, 2 is a latch capable of addressing an appropriate bit, 3 is a counter capable of addressing the same bit, and 4 is a data bus. Usually latch 2
The counter 3 is reset by performing a write operation to the counter 3 and preset to a predetermined value. From that point, the counter 3 sequentially subtracts the number of clock pulses from the preset content every time the clock pulse S 1 is input, When 0, that is, when the number of clock pulses reaches a preset predetermined value, a signal is generated.
This signal is used to set an appropriate interrupt flag and interrupt the CPU 1.

【0003】[0003]

【発明が解決しようとする課題】しかし上記のごとき従
来のタイマにおいては、タイマ動作の数及び動作モード
に対応した数だけのラッチ及びカウンタが必要となるの
で、装置が複雑で高価となり、また計測時間を割込み動
作によってCPUに入力するため、タイマ動作を多く用
いる場合には割込み回数が多くなって割込み処理時間が
増加し、他の演算処理に影響を生じるという問題があ
る。
However, in the conventional timer as described above, the number of latches and counters corresponding to the number of timer operations and operation modes is required, so that the apparatus is complicated and expensive, and the measurement is difficult. Since the time is input to the CPU by the interrupt operation, when many timer operations are used, there is a problem that the number of interrupts increases and the interrupt processing time increases, which affects other arithmetic processing.

【0004】本発明は上記のごとき従来技術の問題を解
決するためになされたものであり、装置を簡略化し、か
つタイマ動作に伴う割込み回数の増加等の問題を解消し
たディジタル制御装置を提供することを目的とする。
The present invention has been made in order to solve the problems of the prior art as described above, and provides a digital controller which simplifies the device and solves the problems such as the increase in the number of interrupts due to the timer operation. The purpose is to

【0005】[0005]

【課題を解決するための手段】上記の目的を達成するた
め、本発明においては、特許請求の範囲に記載するよう
に構成している。すなわち、本発明においては、被制御
機器制御用のプログラムを起動させる割込みが発生する
毎に記憶装置の第1のメモリエリアの内容を歩進させ、
所定の時点における第1のメモリエリアの内容を第2の
メモリエリアに記憶させ、第1のメモリエリアの内容と
第2のメモリエリアの内容との差により、上記第2のメ
モリエリアに記憶させた時点からの上記割込みによって
起動されるプログラムの実行回数を計測するように構成
している。
In order to achieve the above object, the present invention is constructed as described in the claims. That is, in the present invention, the contents of the first memory area of the storage device are incremented each time an interrupt for activating a controlled device control program occurs.
The contents of the first memory area at a predetermined time are stored in the second memory area, and the contents of the first memory area and the contents of the second memory area are stored in the second memory area according to the difference between the contents. It is configured to measure the number of executions of the program started by the interrupt from the point of time.

【0006】[0006]

【作用】上記のように本発明においては、第1のメモリ
エリア内容を、割込み要求があるごとに順次歩進させ、
このメモリエリアをフリーランニングカウンタとして用
いる。そして、継続的に計数している第1のメモリエリ
アの所定時点の値を第2のメモリエリアに記憶させ、そ
の記憶させた値と継続して変化している第1のメモリエ
リアの値とを比較することにより、第2のメモリエリア
に記憶させた時点からの経過時間を計測することが出来
る。また上記の計測値と所定の値とを比較すれば、経過
時間が所定の設定値に達したか否かを検知することが出
来る。
As described above, in the present invention, the contents of the first memory area are sequentially stepped up each time there is an interrupt request,
This memory area is used as a free running counter. Then, the value of the first memory area that is being continuously counted at a predetermined time point is stored in the second memory area, and the stored value and the value of the first memory area that is continuously changing are stored. By comparing, it is possible to measure the elapsed time from the time of storing in the second memory area. Further, by comparing the above measured value with a predetermined value, it is possible to detect whether or not the elapsed time has reached a predetermined set value.

【0007】[0007]

【実施例】図1は本発明の一実施例のブロック図であ
る。図1において、5はメモリであり、M1〜Mnはそれ
ぞれタイマ動作に用いるメモリエリアである。また6は
クロックパルス発生器である。クロックパルス発生器6
は、所定時間毎(例えば10ms毎)にクロックパルスS
2を出力し、このクロックパルスS2によってCPU1へ
割込み要求を発生する。なお、この割込み要求は演算開
始用の割込みであって通常の演算過程で発生するもので
ある。CPU1は上記の割込み要求に応じて演算ルーチ
ンを実行するが、この演算ルーチンの内において計時動
作を行なわせる。まず、メモリ5内の所定のメモリエリ
ア(例えばM1)内容を、割込み要求があるごとに順次
歩進させ、このメモリエリアM1をフリーランニングカ
ウンタとして用いる。次に、継続的に計数しているメモ
リエリアM1の所定時点の値を他のメモリエリア(例え
ばM2)に記憶させ、その記憶させた値と継続して変化
しているメモリエリアM1の値とを比較することによ
り、メモリエリアM2に記憶させた時点からの経過時間
を計測することが出来る。また上記の計測値と所定の値
とを比較すれば、経過時間が所定の設定値に達したか否
かを検知することが出来る。上記の構成によれば、計時
動作が全てマイクロコンピュータ内部で行なわれるの
で、メモリエリアM1〜Mnの個数を必要なタイマ機能の
数だけ用意すれば良いことになり、構成を大幅に簡略化
することが出来る。
FIG. 1 is a block diagram of an embodiment of the present invention. In FIG. 1, 5 is a memory, and M 1 to M n are memory areas used for timer operations. Reference numeral 6 is a clock pulse generator. Clock pulse generator 6
Is a clock pulse S every predetermined time (eg, every 10 ms)
2 is output, and an interrupt request is generated to the CPU 1 by this clock pulse S 2 . It should be noted that this interrupt request is an interrupt for starting a calculation and is generated in a normal calculation process. The CPU 1 executes an arithmetic routine in response to the above interrupt request, and causes the time counting operation to be performed within this arithmetic routine. First, the contents of a predetermined memory area (for example, M 1 ) in the memory 5 are sequentially stepped up each time there is an interrupt request, and this memory area M 1 is used as a free running counter. Next, the value at a predetermined time point in the memory area M 1 that is continuously counted is stored in another memory area (for example, M 2 ), and the memory area M 1 that continuously changes from the stored value. By comparing with the value of, the elapsed time from the time of storing in the memory area M 2 can be measured. Further, by comparing the above measured value with a predetermined value, it is possible to detect whether or not the elapsed time has reached a predetermined set value. According to the above configuration, all the clocking operation is performed inside the microcomputer, so that it is sufficient to prepare the number of memory areas M 1 to M n by the required number of timer functions, and the configuration is greatly simplified. You can do it.

【0008】次に実際の演算内容の一実施例を図2に示
す。図2は、内燃機関の燃料噴射量の演算において、機
関始動時に所定時間(例えば3秒間)のあいだ燃料増量
を行なう場合のフローチャートである。すなわちこの場
合には、始動開始時点から3秒間経過したか否かを計測
することが必要となる。この実施例の場合には、特定の
メモリエリア、例えばメモリエリアM1をフリーランニ
ングカウンタ(所定値までカウントすると0に復帰し、
自動的に再びカウントを開始するカウンタ)として用
い、割込み要求の回数を継続的に計数させておく。図2
において、まずP1において基本燃料噴射量PW1を演算
する。次にP2において、スタータモータを作動させる
スタータスイッチがONかOFFかを判定し、OFFの
場合すなわち始動中でない場合には、P3に行ってスタ
ートフラグ(始動開始時点を検出するためのフラグ)を
0にしたのち直ちにENDへ行く。一方、P2がONの
場合にはP4に行き、スタートフラグが1か0かを判定
する。P4においてスタートフラグが0の場合、すなわ
ち始動開始時点(スタータスイッチがONになった直
後)には、P5に行き、フリーランニングカウンタとし
て用いているメモリエリアM1の内容を他のメモリエリ
アM2に記憶させ、かつスタートフラグを1にしたのち
6に行く。したがってメモリエリアM2の内容は、始動
開始時点におけるM1の値になっている。一方、P4でス
タートフラグが1の場合、すなわち始動中の場合には直
ちにP6に行く。P6は経過時間の判定を行なうルーチン
であり、メモリエリアM1とM2との差、すなわち始動開
始時点からのフリーランニングカウンタのカウント値が
3秒以上か未満かを判定する。例えばクロックパルスS
2の周期が10msであれば、メモリエリアM1とM2との
差が300の場合に3秒に相当する。P6でYESの場
合、すなわち始動開始時点から3秒以上経過している場
合には、燃料増量を行なわずに直ちにENDへ行く。P
6がNOの場合、すなわち3秒未満の場合にはP7で所定
の燃料増量(PW2=PW1×K)を行なってからEND
へ行く。上記のように、或るメモリエリアM1をフリー
ランニングカウンタとしてその内容を一定時間毎に歩進
させ、継続的に計数しているメモリエリアM1の所定時
点の値を他のメモリエリアM2に記憶させ、その記憶さ
せた値と継続して変化しているメモリエリアM1の値と
を比較することにより、メモリエリアM2に記憶させた
時点からの経過時間を計測することが出来る。なお、カ
ウント中にフリーランニングカウンタが0に復帰した場
合は、キャリィ信号を出力させてそれまでのカウント値
を追加させる。
FIG. 2 shows an example of the actual contents of calculation. FIG. 2 is a flowchart in the case of calculating the fuel injection amount of the internal combustion engine, in the case where the fuel amount is increased for a predetermined time (for example, 3 seconds) at the time of starting the engine. That is, in this case, it is necessary to measure whether or not 3 seconds have elapsed from the start of starting. In the case of this embodiment, a specific memory area, for example, the memory area M 1 is free-running counter (when it reaches a predetermined value, it returns to 0,
It is used as a counter which automatically starts counting again, and continuously counts the number of interrupt requests. Figure 2
First, at P 1 , the basic fuel injection amount PW 1 is calculated. Next, in P 2, a starter switch for actuating the starter motor, it is determined whether ON or OFF, and if not set to OFF namely in startup, flag for detecting the start flag (the start beginning to go to P 3 ) Is set to 0, and immediately goes to END. On the other hand, when P 2 is ON, it goes to P 4 and determines whether the start flag is 1 or 0. When the start flag is 0 in P 4 , that is, at the start of starting (immediately after the starter switch is turned on), the program goes to P 5 and the content of the memory area M 1 used as the free running counter is changed to another memory area. After storing it in M 2 and setting the start flag to 1, go to P 6 . Therefore, the content of the memory area M 2 is the value of M 1 at the start of starting. On the other hand, if the start flag is 1 at P 4 , that is, if the engine is being started, the program immediately goes to P 6 . P 6 is a routine for determining the elapsed time, and it is determined whether the difference between the memory areas M 1 and M 2 , that is, the count value of the free running counter from the start of starting is 3 seconds or more or less. For example, clock pulse S
If the period of 2 is 10 ms, it corresponds to 3 seconds when the difference between the memory areas M 1 and M 2 is 300. In the case of YES in P 6 , that is, in the case where 3 seconds or more has elapsed from the start of starting, immediately go to END without increasing the fuel amount. P
If 6 is NO, that is, if it is less than 3 seconds, a predetermined fuel amount increase (PW 2 = PW 1 × K) is performed at P 7 , and then END
Go to As described above, the content of a certain memory area M 1 is used as a free-running counter to increment the content at regular time intervals, and the value of the continuously counting memory area M 1 at a predetermined time is used as another memory area M 2 is stored in, by comparing the value of the memory area M 1 is changing continuously as the value obtained by the storage, it is possible to measure the elapsed time from the time when stored in the memory area M 2. When the free running counter returns to 0 during counting, a carry signal is output and the count value up to that point is added.

【0009】[0009]

【発明の効果】以上説明したごとく本発明によれば、マ
イクロコンピュータ内の演算のみよって経過時間の計測
を行なうように構成したので、従来のように余分な割込
み要求が増加することがなく、演算処理時間を短縮する
ことが出来る。また、ラッチやカウンタ等の付加装置が
不要なので、構成が簡略で安価になる等の効果がある。
As described above, according to the present invention, since the elapsed time is measured only by the calculation in the microcomputer, the calculation does not increase the extra interrupt request as in the conventional case. The processing time can be shortened. Moreover, since an additional device such as a latch or a counter is not required, there is an effect that the configuration is simple and the cost is low.

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

【図1】本発明の一実施例のブロック図。FIG. 1 is a block diagram of an embodiment of the present invention.

【図2】本発明の演算過程を示すフローチャートの一実
施例図。
FIG. 2 is an embodiment of a flowchart showing a calculation process of the present invention.

【図3】従来装置の一例のブロック図。FIG. 3 is a block diagram of an example of a conventional device.

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

1…マイクロコンピュータの中央演算装置(CPU) 2…アドレッシング可能なラッチ 3…アドレッシング可能なカウンタ 4…データバス 5…メモリ 6…クロックパルス発生器 S1、S2…クロックパルス M1〜Mn…タイマ動作に用いるメモリエリア1 ... central processing unit of a microcomputer (CPU) 2 ... addressable latch 3 ... addressable counter 4 ... data bus 5 ... memory 6 ... clock pulse generator S 1, S 2 ... clock pulse M 1 ~M n ... Memory area used for timer operation

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】少なくとも中央演算装置と記憶装置とを備
え、上記中央演算装置に対して所定タイミング毎に割込
みを発生させ、該割込みによって起動されるプログラム
によって被制御機器を制御するディジタル制御装置にお
いて、上記の被制御機器制御用のプログラムを起動させ
る割込みが発生する毎に上記記憶装置の第1のメモリエ
リアの内容を歩進させ、所定の時点における第1のメモ
リエリアの内容を第2のメモリエリアに記憶させ、第1
のメモリエリアの内容と第2のメモリエリアの内容との
差により、上記第2のメモリエリアに記憶させた時点か
らの上記割込みによって起動されるプログラムの実行回
数を計測することを特徴とするディジタル制御装置。
1. A digital control device comprising at least a central processing unit and a storage device, wherein an interrupt is generated to said central processing unit at a predetermined timing, and a controlled device is controlled by a program activated by the interrupt. , The content of the first memory area of the storage device is incremented each time an interrupt for activating the controlled device control program is generated, and the content of the first memory area at a predetermined time is changed to the second content. Store in memory area, first
The number of executions of the program activated by the interrupt from the time when the program is stored in the second memory area is measured based on the difference between the content of the memory area and the content of the second memory area. Control device.
JP4073643A 1992-03-30 1992-03-30 Digital controller Expired - Lifetime JPH0731254B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4073643A JPH0731254B2 (en) 1992-03-30 1992-03-30 Digital controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4073643A JPH0731254B2 (en) 1992-03-30 1992-03-30 Digital controller

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP6771479A Division JPS55159183A (en) 1979-05-31 1979-05-31 Digital control unit

Publications (2)

Publication Number Publication Date
JPH0627261A true JPH0627261A (en) 1994-02-04
JPH0731254B2 JPH0731254B2 (en) 1995-04-10

Family

ID=13524181

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4073643A Expired - Lifetime JPH0731254B2 (en) 1992-03-30 1992-03-30 Digital controller

Country Status (1)

Country Link
JP (1) JPH0731254B2 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52146667A (en) * 1976-06-01 1977-12-06 Seiko Instr & Electronics Ltd Digital electronic watch

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52146667A (en) * 1976-06-01 1977-12-06 Seiko Instr & Electronics Ltd Digital electronic watch

Also Published As

Publication number Publication date
JPH0731254B2 (en) 1995-04-10

Similar Documents

Publication Publication Date Title
JPS6158841B2 (en)
JPH0797321B2 (en) Interrupt signal processing method
JPH0589261A (en) Microcomputer
JPH0627261A (en) Digital controller
JPH0844594A (en) Data processor
JPH0627260A (en) Digital controller
JPH0534474A (en) Measurement timer device
JP2773546B2 (en) Pulse generation circuit
JPH1011333A (en) Measuring instrument for cpu use rate by task
JPH0337153B2 (en)
JP2737645B2 (en) Program debug device
JP2604562B2 (en) Pulse interval measuring device
JPS6025166Y2 (en) counting device
JPH0635757A (en) Abnormality detector of cpu
JP4345200B2 (en) Programmable controller I / O unit
JP2686282B2 (en) Centralized control equipment for pachinko halls
JP3224554B2 (en) Schedule control device
JPS61153871A (en) Electronic register device
JPH05225359A (en) Microcomputer device
JPS57106926A (en) Program stole detecting system
JPH05241891A (en) Tracer circuit
JPH01243140A (en) Controller
JPS60196849A (en) Method for detecting runaway of microprocessor
JPH0619753A (en) Program development support device
JPH11102298A (en) Timer control method, and its circuit and program recording medium