JP2007193416A - Semiconductor integrated circuit - Google Patents

Semiconductor integrated circuit Download PDF

Info

Publication number
JP2007193416A
JP2007193416A JP2006008647A JP2006008647A JP2007193416A JP 2007193416 A JP2007193416 A JP 2007193416A JP 2006008647 A JP2006008647 A JP 2006008647A JP 2006008647 A JP2006008647 A JP 2006008647A JP 2007193416 A JP2007193416 A JP 2007193416A
Authority
JP
Japan
Prior art keywords
register
counter
value
timer
output
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.)
Withdrawn
Application number
JP2006008647A
Other languages
Japanese (ja)
Inventor
Yujiro Kaneko
雄次郎 金子
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.)
Renesas Technology Corp
Original Assignee
Renesas Technology Corp
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 Renesas Technology Corp filed Critical Renesas Technology Corp
Priority to JP2006008647A priority Critical patent/JP2007193416A/en
Publication of JP2007193416A publication Critical patent/JP2007193416A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Combined Controls Of Internal Combustion Engines (AREA)
  • Microcomputers (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To precisely perform pulse output even when a request for immediate pulse output is made. <P>SOLUTION: A microcomputer (1) is provided with a timer (2) and a CPU (3) for controlling the timer. The timer is provided with a counter (10), a comparison register (11), a forced comparison match control circuit (12), a comparator circuit (13) and an output control circuit (14). The counter counts a clock signal. The comparison register is made accessible by the CPU, and configured to store a prescribed value. The comparison circuit compares the counter value of the counter with the set value of the register. When a forced comparison match request flag FG is set by the CPU, the forced comparison match control circuit loads the counter value of the counter to a comparison register, and makes the comparator circuit output a matching signal (17) for operating the edge change of a timer output signal. The output control circuit operates the edge change of a timer output signal (20) according to the matching signal. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、タイマを備えた半導体集積回路に関し、例えば自動車等のエンジン制御用のマイクロコンピュータに適用して有効な技術に関する。   The present invention relates to a semiconductor integrated circuit provided with a timer, and relates to a technique that is effective when applied to an engine control microcomputer such as an automobile.

例えばエンジン制御用のマイクロコンピュータは、タイマで生成されるパルス信号を、エンジンの吸気管または燃焼室に燃料を噴射するインジェクタに出力して、エンジン制御を行う。従来のタイマは、カウンタ、コンペアレジスタ、比較回路及び出力制御回路を備えている。比較回路は、カウンタのカウンタ値とコンペアレジスタの設定値を比較して、これらの値が一致すると(以下、コンペアマッチと記す)、一致信号を生成して、出力制御回路に出力する。出力制御回路は、マイクロコンピュータの中央処理装置(CPU)によって設定可能であり、例えば最初のコンペアマッチで出力信号をローレベルからハイレベルに変化させ、次のコンペアマッチでハイレベルからローレベルに変化させるように設定することで、一致信号に応じたエッジ変化を可能とする。   For example, a microcomputer for engine control outputs a pulse signal generated by a timer to an injector that injects fuel into an intake pipe or a combustion chamber of the engine to perform engine control. A conventional timer includes a counter, a compare register, a comparison circuit, and an output control circuit. The comparison circuit compares the counter value of the counter with the set value of the compare register, and if these values match (hereinafter referred to as a compare match), it generates a match signal and outputs it to the output control circuit. The output control circuit can be set by the central processing unit (CPU) of the microcomputer. For example, the output signal is changed from the low level to the high level at the first compare match, and is changed from the high level to the low level at the next compare match. By setting so as to cause the edge to change, the edge can be changed according to the coincidence signal.

コンペアレジスタは、CPUによって設定可能であり、最初のコンペアマッチが発生するまでの時間に相当する値が設定され、最初のコンペアマッチが発生した後に、次のコンペアマッチが発生するまでの時間、即ち、パルス幅に相当する値が加算された値が設定される。このようにして、従来のタイマを備えたマイクロコンピュータは、所定のパルス幅を有するパルス信号を所定のタイミングで出力可能である。特許文献1には、カウンタとタイミングレジスタの内容を比較し、一致した場合に信号を出力するコンペアマッチレジスタを備えたPWM(Pulse Width Modulation)パルス発生装置の記載がある。このPWMパルス発生装置では、コンペアマッチレジスタの出力信号に応じた所定のパルスパターンを発生する。   The compare register can be set by the CPU, and a value corresponding to the time until the first compare match occurs is set. After the first compare match occurs, the time until the next compare match occurs, that is, A value obtained by adding a value corresponding to the pulse width is set. In this way, a microcomputer equipped with a conventional timer can output a pulse signal having a predetermined pulse width at a predetermined timing. Patent Document 1 describes a PWM (Pulse Width Modulation) pulse generator that includes a compare match register that compares the contents of a counter and a timing register and outputs a signal when they match. This PWM pulse generator generates a predetermined pulse pattern according to the output signal of the compare match register.

特開平8−19264号公報JP-A-8-19264

本発明者は、コンペアマッチが発生するまでの時間が設定された後に、例えば運転者がアクセルを踏み込み、インジェクタに対する早急なパルス出力が要求された場合に、パルス出力を効率的に行う手段について検討した。従来のタイマを備えたマイクロコンピュータでは、CPUが、早急なパルス出力が要求された時のカウンタ値をタイマから読出し、読出したカウンタ値に「2」を加算し、加算結果をコンペアレジスタに書込む処理を行う。読出したカウンタ値に「2」を加算する理由は、例えば、仮に「1」だけ加算すると、CPUの上記処理が終了する前に、カウンタがカウントアップされ、カウンタ値がコンペアレジスタの設定値を上回ってしまう可能性があるからである。これでは、カウンタがオーバーフローして、再び0からカウントアップされるまで、コンペアマッチを発生させることができない。   The present inventor has considered a means for efficiently performing pulse output when, for example, the driver depresses the accelerator and a quick pulse output is requested to the injector after the time until the compare match occurs is set. did. In a microcomputer equipped with a conventional timer, the CPU reads the counter value when an immediate pulse output is requested from the timer, adds “2” to the read counter value, and writes the addition result to the compare register. Process. The reason for adding “2” to the read counter value is, for example, if only “1” is added, the counter is counted up before the above processing of the CPU ends, and the counter value exceeds the set value of the compare register. This is because there is a possibility that it will end up. In this case, a compare match cannot be generated until the counter overflows and counts up again from zero.

このように、上記マイクロコンピュータでは、CPUは、いつ発生するか予測できない早急なパルス出力の要求に対応して、上記処理を行う必要があるから、コンペアマッチが発生するまでの時間は待機しなければならず、効率が低下してしまう。   As described above, in the microcomputer, the CPU needs to perform the above processing in response to a request for an urgent pulse output that cannot be predicted when it occurs. Therefore, the CPU must wait until a compare match occurs. And efficiency is reduced.

このような従来のタイマに対して、早急なパルス出力の要求があった場合に、強制的にコンペアマッチを発生させて、比較回路から一致信号を出力させる強制コンペアマッチ制御回路を備えたタイマが知られている。このタイマを備えたマイクロコンピュータでは、早急なパルス出力の要求に対応して、出力信号をローレベルからハイレベルにエッジ変化させる場合に、CPUが上記処理を行う必要がないから、CPUの効率が低下することがない。   A timer with a forced compare match control circuit that forcibly generates a compare match and outputs a match signal from the comparison circuit when there is an immediate pulse output request for such a conventional timer. Are known. In a microcomputer equipped with this timer, the CPU does not need to perform the above processing when changing the edge of the output signal from a low level to a high level in response to an immediate request for pulse output. There is no decline.

そして、CPUは、強制コンペアマッチ制御回路によるコンペアマッチが発生し、比較回路から一致信号が出力された後に、カウンタからカウンタ値を読出し、読出したカウンタ値にパルス幅に相当する値を加算し、加算結果をコンペアレジスタに書込む処理を行う。しかしながら、CPUとカウンタは、並行して動作しているから、CPUが読出したカウンタ値と、強制コンペアマッチ制御回路によるコンペアマッチ時のカウンタ値とが一致しない可能性が高い。つまり、カウンタでは、コンペアマッチ時から、実際にCPUからアクセスされるまでの間に、既に数カウント経過しているから、その分、カウンタ値が変動している。その結果、上記マイクロコンピュータでは、パルス信号をハイレベルからローレベルにエッジ変化させる場合に、カウンタ値の変動を考慮した上で、パルス幅に相当する値を加算することは困難となってしまう。言い換えると、上記マイクロコンピュータでは、早急なパルス出力の要求に対応して、出力信号をハイレベルからローレベルにエッジ変化させる場合に、ローレベルにすべきタイミングの精度が低下してしまう。   Then, after a compare match is generated by the forced compare match control circuit and a match signal is output from the comparison circuit, the CPU reads the counter value from the counter, adds a value corresponding to the pulse width to the read counter value, Processing to write the addition result to the compare register is performed. However, since the CPU and the counter operate in parallel, there is a high possibility that the counter value read by the CPU does not match the counter value at the time of the compare match by the forced compare match control circuit. That is, in the counter, since the count has already passed from the time of the compare match to when it is actually accessed by the CPU, the counter value fluctuates accordingly. As a result, in the microcomputer, it is difficult to add a value corresponding to the pulse width in consideration of fluctuations in the counter value when the edge of the pulse signal is changed from the high level to the low level. In other words, in the microcomputer, in response to an immediate request for pulse output, when the output signal is changed from the high level to the low level, the accuracy of the timing to be set to the low level is lowered.

本発明の目的は、早急なパルス出力の要求があった場合でも、パルス出力を精度よく行うことができる半導体装置を提供することにある。   An object of the present invention is to provide a semiconductor device capable of performing pulse output with high accuracy even when an immediate pulse output is required.

本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。   The following is a brief description of an outline of typical inventions disclosed in the present application.

〔1〕本発明に係る半導体集積回路は、タイマ(2)と、前記タイマを制御する中央処理装置(3)とを備える。前記タイマは、カウンタ(10)、レジスタ(11)、比較回路(13)、出力制御回路(14)及びコンペアマッチ制御回路(12)を有する。カウンタは、クロック信号をカウントする。レジスタは、前記中央処理装置がアクセス可能である。比較回路は、前記カウンタのカウンタ値と前記レジスタの設定値とを比較する。出力制御回路は、前記比較回路の一致結果に応じて、出力信号(20)をエッジ変化させる。コンペアマッチ制御回路は、前記出力信号の状態を変更させるための指示に応答して、前記カウンタのカウンタ値を前記レジスタにロードすると共に、前記比較回路から前記出力信号をエッジ変化させるための一致信号(17)を出力させる。前記中央処理装置は、前記カウンタからロードされた値を読出し、前記値に所要の値を加算した加算結果を前記レジスタに書込むための制御を行う。   [1] A semiconductor integrated circuit according to the present invention includes a timer (2) and a central processing unit (3) for controlling the timer. The timer includes a counter (10), a register (11), a comparison circuit (13), an output control circuit (14), and a compare match control circuit (12). The counter counts clock signals. The register is accessible by the central processing unit. The comparison circuit compares the counter value of the counter with the set value of the register. The output control circuit changes the edge of the output signal (20) according to the coincidence result of the comparison circuit. The compare match control circuit, in response to an instruction for changing the state of the output signal, loads the counter value of the counter into the register, and also matches the output signal from the comparison circuit (17) is output. The central processing unit performs control for reading a value loaded from the counter and writing an addition result obtained by adding a required value to the value to the register.

上記より、例えば出力信号の状態をローレベルからハイレベルに変更させるための指示があれば、コンペアマッチ制御回路が強制的にコンペアマッチを発生させて、比較回路から一致信号を出力させるから、中央処理装置に負担をかけずに、エッジ変化を行うことができる。また、コンペアマッチ時のカウンタ値は、コンペアマッチ制御回路によりレジスタにロードされている。そこで、中央処理装置は、カウンタではなく、レジスタにアクセスして、ロードされたカウンタ値を読出すことにより、正確なカウンタ値を基準にして、例えばパルス幅に相当する値である所要の値を加算して、加算結果をレジスタに書込むことができる。これにより、出力信号の状態をハイレベルからローレベルにすべきタイミングを精度よく設定することができる。従って、出力信号の状態を変更させるための指示があった場合でも、パルス出力を精度よく行うことができる。   From the above, for example, if there is an instruction to change the state of the output signal from low level to high level, the compare match control circuit forcibly generates a compare match and outputs a match signal from the comparison circuit. Edge changes can be made without imposing a burden on the processing apparatus. The counter value at the time of compare match is loaded into the register by the compare match control circuit. Therefore, the central processing unit accesses the register, not the counter, and reads the loaded counter value, thereby obtaining a required value, for example, a value corresponding to the pulse width, based on the accurate counter value. Addition can be performed and the addition result can be written to the register. This makes it possible to accurately set the timing at which the state of the output signal should be changed from the high level to the low level. Therefore, even when there is an instruction to change the state of the output signal, pulse output can be performed with high accuracy.

〔2〕本発明に係る半導体集積回路は、タイマ(2A)と、前記タイマを制御する中央処理装置とを備える。前記タイマは、カウンタと、第1レジスタ(11)及び第2レジスタ(26)と、比較回路と、出力制御回路と、コンペアマッチ制御回路(12A)と、加算回路(27)と、を備える。カウンタは、クロック信号をカウントする。第1レジスタ及び第2レジスタは、前記中央処理装置がアクセス可能である。比較回路は、前記カウンタのカウンタ値と前記第1レジスタの設定値とを比較する。出力制御回路は、前記比較回路の一致結果に応じて、出力信号をエッジ変化させる。コンペアマッチ制御回路は、前記出力信号の状態を変更させるための指示に応答して、前記カウンタのカウンタ値を前記第1レジスタにロードすると共に、前記比較回路から前記出力信号をエッジ変化させるための一致信号を出力させる。加算回路は、前記出力信号の状態を変更させるための指示に応答して、前記カウンタから前記第1レジスタにロードされた値と、前記第2レジスタの所要の値とを入力して加算し、加算結果を前記第1レジスタに出力する。   [2] A semiconductor integrated circuit according to the present invention includes a timer (2A) and a central processing unit that controls the timer. The timer includes a counter, a first register (11) and a second register (26), a comparison circuit, an output control circuit, a compare match control circuit (12A), and an adder circuit (27). The counter counts clock signals. The central processing unit can access the first register and the second register. The comparison circuit compares the counter value of the counter with the set value of the first register. The output control circuit changes the edge of the output signal according to the matching result of the comparison circuit. In response to an instruction to change the state of the output signal, the compare match control circuit loads the counter value of the counter into the first register and changes the edge of the output signal from the comparison circuit. A match signal is output. In response to an instruction for changing the state of the output signal, the adder circuit inputs and adds the value loaded from the counter to the first register and the required value of the second register, The addition result is output to the first register.

上記より、例えば出力信号の状態をローレベルからハイレベルに変更させるための指示があれば、上記同様に、中央処理装置に負担をかけることなく、出力信号をエッジ変化させることができる。さらに、第2レジスタに所要の値として例えばパルス幅に相当する値を予め格納させておけば、加算回路が第1レジスタ及び第2レジスタの値を入力して、加算結果を第1レジスタに出力するので、出力信号のハイレベルからローレベルのエッジ変化において、中央処理装置の処理が不要となる。このように、出力信号のエッジ変化に伴う中央処理装置の負担を軽減できる上に、パルス出力を精度よく行うことができる。   From the above, if there is an instruction for changing the state of the output signal from low level to high level, for example, the edge of the output signal can be changed without imposing a burden on the central processing unit. Furthermore, if a value corresponding to, for example, the pulse width is stored in advance as a required value in the second register, the adder circuit inputs the values of the first register and the second register, and outputs the addition result to the first register. Therefore, the processing of the central processing unit becomes unnecessary when the output signal changes from the high level to the low level. In this way, the burden on the central processing unit accompanying the edge change of the output signal can be reduced, and pulse output can be performed with high accuracy.

本発明の具体的な一つの形態として、前記変更させるための指示は、前記中央処理装置と前記タイマが共通接続された内部バス(6)とは異なる専用線(21)によって、前記コンペアマッチ制御回路に入力される。上記より、出力信号の状態を変更させるための指示は、内部バスの使用状況にかかわらず、確実に入力されるから、例えば中央処理装置がコンペアマッチ制御回路に指示を出力する場合に待機することがない。   As a specific form of the present invention, the instruction to change is performed by the compare match control by means of a dedicated line (21) different from the internal bus (6) to which the central processing unit and the timer are commonly connected. Input to the circuit. From the above, since the instruction for changing the state of the output signal is surely input regardless of the usage status of the internal bus, for example, when the central processing unit outputs an instruction to the compare match control circuit There is no.

本発明の具体的な一つの形態として、前記加算回路は、前記第1レジスタに専用バス(28)を介して接続される。上記より、加算回路は、第1レジスタに対する値の入出力を、中央処理装置を介さずに行うことができる。   As a specific form of the present invention, the adder circuit is connected to the first register via a dedicated bus (28). As described above, the adder circuit can input / output values to / from the first register without using the central processing unit.

〔3〕本発明に係る半導体集積回路は、中央処理装置と、前記中央処理装置によって制御されるタイマとを有する。前記タイマは、カウンタ、レジスタ、出力回路及び制御回路を備える。レジスタは、前記中央処理装置によってアクセス可能である。出力回路は、前記カウンタの計数値が前記レジスタの設定値に一致するかを判定し、一致判定に基づいて出力をエッジ変化させる。制御回路は、外部からの指示に応答して、前記出力回路の出力をエッジ変化させ、且つ、そのときの前記カウンタの計数値を前記レジスタにロードする。   [3] A semiconductor integrated circuit according to the present invention includes a central processing unit and a timer controlled by the central processing unit. The timer includes a counter, a register, an output circuit, and a control circuit. The register is accessible by the central processing unit. The output circuit determines whether the count value of the counter matches the set value of the register, and changes the edge of the output based on the match determination. In response to an instruction from the outside, the control circuit changes the edge of the output of the output circuit and loads the count value of the counter at that time into the register.

上記より、外部からの指示に応答して、コンペアマッチ発生時のカウンタの計数値を取得できる。そして、この取得した計数値を用いると、次回のコンペアマッチまでの時間、即ち、パルス幅に相当する値を正確に設定できる。これにより、外部からの指示として、例えば出力を早急にエッジ変化させる指示がある場合でも、パルス出力を精度よく行うことができる。   As described above, in response to an instruction from the outside, the count value of the counter when the compare match occurs can be acquired. By using the acquired count value, the time until the next compare match, that is, a value corresponding to the pulse width can be set accurately. As a result, even when there is an instruction to change the edge of the output quickly as an instruction from the outside, for example, pulse output can be accurately performed.

本発明の具体的な一つの形態として、前記中央処理装置は、前記カウンタから前記レジスタにロードされた計数値を読込み、前記読込んだ計数値に所定の値を加算して、前記レジスタに書き戻す。上記より、中央処理装置は、コンペアマッチ時のカウンタ値を基準にして、次のコンペアマッチまでの時間、例えばパルス幅に相当する値を所定の値として処理を行うことにより、出力信号のハイレベルからローレベルへのエッジ変化におけるタイミングを精度よく設定することができる。   As a specific form of the present invention, the central processing unit reads a count value loaded from the counter into the register, adds a predetermined value to the read count value, and writes the read value into the register. return. From the above, the central processing unit performs processing with a predetermined value corresponding to the time until the next compare match, for example, a value corresponding to the pulse width, based on the counter value at the time of the compare match. The timing at the edge change from to low level can be set with high accuracy.

本発明の具体的な一つの形態として、前記中央処理装置によってアクセスされる別のレジスタと、前記外部からの指示に応答して、前記カウンタから前記レジスタにロードされた計数値と前記別のレジスタの所要の値とを入力して加算し、加算結果を前記レジスタに出力する演算回路と、を更に備える。上記より、出力信号のハイレベルからローレベルのエッジ変化において、別のレジスタと演算回路を用いることにより、中央処理装置への負担を軽減した上で、出力信号のハイレベルからローレベルへのエッジ変化におけるタイミングを精度よく設定することができる   As a specific form of the present invention, another register accessed by the central processing unit, a count value loaded from the counter to the register in response to an instruction from the outside, and the other register And an arithmetic circuit that inputs and adds the required values and outputs the addition result to the register. From the above, the edge from the high level to the low level of the output signal is reduced by reducing the burden on the central processing unit by using another register and arithmetic circuit when the output signal changes from the high level to the low level. The timing of change can be set accurately.

本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。   The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.

即ち、早急なパルス出力の要求があった場合でも、パルス出力を精度よく行うことができる。   That is, even when there is a request for urgent pulse output, pulse output can be performed with high accuracy.

図1には、本発明の実施形態1に係る半導体集積回路の一例であるマイクロコンピュータの概略構成が例示される。マイクロコンピュータ1は、例えば自動車等のエンジン制御システムに用いられ、エンジンの吸気管または燃焼室に燃料を噴射するインジェクタにパルス信号を出力して、エンジン制御を行う。マイクロコンピュータ1は、タイマ2と中央処理装置(CPU)3等とを備えている。CPU3は、リードオンリーメモリ(ROM)4に格納されたプログラム等に基づいてマイクロコンピュータ1の全ての制御を行う。ROM4は、CPU3が実行すべきプログラムや固定データを記憶する。ランダムアクセスメモリ(RAM)5は、CPU3による演算結果を記憶し、また、CPU3の作業領域ともなる。タイマ2、CPU3、ROM4及びRAM5は、内部バス6を介してそれぞれ接続されている。   FIG. 1 illustrates a schematic configuration of a microcomputer as an example of a semiconductor integrated circuit according to Embodiment 1 of the present invention. The microcomputer 1 is used, for example, in an engine control system such as an automobile, and performs engine control by outputting a pulse signal to an injector that injects fuel into an intake pipe or a combustion chamber of the engine. The microcomputer 1 includes a timer 2 and a central processing unit (CPU) 3. The CPU 3 controls all of the microcomputer 1 based on a program stored in a read only memory (ROM) 4. The ROM 4 stores programs to be executed by the CPU 3 and fixed data. A random access memory (RAM) 5 stores a calculation result by the CPU 3 and also serves as a work area for the CPU 3. The timer 2, CPU 3, ROM 4, and RAM 5 are connected to each other via an internal bus 6.

タイマ2は、インジェクタによる燃料の噴射を制御するためのパルス信号等を生成するモジュールであって、カウンタ10と、コンペアレジスタ11と、強制コンペアマッチ制御回路12と、比較回路13と、出力制御回路14等を備えている。カウンタ10は、クロック信号をカウントし、その計数値(以下、カウンタ値と記す)を記憶する機能を有する。カウンタ10は、クロック信号に同期して、カウンタ値を例えばカウントアップする。コンペアレジスタ11は、CPU3がアクセス可能であって、所定の設定値が設定される。比較回路13は、信号線15を介して入力されたカウンタ10のカウンタ値と、信号線16を介して入力されたコンペアレジスタ11の設定値とを比較する。比較回路13は、これらの値が一致すれば、一致信号17,18を生成する。つまり、一致信号17,18は、コンペアマッチ発生時に生成されることになる。一致信号17は、比較回路13により出力制御回路14に出力される。また、一致信号18は、比較回路13により出力制御回路14ではなく、マイクロコンピュータ1内の図示を省略する周辺回路等に出力され、各種制御に用いられる。   The timer 2 is a module that generates a pulse signal and the like for controlling fuel injection by the injector, and includes a counter 10, a compare register 11, a forced compare match control circuit 12, a comparison circuit 13, and an output control circuit. 14 etc. The counter 10 has a function of counting clock signals and storing the count value (hereinafter referred to as a counter value). The counter 10 counts up the counter value, for example, in synchronization with the clock signal. The compare register 11 is accessible by the CPU 3 and is set with a predetermined set value. The comparison circuit 13 compares the counter value of the counter 10 input via the signal line 15 with the set value of the compare register 11 input via the signal line 16. The comparison circuit 13 generates coincidence signals 17 and 18 if these values coincide. That is, the coincidence signals 17 and 18 are generated when a compare match occurs. The coincidence signal 17 is output to the output control circuit 14 by the comparison circuit 13. The coincidence signal 18 is output from the comparison circuit 13 to the peripheral circuit (not shown) in the microcomputer 1 instead of the output control circuit 14 and used for various controls.

出力制御回路14は、内部バス6と信号線19を介してCPU3より設定可能とされる。出力制御回路14は、CPU3によって、例えば最初に一致信号17が入力されると、出力信号(以下、タイマ出力信号と記す)20の状態をローレベルからハイレベルにエッジ変化させ、次に一致信号17が入力されると、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させるように、予め設定される。これにより、出力制御回路14は、一致信号17が入力される毎にタイマ出力信号20のエッジ変化を行い、パルス信号を生成可能とする。   The output control circuit 14 can be set by the CPU 3 via the internal bus 6 and the signal line 19. For example, when the coincidence signal 17 is first input by the CPU 3, the output control circuit 14 changes the state of the output signal (hereinafter referred to as a timer output signal) 20 from low level to high level, and then coincides with the coincidence signal. When 17 is input, the state of the timer output signal 20 is set in advance so as to change the edge from the high level to the low level. As a result, the output control circuit 14 changes the edge of the timer output signal 20 every time the coincidence signal 17 is input, and can generate a pulse signal.

強制コンペアマッチ制御回路12に、CPU3から専用線21を介して、早急にパルス出力を行うための指示が与えられると、強制コンペアマッチ要求フラグFGがセットされる。これによって、強制コンペアマッチ制御回路12は、コンペアマッチを強制的に発生させるための制御を行う。ここで、早急にパルス出力を行うとは、タイマ出力信号20の状態を早急にローレベルからハイレベルにエッジ変化させるだけでなく、所定のパルス幅を有するように、適切なタイミングでハイレベルからローレベルにエッジ変化させることも意味する。   When the forced compare match control circuit 12 is instructed from the CPU 3 via the dedicated line 21 to quickly output a pulse, the forced compare match request flag FG is set. Thus, the forced compare match control circuit 12 performs control for forcibly generating a compare match. Here, the quick pulse output means not only that the state of the timer output signal 20 is rapidly changed from the low level to the high level but also the high level at an appropriate timing so as to have a predetermined pulse width. It also means changing the edge to low level.

まず、タイマ出力信号20の状態をローレベルからハイレベルにエッジ変化させる場合について説明する。強制コンペアマッチ制御回路12は、強制コンペアマッチ要求フラグFGがセットされると、制御線22,23を介してカウンタ10及びコンペアレジスタ11にそれぞれ制御信号S1,S2を出力して、そのときのカウンタ10のカウンタ値を、図中矢印24で示されるように、コンペアレジスタ11にロードさせる。さらにこのとき、強制コンペアマッチ制御回路12は、制御線25を介して比較回路13に制御信号S3を出力して、比較回路13から強制的に一致信号17を出力させる。これにより、マイクロコンピュータ1は、CPU3に負担をかけることなく、強制コンペアマッチ要求フラグFGがセットされると、直ちにコンペアマッチを発生させ、タイマ出力信号20の状態をローレベルからハイレベルにエッジ変化させることができる。以下、この強制コンペアマッチ制御回路12によるコンペアマッチを、強制コンペアマッチと称する。また、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させる動作については、図2と共に詳細を後述する。   First, the case where the state of the timer output signal 20 is changed from the low level to the high level will be described. When the forced compare match request flag FG is set, the forced compare match control circuit 12 outputs control signals S1 and S2 to the counter 10 and the compare register 11 via the control lines 22 and 23, respectively. The counter value of 10 is loaded into the compare register 11 as indicated by the arrow 24 in the figure. Further, at this time, the forced compare match control circuit 12 outputs the control signal S3 to the comparison circuit 13 via the control line 25, and forcibly outputs the match signal 17 from the comparison circuit 13. Thereby, the microcomputer 1 generates a compare match immediately when the forced compare match request flag FG is set without imposing a burden on the CPU 3, and changes the state of the timer output signal 20 from low level to high level. Can be made. Hereinafter, the compare match by the forced compare match control circuit 12 is referred to as a forced compare match. The operation of changing the state of the timer output signal 20 from the high level to the low level will be described in detail later with reference to FIG.

ここで、説明の便宜上、エンジン制御について概略的に説明する。例えば単気筒エンジンでは、内部にピストンを収容する1つのシリンダを有する。上記した燃焼室は、このピストンの上面とシリンダの内壁とで囲まれた空間であり、シリンダの内壁には、吸気口と排気口が形成されている。単気筒エンジンの吸気工程、圧縮工程、燃焼・膨張工程、排気工程からなる一連のサイクルにおいて、ピストンは、その上面で燃焼室のガス圧を受けることになる。また、ピストンは、連接棒を介してクランク軸に連動している。これにより、ピストンの往復運動がクランク軸の回転運動に変換される。吸気工程では、排気口が排気弁により閉じられると共に、吸気口が吸気弁により開かれ、さらに、吸気口に接続された吸気管を介して、空気やインジェクタから噴射された燃料からなる混合気が燃焼室に導入される。このとき、ピストンは、燃焼室の容積を大きくして圧力を下げる方向、即ち、下方向に移動する。ピストンが最も下方向に移動した位置を下死点とする。そして、圧縮工程では、吸気口及び排気口が、それぞれ吸気弁及び排気弁によって閉じられ、燃焼室の内部が気密状態になり、さらに、ピストンが上方向に移動することで、燃焼室の容積が小さくなり、ガス圧が高くなる。ピストンが最も上方向に移動した位置を上死点とする。次に、燃焼・膨張工程では、ピストンの位置が上死点付近になると、点火プラグによって燃焼室内の混合気が燃焼され、混合気が膨張する。排気工程では、この混合気の膨張により、ピストンの位置が下死点に近づくと、排気弁により排気口が開かれる。そして、再び、ピストンの位置が上死点に近づくにつれて、燃焼室の容積が小さくなるから、燃焼後の混合気が排気口に接続された排気管を介して排気される。そして、再びピストンの位置が上死点になると、上記した吸気工程が再び開始される。   Here, for convenience of explanation, engine control will be schematically described. For example, a single-cylinder engine has one cylinder that accommodates a piston inside. The combustion chamber described above is a space surrounded by the upper surface of the piston and the inner wall of the cylinder, and an intake port and an exhaust port are formed on the inner wall of the cylinder. In a series of cycles including an intake process, a compression process, a combustion / expansion process, and an exhaust process of a single cylinder engine, the piston receives the gas pressure of the combustion chamber on its upper surface. The piston is linked to the crankshaft via a connecting rod. Thereby, the reciprocating motion of the piston is converted into the rotational motion of the crankshaft. In the intake process, the exhaust port is closed by the exhaust valve, the intake port is opened by the intake valve, and an air-fuel mixture composed of air or fuel injected from the injector is passed through the intake pipe connected to the intake port. Introduced into the combustion chamber. At this time, the piston moves in the direction of decreasing the pressure by increasing the volume of the combustion chamber, that is, in the downward direction. The position at which the piston has moved downward is defined as the bottom dead center. In the compression process, the intake port and the exhaust port are closed by the intake valve and the exhaust valve, respectively, the inside of the combustion chamber is airtight, and the piston moves upward, so that the volume of the combustion chamber is increased. It becomes smaller and the gas pressure becomes higher. The position at which the piston has moved upward is defined as the top dead center. Next, in the combustion / expansion step, when the position of the piston is near top dead center, the air-fuel mixture in the combustion chamber is combusted by the spark plug, and the air-fuel mixture expands. In the exhaust process, when the position of the piston approaches the bottom dead center due to the expansion of the air-fuel mixture, the exhaust port is opened by the exhaust valve. Then, again, as the position of the piston approaches top dead center, the volume of the combustion chamber decreases, so the air-fuel mixture after combustion is exhausted through the exhaust pipe connected to the exhaust port. Then, when the position of the piston reaches the top dead center again, the above intake process is started again.

要するに、インジェクタからの燃料の噴射は、上記した各工程からなる1サイクルのうち吸気工程で1回必要とされる。このため、パルス出力を行うタイミングを設定するためには、例えば吸気工程におけるピストンの上死点又は下死点を基準とすればよい。また、ピストンが上死点又は下死点に位置するタイミングは、例えばクランク軸の回転角を検出する適宜のセンサにより演算可能である。   In short, the injection of fuel from the injector is required once in the intake process in one cycle consisting of the above-described processes. For this reason, in order to set the timing for performing the pulse output, for example, the top dead center or the bottom dead center of the piston in the intake process may be used as a reference. The timing at which the piston is located at the top dead center or the bottom dead center can be calculated by, for example, an appropriate sensor that detects the rotation angle of the crankshaft.

次に、エンジン制御システムおいて、上記強制コンペアマッチ要求フラグFGがセットされる状況について説明する。エンジン制御システムでは、例えば吸気管に導入される空気の流量を調整するためのスロットルが設けられている。スロットルは、運転者等によるアクセルの踏み込み具合に応じて、吸気管の開度を変化させる。つまり、空気の流量は、スロットルの開度で検出可能とされる。エンジン回転数は、例えばクランク軸の回転数により検出可能とされる。エンジン制御システムでは、流量に対する最適なエンジン回転数が予めテーブル等に記憶されており、例えば、スロットルの開度が大きくなり流量が増えたにもかかわらず、エンジン回転数が最適な状態よりも低いのであれば、インジェクタから噴射される燃料が不足していると判定される。言換えると、エンジン制御システムは、運転者がアクセルを踏み込んで加速要求をしたことにより、現時点でのエンジン回転数ではこの加速要求に対応できないから、インジェクタから燃料を噴射させる時間を、予め設定されていたコンペアマッチが発生するまでの時間よりも早める必要があると判定する。このような状況において、エンジン制御システムでは、CPU3が上記判定を行い、早急にパルス出力を行うための指示を出力して、強制コンペアマッチ制御回路12の強制コンペアマッチ要求フラグFGをセットする。また、インジェクタが燃料を噴射することができる期間は、タイマ出力信号20の状態がハイレベルである期間である。このため、エンジン制御システムにおいて、CPU3は、適宜のテーブルを参照してタイマ出力信号20のパルス幅に相当する値を演算することもできる。   Next, a situation where the forced compare match request flag FG is set in the engine control system will be described. In the engine control system, for example, a throttle for adjusting the flow rate of air introduced into the intake pipe is provided. The throttle changes the opening of the intake pipe according to the degree of depression of the accelerator by the driver or the like. That is, the air flow rate can be detected by the throttle opening. The engine speed can be detected by, for example, the speed of the crankshaft. In the engine control system, the optimum engine speed for the flow rate is stored in advance in a table or the like. For example, the engine speed is lower than the optimum state even though the throttle opening is increased and the flow rate is increased. If it is, it will be determined that the fuel injected from the injector is insufficient. In other words, the engine control system sets the time for injecting fuel from the injector in advance because the driver requested the acceleration by depressing the accelerator and the current engine speed cannot respond to the acceleration request. It is determined that it is necessary to advance the time until the compare match occurs. In such a situation, in the engine control system, the CPU 3 makes the above determination, outputs an instruction for promptly outputting a pulse, and sets the forced compare match request flag FG of the forced compare match control circuit 12. The period during which the injector can inject fuel is a period in which the state of the timer output signal 20 is at a high level. For this reason, in the engine control system, the CPU 3 can also calculate a value corresponding to the pulse width of the timer output signal 20 with reference to an appropriate table.

図2には、マイクロコンピュータ1の動作タイミングの一例が示される。このタイミングチャートでは、横軸が時間を示し、縦軸には、コンペアレジスタ11の設定値、カウンタ10のカウンタ値、一致信号17の状態、強制コンペアマッチによるタイマ出力信号20の状態が示され、さらに、通常のコンペアマッチによるタイマ出力信号20の状態が図中、二点鎖線で示されている。通常のコンペアマッチとは、強制コンペアマッチ制御回路12を用いることなく、コンペアレジスタ11に予め設定された設定値と、カウンタ10のカウンタ値とが一致することをいう。   FIG. 2 shows an example of the operation timing of the microcomputer 1. In this timing chart, the horizontal axis indicates time, and the vertical axis indicates the set value of the compare register 11, the counter value of the counter 10, the state of the coincidence signal 17, and the state of the timer output signal 20 due to forced compare match. Further, the state of the timer output signal 20 by a normal compare match is indicated by a two-dot chain line in the figure. The normal compare match means that the set value preset in the compare register 11 matches the counter value of the counter 10 without using the forced compare match control circuit 12.

時刻t0は、例えば吸気工程においてピストンが上死点に位置するタイミングとされる。時刻t0において、コンペアレジスタ11の設定値はYR、カウンタ10のカウンタ値はYCとされ、それぞれ基準値として設定される。時刻t0において、一致信号17及びタイマ出力信号20の状態は、共にローレベルとされる。カウンタ値は、YCを基準値として、クロック信号の1周期毎にカウントアップされる。カウンタ10は、例えば吸気工程においてピストンが下死点に位置するタイミングでリセットされる。この基準値YCは、例えばゼロである。   Time t0 is, for example, a timing at which the piston is located at the top dead center in the intake process. At time t0, the set value of the compare register 11 is YR, and the counter value of the counter 10 is YC, which are set as reference values. At time t0, the state of the coincidence signal 17 and the timer output signal 20 are both set to the low level. The counter value is counted up every cycle of the clock signal with YC as a reference value. The counter 10 is reset, for example, at the timing when the piston is located at the bottom dead center in the intake process. This reference value YC is, for example, zero.

まず、通常のコンペアマッチにおいて、コンペアレジスタ11の設定値は、強制的に変更されることがないから、図中、時刻t2以降のコンペアレジスタ11の設定値を、YRと同じ値として点線で示している。カウンタ値は、点Dで示すように、時刻t4でYRと同じ値となる。このとき、タイマ出力信号20の状態は、二点鎖線で示すようにローレベルからハイレベルとなる。このため、通常のコンペアマッチが発生するまでの時間は、時刻t4とされる。   First, in a normal compare match, the set value of the compare register 11 is not forcibly changed. In the figure, the set value of the compare register 11 after time t2 is indicated by a dotted line as the same value as YR. ing. As indicated by point D, the counter value becomes the same value as YR at time t4. At this time, the state of the timer output signal 20 changes from a low level to a high level as indicated by a two-dot chain line. For this reason, the time until a normal compare match occurs is time t4.

次に、強制コンペアマッチについて説明する。時刻t1において、CPU3は、インジェクタから噴射される燃料が不足していると判定し、内部バス6とは異なる専用線21を介して、強制コンペアマッチ制御回路12の上記強制コンペアマッチ要求フラグFGをセットする。このため、強制コンペアマッチ要求フラグFGは、内部バス6の使用状況にかかわらず、確実にセットされる。つまり、CPU3は、強制コンペアマッチ制御回路12の強制コンペアマッチ要求フラグFGをセットするときに待機することがない。時刻t2において、強制コンペアマッチ制御回路12は、コンペアレジスタ11にカウンタ10のカウンタ値をロードすることにより、コンペアレジスタ11の設定値をYRから、ロードされたカウンタ値に変更する。即ち、強制コンペアマッチは、点Aにおいて発生することになる。このとき、強制コンペアマッチ要求フラグFGはクリアされる。時刻t2において、強制コンペアマッチ制御回路12は、比較回路13から一致信号17を出力制御回路14に出力させるから、一致信号17の状態がハイレベルとされる。これにより、時刻t2において、タイマ出力信号20の状態は、ローレベルからハイレベルにエッジ変化する。   Next, forced compare match will be described. At time t1, the CPU 3 determines that the fuel injected from the injector is insufficient, and sets the forced compare match request flag FG of the forced compare match control circuit 12 via the dedicated line 21 different from the internal bus 6. set. Therefore, the forced compare match request flag FG is surely set regardless of the usage status of the internal bus 6. That is, the CPU 3 does not stand by when the forced compare match request flag FG of the forced compare match control circuit 12 is set. At time t2, the forced compare match control circuit 12 loads the counter value of the counter 10 into the compare register 11, thereby changing the set value of the compare register 11 from YR to the loaded counter value. That is, the forced compare match occurs at the point A. At this time, the forced compare match request flag FG is cleared. At time t2, the forced compare match control circuit 12 outputs the match signal 17 from the comparison circuit 13 to the output control circuit 14, so that the state of the match signal 17 is set to the high level. Thereby, at the time t2, the state of the timer output signal 20 changes from the low level to the high level.

次に、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させる動作について説明する。時刻t2の後、CPU3は、カウンタ10ではなく、内部バス6を介してコンペアレジスタ11にアクセスして、強制コンペアマッチが発生したときにカウンタ10からロードされたカウンタ値を読出す。例えばCPU3は、インジェクタから噴射される燃料が不足していると判定した場合には、インジェクタが燃料を噴射できる期間、即ちパルス幅に相当する値を演算して、このパルス幅に相当する値と、カウンタ10からロードされたカウンタ値とを加算して、加算結果をコンペアレジスタ11に書込む。このCPU3のデータ処理は、点Bで実行されており、時刻t2から既に幾分かの時間が経過している。しかし、CPU3のデータ処理は、強制コンペアマッチが発生したときの正確なカウンタ値を基準として用いているから、次のコンペアマッチとされる時刻t3までにデータ処理を終了させれば、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させることができる。   Next, an operation for changing the state of the timer output signal 20 from the high level to the low level will be described. After time t2, the CPU 3 accesses the compare register 11 via the internal bus 6 instead of the counter 10, and reads the counter value loaded from the counter 10 when a forced compare match occurs. For example, if the CPU 3 determines that the fuel injected from the injector is insufficient, the CPU 3 calculates a period during which the injector can inject fuel, that is, a value corresponding to the pulse width, and sets a value corresponding to the pulse width. The counter value loaded from the counter 10 is added, and the addition result is written to the compare register 11. The data processing of the CPU 3 is executed at the point B, and some time has already passed from the time t2. However, since the data processing of the CPU 3 uses the accurate counter value when the forced compare match occurs as a reference, if the data processing is completed by the time t3 when the next compare match is made, the timer output signal The 20 states can be changed from a high level to a low level.

ここで、パルス幅に相当する値について一例を示す。パルス幅に相当する値とは、時刻t2以降、クロック信号の1周期毎にカウントアップされるカウンタ10のカウンタ値と、コンペアレジスタ11の設定値とが再び一致して、次のコンペアマッチを発生させるまでの時間に相当する。例えばカウンタ10のクロック信号の1周期が100nsであり、タイマ出力信号20のパルス幅を1μsにしたい場合には、パルス幅に相当する値は、「10」となる。これは、1μsがクロック信号の10周期分の時間に相当するためである。つまり、カウンタ10のカウンタ値は、1μsで「10」だけカウントアップされるから、1μs経過後にコンペアレジスタ11の設定値と一致する。   Here, an example of a value corresponding to the pulse width is shown. The value corresponding to the pulse width is equal to the counter value of the counter 10 counted up for each cycle of the clock signal after the time t2 and the set value of the compare register 11 again to generate the next compare match. It corresponds to the time until For example, when one cycle of the clock signal of the counter 10 is 100 ns and the pulse width of the timer output signal 20 is to be 1 μs, the value corresponding to the pulse width is “10”. This is because 1 μs corresponds to a time corresponding to 10 cycles of the clock signal. That is, since the counter value of the counter 10 is counted up by “10” in 1 μs, it matches the set value of the compare register 11 after 1 μs has elapsed.

時刻t3において、カウンタ10のカウンタ値は、点Cで示すように、コンペアレジスタ11の設定値と一致する。この時刻t3でのカウンタ10のカウンタ値及びコンペアレジスタ11の設定値は、信号線15,16を介してそれぞれ比較回路13に入力される。時刻t3において、比較回路13は、一致信号17を出力制御回路14に出力するから、一致信号17の状態がハイレベルとされる。これにより、出力制御回路14は、CPU3から予め設定されていたように、次のコンペアレジスタの発生時である時刻t3で、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させる。つまり、マイクロコンピュータ1によれば、タイマ出力信号20の状態をハイレベルからローレベルにすべきタイミングを精度よく設定することができる。従って、マイクロコンピュータ1によれば、早急なパルス出力の要求があった場合でも、パルス出力を精度よく行うことができる。   At time t3, the counter value of the counter 10 matches the set value of the compare register 11 as indicated by a point C. The counter value of the counter 10 and the set value of the compare register 11 at time t3 are input to the comparison circuit 13 via the signal lines 15 and 16, respectively. Since the comparison circuit 13 outputs the coincidence signal 17 to the output control circuit 14 at time t3, the state of the coincidence signal 17 is set to the high level. As a result, the output control circuit 14 changes the state of the timer output signal 20 from the high level to the low level at time t3 when the next compare register is generated, as previously set by the CPU 3. That is, according to the microcomputer 1, it is possible to accurately set the timing at which the state of the timer output signal 20 should be changed from the high level to the low level. Therefore, according to the microcomputer 1, even when an immediate pulse output is requested, the pulse can be output with high accuracy.

これに対して、比較例として、例えばタイマにパルス幅設定用のカウンタを設けて、コンペアマッチの発生時に、このパルス幅設定用カウンタを起動して、パルス出力を行うマイクロコンピュータも考えられる。しかしながら、このマイクロコンピュータでは、複雑且つ大規模な回路構成を有することになってしまう。   On the other hand, as a comparative example, for example, a microcomputer that provides a pulse width setting counter in a timer and activates the pulse width setting counter and outputs a pulse when a compare match occurs can be considered. However, this microcomputer has a complicated and large-scale circuit configuration.

図3には、本発明の実施形態2に係る半導体集積回路の一例であるマイクロコンピュータの概略構成が例示される。実施形態2では、上記した実施形態1のマイクロコンピュータ1と同一機能等を有する部分には同一符号を付し、説明が重複する部分については適宜省略する。マイクロコンピュータ1Aは、タイマ2Aを備えている。タイマ2Aは、カウンタ10と、コンペアレジスタ11及びデューティレジスタ26と、比較回路13と、出力制御回路14と、強制コンペアマッチ制御回路12Aと、加算回路27とを備えている。通常のコンペアマッチにおいて、タイマ2Aは、タイマ2と同様な動作を行う。   FIG. 3 illustrates a schematic configuration of a microcomputer as an example of a semiconductor integrated circuit according to the second embodiment of the present invention. In the second embodiment, parts having the same functions and the like as those of the microcomputer 1 of the first embodiment described above are denoted by the same reference numerals, and portions having duplicate explanations are omitted as appropriate. The microcomputer 1A includes a timer 2A. The timer 2A includes a counter 10, a compare register 11 and a duty register 26, a comparison circuit 13, an output control circuit 14, a forced compare match control circuit 12A, and an adder circuit 27. In a normal compare match, the timer 2A performs the same operation as the timer 2.

強制コンペアマッチにおいて、タイマ2Aは、タイマ出力信号20をローレベルからハイレベルにエッジ変化させる動作についてはタイマ2と同様な動作を行うが、ハイレベルからローレベルにエッジ変化させる動作が異なる。例えばタイマ2では、CPU3がデータ処理を行うことにより、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させていた。これに対して、タイマ2Aでは、デューティレジスタ26、加算回路27及び強制コンペアマッチ制御回路12A等によって、タイマ出力信号20をハイレベルからローレベルにエッジ変化させることができる。   In the forced compare match, the timer 2A performs the same operation as the timer 2 for changing the edge of the timer output signal 20 from the low level to the high level, but the operation for changing the edge from the high level to the low level is different. For example, in the timer 2, the state of the timer output signal 20 is changed from the high level to the low level by the CPU 3 performing data processing. On the other hand, in the timer 2A, the edge of the timer output signal 20 can be changed from the high level to the low level by the duty register 26, the adder circuit 27, the forced compare match control circuit 12A, and the like.

具体的には、強制コンペアマッチ制御回路12Aは、強制コンペアマッチ要求フラグFGがセットされると、制御線23,29,30を介してコンペアレジスタ11、加算回路27及びデューティレジスタ26にそれぞれ制御信号S4,S5,S6を出力する。デューティレジスタ26には、CPU3等により演算されたパルス幅に相当する値が予め格納されており、制御信号S6により、このパルス幅に相当する値を加算回路27に出力可能とされる。コンペアレジスタ11は、制御信号S4により、強制コンペアマッチが発生したときにコンペアレジスタ11にロードされたカウンタ値を加算回路27に出力可能とされる。加算回路27は、制御信号S5により、コンペアレジスタ11から出力されるカウンタ値と、デューティレジスタ26から出力されるパルス幅に相当する値と、を入力可能とされる。   Specifically, when the forced compare match request flag FG is set, the forced compare match control circuit 12A sends control signals to the compare register 11, the adder circuit 27, and the duty register 26 via the control lines 23, 29, and 30, respectively. S4, S5 and S6 are output. In the duty register 26, a value corresponding to the pulse width calculated by the CPU 3 or the like is stored in advance, and a value corresponding to this pulse width can be output to the adding circuit 27 by the control signal S6. The compare register 11 can output the counter value loaded in the compare register 11 to the adder circuit 27 when the forced compare match occurs by the control signal S4. The adder circuit 27 can receive a counter value output from the compare register 11 and a value corresponding to the pulse width output from the duty register 26 by the control signal S5.

加算回路27は、専用バス28,31を介してコンペアレジスタ11とデューティレジスタ26にそれぞれ接続されているから、CPU3を介在させることなく、コンペアレジスタ11及びデューティレジスタ26から、上記カウンタ値及びパルス幅に相当する値が入力される。加算回路27は、入力されたこれらの値を加算して加算結果を保持する。強制コンペアマッチ制御回路12Aは、制御線23,29を介して再び制御信号S7,S8を出力し、加算回路27からコンペアレジスタ11に加算結果を出力可能とする。そして、加算回路27は、加算結果をコンペアレジスタ11に出力する。従って、タイマ2Aによれば、タイマ出力信号20の状態をハイレベルからローレベルにエッジ変化させるときに、CPU3の処理が不要となるから、タイマ出力信号20のエッジ変化に伴うCPU3の負担を軽減できる。   Since the adder circuit 27 is connected to the compare register 11 and the duty register 26 via the dedicated buses 28 and 31, respectively, the counter value and the pulse width are transferred from the compare register 11 and the duty register 26 without interposing the CPU 3. A value corresponding to is input. The adding circuit 27 adds these input values and holds the addition result. The forced compare match control circuit 12A outputs the control signals S7 and S8 again via the control lines 23 and 29, and the addition circuit 27 can output the addition result to the compare register 11. Then, the adding circuit 27 outputs the addition result to the compare register 11. Therefore, according to the timer 2A, when the state of the timer output signal 20 is changed from the high level to the low level, the processing of the CPU 3 becomes unnecessary, so the burden on the CPU 3 due to the edge change of the timer output signal 20 is reduced. it can.

さらに、加算回路27がコンペアレジスタ11及びデューティレジスタ26からそれぞれの値を入力して加算し、その加算結果をコンペアレジスタ11に出力するのに要する時間は、タイマ2におけるCPU3のデータ処理時間よりも短くて済む。これにより、タイマ2Aでは、例えばパルス幅に相当する値がCPU3のデータ処理時間よりも小さい場合であっても、対応可能であり、パルス出力の精度をより高めることができる。   Furthermore, the time required for the adder circuit 27 to input and add the respective values from the compare register 11 and the duty register 26 and to output the addition result to the compare register 11 is longer than the data processing time of the CPU 3 in the timer 2. It's short. Thereby, even if the value corresponding to the pulse width is smaller than the data processing time of the CPU 3, for example, the timer 2A can cope with it, and the accuracy of pulse output can be further improved.

以上、本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。   As mentioned above, although the invention made by this inventor was concretely demonstrated based on embodiment, it cannot be overemphasized that this invention is not limited to it and can be variously changed in the range which does not deviate from the summary.

例えば、上記強制コンペアマッチ制御回路12,12Aの強制コンペアマッチ要求フラグFGは、CPU3が専用線21を介してセットするようにしたが、これに限られず、図示を省略する割込み制御回路によってセットするようにしてもよい。このようにすれば、強制コンペアマッチ制御回路12,12Aの強制コンペアマッチ要求フラグFGをセットするときに、例えばCPU3の分岐処理ではなく、割込み制御回路による割込み制御で行うことになり、CPU3に対する負担をより軽減できる。また、上記したマイクロコンピュータ1,1Aは、所望のパルス幅を有するパルス信号を所定のタイミングで出力できる機能を有しているので、エンジン制御システムに限らず、モニタ機能制御システム等、適宜の制御システムに適用することができる。   For example, although the forced compare match request flag FG of the forced compare match control circuits 12 and 12A is set by the CPU 3 via the dedicated line 21, it is not limited to this and is set by an interrupt control circuit not shown. You may do it. In this way, when the forced compare match request flag FG of the forced compare match control circuits 12 and 12A is set, for example, it is performed by interrupt control by the interrupt control circuit instead of the branch process of the CPU 3, and the load on the CPU 3 is increased. Can be further reduced. Further, since the microcomputers 1 and 1A described above have a function of outputting a pulse signal having a desired pulse width at a predetermined timing, the microcomputers 1 and 1A are not limited to the engine control system, and may be appropriately controlled such as a monitor function control system. Can be applied to the system.

本発明の実施形態1に係る半導体集積回路の一例であるマイクロコンピュータの概略構成を例示する説明図である。1 is an explanatory diagram illustrating a schematic configuration of a microcomputer that is an example of a semiconductor integrated circuit according to a first embodiment of the invention; マイクロコンピュータの動作タイミングを示すタイミングチャートである。It is a timing chart which shows the operation timing of a microcomputer. 本発明の実施形態2に係る半導体集積回路の一例であるマイクロコンピュータの概略構成を例示する説明図である。It is explanatory drawing which illustrates schematic structure of the microcomputer which is an example of the semiconductor integrated circuit which concerns on Embodiment 2 of this invention.

符号の説明Explanation of symbols

1,1A マイクロコンピュータ
2,2A タイマ
3 中央処理装置(CPU)
4 リードオンリーメモリ(ROM)
5 ランダムアクセスメモリ(RAM)
6 内部バス
10 カウンタ
11 コンペアレジスタ
12 強制コンペアマッチ制御回路
13 比較回路
17 一致信号
20 タイマ出力信号
21 専用線
26 デューティレジスタ
27 加算回路
28 専用バス
FG 強制コンペアマッチ要求フラグ
S1〜S8 制御信号
1, 1A microcomputer 2, 2A timer 3 central processing unit (CPU)
4 Read-only memory (ROM)
5 Random access memory (RAM)
6 Internal bus 10 Counter 11 Compare register 12 Forced compare match control circuit 13 Comparison circuit 17 Match signal 20 Timer output signal 21 Dedicated line 26 Duty register 27 Adder circuit 28 Dedicated bus FG Forced compare match request flag S1 to S8 Control signal

Claims (7)

タイマと、前記タイマを制御する中央処理装置とを備えた半導体集積回路であって、
前記タイマは、クロック信号をカウントするカウンタと、
前記中央処理装置がアクセス可能なレジスタと、
前記カウンタのカウンタ値と前記レジスタの設定値とを比較する比較回路と、
前記比較回路の一致結果に応じて、出力信号をエッジ変化させる出力制御回路と、
前記出力信号の状態を変更させるための指示に応答して、前記カウンタのカウンタ値を前記レジスタにロードすると共に、前記比較回路から前記出力信号をエッジ変化させるための一致信号を出力させるコンペアマッチ制御回路と、を有し、
前記中央処理装置は、前記カウンタからロードされた値を読出し、前記値に所要の値を加算した加算結果を前記レジスタに書込むための制御を行う半導体集積回路。
A semiconductor integrated circuit comprising a timer and a central processing unit for controlling the timer,
The timer includes a counter for counting clock signals;
A register accessible to the central processing unit;
A comparison circuit for comparing the counter value of the counter with the set value of the register;
An output control circuit for changing an edge of the output signal in accordance with the result of matching of the comparison circuit;
In response to an instruction to change the state of the output signal, the counter value of the counter is loaded into the register, and a compare match control for outputting a match signal for changing the edge of the output signal from the comparison circuit A circuit,
The central processing unit is a semiconductor integrated circuit that performs control for reading a value loaded from the counter and writing an addition result obtained by adding a required value to the value to the register.
タイマと、前記タイマを制御する中央処理装置とを備えた半導体集積回路であって、
前記タイマは、クロック信号をカウントするカウンタと、
前記中央処理装置がアクセス可能な第1レジスタ及び第2レジスタと、
前記カウンタのカウンタ値と前記第1レジスタの設定値とを比較する比較回路と、
前記比較回路の一致結果に応じて、出力信号をエッジ変化させる出力制御回路と、
前記出力信号の状態を変更させるための指示に応答して、前記カウンタのカウンタ値を前記第1レジスタにロードすると共に、前記比較回路から前記出力信号をエッジ変化させるための一致信号を出力させるコンペアマッチ制御回路と、
前記出力信号の状態を変更させるための指示に応答して、前記カウンタから前記第1レジスタにロードされた値と、前記第2レジスタの所要の値とを入力して加算し、加算結果を前記第1レジスタに出力する加算回路と、を備えた半導体集積回路。
A semiconductor integrated circuit comprising a timer and a central processing unit for controlling the timer,
The timer includes a counter for counting clock signals;
A first register and a second register accessible by the central processing unit;
A comparison circuit for comparing a counter value of the counter with a set value of the first register;
An output control circuit for changing an edge of the output signal in accordance with the result of matching of the comparison circuit;
In response to an instruction to change the state of the output signal, the compare value is loaded into the first register and the match signal for changing the edge of the output signal is output from the comparison circuit. A match control circuit;
In response to an instruction to change the state of the output signal, the value loaded from the counter to the first register and the required value of the second register are input and added, and the addition result is A semiconductor integrated circuit comprising: an adder circuit that outputs the first register;
前記変更させるための指示は、前記中央処理装置と前記タイマが共通接続された内部バスとは異なる専用線によって、前記コンペアマッチ制御回路に入力される請求項1又は請求項2記載の半導体集積回路。   3. The semiconductor integrated circuit according to claim 1, wherein the instruction for changing is input to the compare match control circuit through a dedicated line different from an internal bus to which the central processing unit and the timer are commonly connected. . 前記加算回路は、前記第1レジスタに専用バスを介して接続される請求項2記載の半導体集積回路。   The semiconductor integrated circuit according to claim 2, wherein the adder circuit is connected to the first register via a dedicated bus. 中央処理装置と、前記中央処理装置によって制御されるタイマとを有し、
前記タイマは、カウンタと、
前記中央処理装置によってアクセス可能なレジスタと、
前記カウンタの計数値が前記レジスタの設定値に一致するかを判定し、一致判定に基づいて出力をエッジ変化させる出力回路と、
外部からの指示に応答して、前記出力回路の出力をエッジ変化させ、且つ、そのときの前記カウンタの計数値を前記レジスタにロードする制御回路と、を備えた半導体集積回路。
A central processing unit and a timer controlled by the central processing unit;
The timer includes a counter,
A register accessible by the central processing unit;
An output circuit that determines whether the count value of the counter matches the set value of the register, and changes the edge of the output based on the match determination;
A semiconductor integrated circuit comprising: a control circuit that changes an output of the output circuit in response to an instruction from the outside and loads a count value of the counter at that time into the register.
前記中央処理装置は、前記カウンタから前記レジスタにロードされた計数値を読込み、前記読込んだ計数値に所定の値を加算して、前記レジスタに書き戻す請求項5記載の半導体集積回路。   6. The semiconductor integrated circuit according to claim 5, wherein the central processing unit reads a count value loaded from the counter into the register, adds a predetermined value to the read count value, and writes back to the register. 前記中央処理装置によってアクセスされる別のレジスタと、
前記外部からの指示に応答して、前記カウンタから前記レジスタにロードされた計数値と前記別のレジスタの所要の値とを入力して加算し、加算結果を前記レジスタに出力する演算回路と、を更に備えた請求項5記載の半導体集積回路。
Another register accessed by the central processing unit;
In response to an instruction from the outside, a count value loaded from the counter to the register and a required value of the other register are input and added, and an arithmetic circuit that outputs the addition result to the register; 6. The semiconductor integrated circuit according to claim 5, further comprising:
JP2006008647A 2006-01-17 2006-01-17 Semiconductor integrated circuit Withdrawn JP2007193416A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006008647A JP2007193416A (en) 2006-01-17 2006-01-17 Semiconductor integrated circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006008647A JP2007193416A (en) 2006-01-17 2006-01-17 Semiconductor integrated circuit

Publications (1)

Publication Number Publication Date
JP2007193416A true JP2007193416A (en) 2007-08-02

Family

ID=38449095

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006008647A Withdrawn JP2007193416A (en) 2006-01-17 2006-01-17 Semiconductor integrated circuit

Country Status (1)

Country Link
JP (1) JP2007193416A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011099374A (en) * 2009-11-05 2011-05-19 Denso Corp Fuel injection control device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011099374A (en) * 2009-11-05 2011-05-19 Denso Corp Fuel injection control device

Similar Documents

Publication Publication Date Title
EP0987424B1 (en) Vehicle control apparatus having programs of object-oriented design
JP4743183B2 (en) Fuel injection control device
JP2007193416A (en) Semiconductor integrated circuit
EP0645532B1 (en) Fuel injection control system for an internal combustion engine
JP2018131948A (en) Control device for internal combustion engine
JP2005248721A (en) Fuel injection controller for internal combustion engine
JP4423824B2 (en) Control device for internal combustion engine
JP3849379B2 (en) ENGINE CONTROL DEVICE AND ENGINE CONTROL METHOD
JP2016130452A (en) Control device for internal combustion engine
JP6801523B2 (en) Electronic control device
KR101325500B1 (en) Modelling Method for Controlling Exhaust Gas Temperature Of Stop And Go Vehicle
JP2018131949A (en) Control device for internal combustion engine
JP2018162756A (en) Internal combustion engine controller
JP6253698B2 (en) Atmospheric pressure estimation device
JP2000105602A (en) Controlled variable operating device for vehicle
JPH0736105Y2 (en) Engine fuel controller
JPH08162933A (en) Period signal generator
KR100353988B1 (en) An engine controlling system and the controlling method without throttle position sensor
JP2001342874A (en) Fuel injection control device of internal combustion engine
JP2503466B2 (en) Fuel injection control device for internal combustion engine
JP2023094475A (en) injector controller
JP5822982B1 (en) Electronic control device for vehicle
JP2001318701A (en) Electronic controller
JP2006017054A (en) Internal combustion engine control device
JPH05248331A (en) Ignition device for internal combustion engine

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090407