JP5163475B2 - Signal processing device - Google Patents

Signal processing device Download PDF

Info

Publication number
JP5163475B2
JP5163475B2 JP2008322284A JP2008322284A JP5163475B2 JP 5163475 B2 JP5163475 B2 JP 5163475B2 JP 2008322284 A JP2008322284 A JP 2008322284A JP 2008322284 A JP2008322284 A JP 2008322284A JP 5163475 B2 JP5163475 B2 JP 5163475B2
Authority
JP
Japan
Prior art keywords
conversion
transfer request
signal
edge
pwm signal
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.)
Active
Application number
JP2008322284A
Other languages
Japanese (ja)
Other versions
JP2010146258A (en
Inventor
正幸 金子
裕也 中川
充弘 谷
茂男 東條
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
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2008322284A priority Critical patent/JP5163475B2/en
Publication of JP2010146258A publication Critical patent/JP2010146258A/en
Application granted granted Critical
Publication of JP5163475B2 publication Critical patent/JP5163475B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、A/D変換機能を有した信号処理装置に関するものである。   The present invention relates to a signal processing apparatus having an A / D conversion function.

例えば、自動車のエンジンを制御するマイクロコンピュータ(以下、マイコンともいう)として、A/D変換器を備えたものが知られている。そして、この種のマイコンでは、A/D変換器を一定時間毎に起動すると共に、その起動間隔と同じ間隔で、A/D変換器からRAMへのデータ転送(即ち、A/D変換データのRAMへの格納)を行っている(例えば、特許文献1参照)。   For example, a microcomputer equipped with an A / D converter is known as a microcomputer (hereinafter also referred to as a microcomputer) for controlling an automobile engine. In this type of microcomputer, the A / D converter is activated at regular intervals, and data is transferred from the A / D converter to the RAM at the same interval as the activation interval (that is, the A / D conversion data is converted). Storage in RAM) (see, for example, Patent Document 1).

ここで、こうしたマイコンの構成例について、図16を用い説明する。   Here, a configuration example of such a microcomputer will be described with reference to FIG.

図16に示すマイコン100は、A/D変換器11と、A/D起動タイマ13と、DMA(Direct Memory Access)コントローラ15と、RAM17と、プログラムが格納されるROM19と、ROM19内のプログラムを実行するCPU21とを備えている。   The microcomputer 100 shown in FIG. 16 includes an A / D converter 11, an A / D activation timer 13, a DMA (Direct Memory Access) controller 15, a RAM 17, a ROM 19 in which a program is stored, and a program in the ROM 19. CPU 21 to be executed.

そして、A/D変換器11は、アナログ信号が入力される入力端子を複数(この例では4つ)有すると共に、A/D変換の実施を指令するA/D変換要求信号(図16におけるTrgA)を受けると、各入力端子からの複数のアナログ信号をA/D変換するA/D変換動作を開始し、そのA/D変換動作が完了すると、A/D変換完了信号を出力する。   The A / D converter 11 has a plurality of input terminals (four in this example) to which analog signals are input, and an A / D conversion request signal (TrgA in FIG. 16) that instructs execution of A / D conversion. ), An A / D conversion operation for A / D converting a plurality of analog signals from each input terminal is started, and when the A / D conversion operation is completed, an A / D conversion completion signal is output.

また、A/D起動タイマ13は、CPU21によって設定される一定時間毎に、A/D変換器11へ上記A/D変換要求信号を出力する。このため、A/D変換器11は、そのA/D変換要求信号が出力される一定時間毎に起動することとなる。   The A / D activation timer 13 outputs the A / D conversion request signal to the A / D converter 11 at regular intervals set by the CPU 21. For this reason, the A / D converter 11 is activated at fixed time intervals when the A / D conversion request signal is output.

尚、この例のA/D変換器11は、各入力端子のアナログ信号を順次切り替えて1つのA/D変換回路でA/D変換する多チャンネルA/D変換器であり、各入力端子はA/D変換の各チャンネルch1〜ch4になっている。また、A/D変換要求信号は、A/D変換実施のトリガであることから、以下では、そのA/D変換要求信号のことを、トリガAを意味するTrgAとも言う。   The A / D converter 11 in this example is a multi-channel A / D converter that sequentially switches analog signals at each input terminal and performs A / D conversion with a single A / D conversion circuit. The channels ch1 to ch4 for A / D conversion are provided. In addition, since the A / D conversion request signal is a trigger for performing A / D conversion, the A / D conversion request signal is hereinafter also referred to as TrgA meaning trigger A.

一方、DMAコントローラ15には、A/D変換器11からのA/D変換完了信号が、A/D変換器11からRAM17へのDMA転送を指令するDMA転送要求信号(図16におけるTrgB)として与えられる。そして、DMAコントローラ15は、そのDMA転送要求信号を受けると、A/D変換器11の全チャンネル、又はCPU21によって事前に指定されているチャンネルのA/D変換データを、A/D変換器11からRAM17に転送(DMA転送)する。尚、DMA転送要求信号は、DMA転送実施のトリガであることから、以下では、A/D変換器11からDMAコントローラ15へのDMA転送要求信号のことを、トリガBを意味するTrgBとも言う。   On the other hand, the A / D conversion completion signal from the A / D converter 11 is sent to the DMA controller 15 as a DMA transfer request signal (TrgB in FIG. 16) for instructing DMA transfer from the A / D converter 11 to the RAM 17. Given. Upon receiving the DMA transfer request signal, the DMA controller 15 converts A / D conversion data of all channels of the A / D converter 11 or channels specified in advance by the CPU 21 into the A / D converter 11. To the RAM 17 (DMA transfer). Since the DMA transfer request signal is a trigger for implementing DMA transfer, the DMA transfer request signal from the A / D converter 11 to the DMA controller 15 is also referred to as TrgB, which means trigger B, below.

そして、このようなマイコン100では、A/D変換要求信号(TrgA)が発生する一定時間毎に、A/D変換器11の起動とA/D変換データのRAM17への転送とが行われることとなる。   In such a microcomputer 100, the A / D converter 11 is activated and the A / D conversion data is transferred to the RAM 17 at regular intervals when the A / D conversion request signal (TrgA) is generated. It becomes.

尚、A/D変換器からRAMへのデータ転送を、CPUによって行う構成も考えられるが、CPUの処理負荷を余分に増大させてしまうため、例えばCPUに車両のエンジン制御用の処理を実行させる場合に、高精度な処理ができなくなる可能性がある。一方、マイコンとしては、CPUによって設定される周期及びパルス幅のPWM信号を出力するPWM信号出力回路(PWM信号生成回路)を備えたものもある(例えば、特許文献2,3参照)。
特開2002−89346号公報 特開平11−214970号公報 特開平10−2248号公報
A configuration in which data transfer from the A / D converter to the RAM is performed by the CPU is also conceivable. However, since the processing load on the CPU is excessively increased, for example, the CPU executes processing for engine control of the vehicle. In some cases, high-precision processing may not be possible. On the other hand, some microcomputers include a PWM signal output circuit (PWM signal generation circuit) that outputs a PWM signal having a period and a pulse width set by the CPU (see, for example, Patent Documents 2 and 3).
JP 2002-89346 A JP 11-214970 A Japanese Patent Laid-Open No. 10-2248

上記従来の技術では、A/D変換器11の起動と、A/D変換データのRAMへの格納とを、異なる間隔で行うことができないという不便さがある。   In the above conventional technique, there is an inconvenience that activation of the A / D converter 11 and storage of the A / D conversion data in the RAM cannot be performed at different intervals.

このため、例えば、必要なサンプリング間隔が異なるアナログ信号をA/D変換する場合であって、短い間隔TSでのA/D変換データが必要なアナログ信号(必要なサンプリング間隔が短いアナログ信号)と、その間隔TSよりも長い間隔TLでのA/D変換データが取得できれば良いアナログ信号(必要なサンプリング間隔が長いアナログ信号)とがある場合に、RAM17の記憶容量の無駄が生じることとなる。   For this reason, for example, when analog signals having different required sampling intervals are A / D converted, analog signals that require A / D conversion data at short intervals TS (analog signals having a short sampling interval) and If there is an analog signal (analog signal having a long required sampling interval) that can acquire A / D conversion data at an interval TL longer than the interval TS, the storage capacity of the RAM 17 is wasted.

つまり、A/D変換器11を起動する間隔は上記短い間隔TSに合わせることとなるが、長い間隔TLでのA/D変換データが取得できれば良いアナログ信号については、必要以上に短い間隔TSでのA/D変換データがRAM17に格納されることとなるからである。また、CPU21の処理によって、RAM17から余分なA/D変換データを間引きして削除することも考えられるが、CPUの処理負荷が余分に増加してしまう。   That is, the interval at which the A / D converter 11 is activated is set to the short interval TS. However, an analog signal that only needs to acquire A / D conversion data at the long interval TL is set to an interval TS shorter than necessary. This is because the A / D conversion data is stored in the RAM 17. Further, although it is conceivable to delete the unnecessary A / D conversion data from the RAM 17 by the processing of the CPU 21, the processing load on the CPU increases excessively.

本発明は、こうした問題に鑑みなされたものであり、一定時間毎にA/D変換器を起動して複数のアナログ信号をA/D変換する信号処理装置において、何れかのアナログ信号について、それのA/D変換データのA/D変換器からメモリへのDMA転送を、A/D変換器の起動間隔とは異なる任意の間隔で行えるようにすることを目的としている。   The present invention has been made in view of these problems, and in a signal processing apparatus that activates an A / D converter at regular intervals to perform A / D conversion of a plurality of analog signals, It is an object to enable DMA transfer of A / D conversion data from an A / D converter to a memory at an arbitrary interval different from the activation interval of the A / D converter.

請求項1の信号処理装置は、プログラムを実行するCPUと、A/D変換器と、そのA/D変換器に対してA/D変換の実施を指令するためのA/D変換要求信号を一定時間毎に出力するA/D変換要求手段と、A/D変換器によってA/D変換された後のデータであるA/D変換データを格納するためのメモリと、DMAコントローラとを備えている。   The signal processing device according to claim 1 is a CPU for executing a program, an A / D converter, and an A / D conversion request signal for instructing the A / D converter to perform A / D conversion. A / D conversion requesting means for outputting at regular intervals, a memory for storing A / D conversion data which is data after A / D conversion by the A / D converter, and a DMA controller Yes.

そして、A/D変換器は、A/D変換対象のアナログ信号が入力される入力端子を複数有しており、上記A/D変換要求信号を受ける毎に、各入力端子からの複数のアナログ信号をA/D変換するA/D変換動作を開始して、該A/D変換動作が完了すると、A/D変換完了信号を出力する。   The A / D converter has a plurality of input terminals to which analog signals to be A / D converted are input, and each time the A / D conversion request signal is received, a plurality of analog terminals from each input terminal are received. When an A / D conversion operation for A / D converting the signal is started and the A / D conversion operation is completed, an A / D conversion completion signal is output.

また、DMAコントローラは、A/D変換器からのA/D変換完了信号が、A/D変換器から前記メモリへのDMA転送を指令するDMA転送要求信号として与えられるようになっており、そのDMA転送要求信号を受けると、A/D変換器からメモリへのデータ転送を行う。   The DMA controller is configured such that the A / D conversion completion signal from the A / D converter is given as a DMA transfer request signal for instructing DMA transfer from the A / D converter to the memory. When the DMA transfer request signal is received, data transfer from the A / D converter to the memory is performed.

ここで特に、請求項1の信号処理装置は、CPUにより任意に設定される周期及びパルス幅のPWM信号を出力するPWM信号出力回路と、そのPWM信号出力回路から出力されるPWM信号が入力されるデータ転送要求手段とを備えている。 In particular, the signal processing apparatus according to claim 1 receives a PWM signal output circuit that outputs a PWM signal having a period and a pulse width arbitrarily set by the CPU, and a PWM signal output from the PWM signal output circuit. Data transfer requesting means.

そして、データ転送要求手段は、PWM信号出力回路からのPWM信号に特定方向のエッジが発生すると、DMAコントローラに、前記A/D変換完了信号とは別のDMA転送要求信号を出力する。   Then, when an edge in a specific direction is generated in the PWM signal from the PWM signal output circuit, the data transfer request means outputs a DMA transfer request signal different from the A / D conversion completion signal to the DMA controller.

更に、DMAコントローラは、自己に与えられるDMA転送要求信号の各々について、A/D変換器の何れの入力端子に対応するA/D変換データを前記メモリに転送するかが、CPUによって指定されるようになっている。そして、DMAコントローラは、DMA転送要求信号の何れかを受けると、A/D変換器の各入力端子のうち、その受けたDMA転送要求信号についてCPUにより事前に指定されている入力端子に対応したA/D変換データを、A/D変換器から前記メモリに転送する。尚、入力端子に対応したA/D変換データとは、その入力端子からのアナログ信号をA/D変換したA/D変換データのことであり、以下では、単に入力端子のA/D変換データともいう。   Further, the DMA controller designates which of the input terminals of the A / D converter the A / D conversion data corresponding to the input terminal of the A / D converter is transferred to the memory for each DMA transfer request signal given to itself. It is like that. When the DMA controller receives one of the DMA transfer request signals, the DMA controller corresponds to the input terminal designated in advance by the CPU for the received DMA transfer request signal among the input terminals of the A / D converter. A / D conversion data is transferred from the A / D converter to the memory. The A / D conversion data corresponding to the input terminal is A / D conversion data obtained by A / D converting an analog signal from the input terminal. Hereinafter, the A / D conversion data of the input terminal is simply referred to as A / D conversion data. Also called.

このような信号処理装置によれば、DMAコントローラに対して、A/D変換器からのA/D変換完了信号であるDMA転送要求信号(以下、第1種DMA転送要求信号ともいう)とは別のDMA転送要求信号(以下、第2種DMA転送要求信号ともいう)を、データ転送要求手段からPMW信号の周期で与えることができる。   According to such a signal processing device, a DMA transfer request signal (hereinafter also referred to as a first type DMA transfer request signal), which is an A / D conversion completion signal from the A / D converter, to the DMA controller. Another DMA transfer request signal (hereinafter also referred to as a second type DMA transfer request signal) can be given from the data transfer request means in the cycle of the PMW signal.

そして、そのPWM信号の周期であって、第2種DMA転送要求信号の発生周期は、CPUによって(換言すればプログラムによって)PWM信号出力回路に設定する周期の値により任意に設定することができる。   The generation period of the second type DMA transfer request signal, which is the period of the PWM signal, can be arbitrarily set by the CPU (in other words, by the program) according to the period value set in the PWM signal output circuit. .

更に、DMAコントローラが、どのDMA転送要求信号を受けた場合に、A/D変換器のどの入力端子のA/D変換データをメモリにDMA転送するのかも、CPUによって任意に設定することができる。   In addition, the CPU can arbitrarily set which input terminal of the A / D converter the A / D conversion data is DMA-transferred to the memory when the DMA controller receives which DMA transfer request signal. .

よって、第2種DMA転送要求信号に対してDMA転送の対象に設定した入力端子のA/D変換データについては、A/D変換器からメモリへのDMA転送を、任意に設定可能なPWM信号の周期であって、A/D変換器の起動間隔とは異なる任意の間隔で行うことができる。   Therefore, for the A / D conversion data of the input terminal set as the DMA transfer target in response to the second type DMA transfer request signal, the PWM signal that can arbitrarily set the DMA transfer from the A / D converter to the memory. And can be performed at an arbitrary interval different from the activation interval of the A / D converter.

このため、請求項1の信号処理装置によれば、一定時間毎にA/D変換器を起動して複数のアナログ信号をA/D変換する場合に、任意のアナログ信号について、それのA/D変換データのA/D変換器からメモリへのDMA転送を、A/D変換器の起動間隔とは異なる任意の間隔で行うことができる。   For this reason, according to the signal processing apparatus of the first aspect, when the A / D converter is activated at regular intervals to perform A / D conversion of a plurality of analog signals, the A / D of any analog signal is obtained. DMA transfer of D conversion data from the A / D converter to the memory can be performed at an arbitrary interval different from the activation interval of the A / D converter.

そして更に、このことから、下記[1],[2]の効果も得られる。   Furthermore, from this, the following effects [1] and [2] can be obtained.

[1]必要なサンプリング間隔が異なるアナログ信号をA/D変換する場合であって、短い間隔TSでのA/D変換データが必要なアナログ信号(必要なサンプリング間隔が短い間隔TSであるアナログ信号)As1と、その間隔TSよりも長い間隔TLでのA/D変換データが取得できれば良いアナログ信号(必要なサンプリング間隔が長い間隔TLであるアナログ信号)As2とがある場合に、メモリの必要容量を従来よりも低減することができる。   [1] An analog signal for which A / D conversion is performed on analog signals having different required sampling intervals and which requires A / D conversion data at a short interval TS (an analog signal having a required sampling interval of a short interval TS) ) Memory capacity when there is As1 and an analog signal (analog signal whose required sampling interval is a long interval TL) As2 that can acquire A / D conversion data at an interval TL longer than the interval TS Can be reduced as compared with the prior art.

具体的に説明すると、その場合には、A/D変換器の起動間隔(A/D変換要求手段がA/D変換要求信号を出力する間隔)を、上記短い間隔TSの方である最速サンプリング間隔に合わせることとなる。   Specifically, in this case, the A / D converter activation interval (interval at which the A / D conversion request means outputs the A / D conversion request signal) is set to the fastest sampling which is the shorter interval TS. It will be adjusted to the interval.

そして、アナログ信号As1については、DMAコントローラが第1種DMA転送要求信号(A/D変換完了信号)を受けたときに、そのアナログ信号As1のA/D変換データをメモリへ転送するように設定することで、上記短い間隔TSでのA/D変換データをメモリに順次格納することができる。   The analog signal As1 is set so that when the DMA controller receives the first type DMA transfer request signal (A / D conversion completion signal), the A / D conversion data of the analog signal As1 is transferred to the memory. Thus, the A / D conversion data at the short interval TS can be sequentially stored in the memory.

また、アナログ信号As2については、DMAコントローラが第2種DMA転送要求信号を受けたときに、そのアナログ信号As2のA/D変換データをメモリへ転送するように設定すると共に、PWM信号の周期を上記長い間隔TLに設定することで、A/D変換間隔(=アナログ信号As1のサンプリング間隔)よりも長い間隔TLでのA/D変換データだけをメモリに順次格納することができる。   As for the analog signal As2, the A / D conversion data of the analog signal As2 is set to be transferred to the memory when the DMA controller receives the second type DMA transfer request signal, and the cycle of the PWM signal is set. By setting the long interval TL, only A / D conversion data at an interval TL longer than the A / D conversion interval (= sampling interval of the analog signal As1) can be sequentially stored in the memory.

よって、アナログ信号As2について、必要以上に短い間隔TSでのA/D変換データがメモリに格納されることを回避できる。また、メモリから不要なA/D変換データを間引く処理をCPUが行う必要もなくなる。   Therefore, with respect to the analog signal As2, it is possible to avoid storing A / D conversion data at intervals TS shorter than necessary in the memory. Further, it is not necessary for the CPU to perform a process of thinning out unnecessary A / D conversion data from the memory.

[2]上記アナログ信号As2のA/D変換データを、上記アナログ信号As1のA/D変換データと時間的に相関性の良いものにすることができる。   [2] The A / D conversion data of the analog signal As2 can be temporally correlated with the A / D conversion data of the analog signal As1.

なぜなら、第2種DMA転送要求信号の源(ソース)となるPWM信号の周期を、A/D変換間隔のn倍(nは1以上の整数)に設定すれば、メモリに格納されるアナログ信号As2のA/D変換データは、アナログ信号As1のサンプリング間隔のn倍の間隔でA/D変換したデータとなるからである。   This is because if the period of the PWM signal that is the source of the second type DMA transfer request signal is set to n times the A / D conversion interval (n is an integer of 1 or more), the analog signal stored in the memory This is because the A / D conversion data of As2 is A / D converted data at an interval n times the sampling interval of the analog signal As1.

尚、例えば、エンジンの冷却水温を検出するための水温センサからの信号のように、比較的長い時間をかけて値が徐々に変化していくアナログ信号がA/D変換対象ならば、それのA/D変換データを、CPUが、処理負荷の小さいときにA/D変換器から読み出してメモリに書き込むようにすることもできる。これに対して、本発明は、A/D変換データのメモリへの格納をDMAコントローラで行うため、A/D変換間隔ほどのサンプリング間隔は要らないが、そのA/D変換間隔の数倍〜数十倍程度の間隔ではサンプリングしたいアナログ信号をA/D変換する場合において、特に有効である。   For example, if an analog signal whose value gradually changes over a relatively long time, such as a signal from a water temperature sensor for detecting the cooling water temperature of the engine, is an A / D conversion target, The A / D conversion data can be read from the A / D converter and written to the memory when the CPU has a small processing load. On the other hand, in the present invention, since the A / D conversion data is stored in the memory by the DMA controller, the sampling interval as much as the A / D conversion interval is not required. An interval of several tens of times is particularly effective when A / D converting an analog signal to be sampled.

一方、A/D変換要求手段は、CPUとは別の回路であっても良いし、CPUがプログラムを実行することで実現される手段でも良い。   On the other hand, the A / D conversion requesting unit may be a circuit different from the CPU, or may be a unit realized by the CPU executing a program.

次に、PWM信号の上記特定方向のエッジであって、第2種DMA転送要求信号を発生させることとなるPWM信号の有効エッジについて述べる。   Next, an effective edge of the PWM signal, which is an edge in the specific direction of the PWM signal and that generates the second type DMA transfer request signal, will be described.

まず、PWM信号出力回路が出力するPWM信号のエッジには、立ち上がりエッジと立ち下がりエッジとがあるが、本明細書では、そのうちの一方を周期エッジと呼び、他方をデューティエッジと呼ぶ。   First, the edge of the PWM signal output from the PWM signal output circuit includes a rising edge and a falling edge. In this specification, one of them is called a periodic edge and the other is called a duty edge.

ここで、周期エッジは、CPUによってPWM信号出力回路に設定される周期及びパルス幅の各値のうち、周期の値によって発生間隔が変化し、且つ、パルス幅の値によっては発生タイミングが変化しない方のエッジである。   Here, among the period and pulse width values set in the PWM signal output circuit by the CPU, the generation interval changes depending on the period value, and the generation timing does not change depending on the pulse width value. The edge of the direction.

また、デューティエッジは、周期エッジとは逆方向のエッジであって、CPUにより設定されるパルス幅の値によって周期エッジからの発生間隔が変化する方のエッジである。尚、デューティエッジの発生間隔も、周期エッジの間隔と同じであり、CPUにより設定される周期の値によって変化する。   The duty edge is an edge in the opposite direction to the periodic edge, and is an edge whose generation interval from the periodic edge changes depending on a pulse width value set by the CPU. Note that the generation interval of the duty edge is also the same as the interval of the periodic edge, and changes depending on the value of the cycle set by the CPU.

そして、上記特定方向のエッジとしては、請求項2に記載のように、周期エッジであっても良いし、請求項3に記載のように、デューティエッジであっても良い。   The edge in the specific direction may be a periodic edge as described in claim 2 or a duty edge as described in claim 3.

また特に、デューティエッジを、上記特定方向のエッジとしたならば、下記の点で有利である。   In particular, if the duty edge is an edge in the specific direction, it is advantageous in the following points.

まず、第2種DMA転送要求信号の発生タイミング(即ち、データ転送要求手段がDMA転送要求信号を出力するタイミングであって、DMAコントローラがDMA転送を開始するタイミング)は、A/D変換器がA/D変換動作を完了してから次回のA/D変換動作を開始するまでのA/D変換停止期間中における特定タイミングであって、より詳しくは、A/D変換器でのA/D変換データが確定し、且つ、次回のA/D変換動作が開始されるまでにDMAコントローラがDMA転送を終了できるタイミングに設定するべきである。A/D変換データのメモリへの格納を確実に行えるようにするためである。   First, the generation timing of the second type DMA transfer request signal (that is, the timing at which the data transfer request means outputs the DMA transfer request signal and the DMA controller starts DMA transfer) is determined by the A / D converter. A specific timing during the A / D conversion stop period from the completion of the A / D conversion operation to the start of the next A / D conversion operation, and more specifically, the A / D in the A / D converter The timing should be set so that the DMA controller can complete the DMA transfer before conversion data is confirmed and the next A / D conversion operation is started. This is to ensure that A / D conversion data can be stored in the memory.

また、PWM信号のデューティエッジの発生タイミングは、PWM信号出力回路に設定するパルス幅の値により、周期エッジを基準にして調整することができる。   Further, the generation timing of the duty edge of the PWM signal can be adjusted on the basis of the periodic edge according to the pulse width value set in the PWM signal output circuit.

このため、請求項3に記載の信号処理装置のように、PWM信号のデューティエッジによって第2種DMA転送要求信号が発生するように構成すれば、その第2種DMA転送要求信号の発生タイミングを、PWM信号出力回路に設定するパルス幅の値により、PWM信号の周期エッジを基準にして設定することができる。   Therefore, if the second type DMA transfer request signal is generated by the duty edge of the PWM signal as in the signal processing device according to claim 3, the generation timing of the second type DMA transfer request signal is set to the generation timing. The pulse width value set in the PWM signal output circuit can be set with reference to the periodic edge of the PWM signal.

よって、PWM信号に周期エッジが発生するタイミングと、例えばA/D変換要求手段がA/D変換要求信号を出力するタイミング(即ち、A/D変換器の起動タイミング)とのずれが分かっており、且つ、PWM信号の周期の値をA/D変換間隔のn倍(nは1以上の整数)に設定すれば、PWM信号出力回路に設定するパルス幅の値のみによって、第2種DMA転送要求信号の発生タイミングを、A/D変換停止期間中における上記特定タイミングに合わせることができ、そのタイミング調整が容易となるのである。   Therefore, the difference between the timing at which the periodic edge occurs in the PWM signal and the timing at which the A / D conversion request means outputs the A / D conversion request signal (that is, the start timing of the A / D converter) is known. If the period value of the PWM signal is set to n times the A / D conversion interval (n is an integer of 1 or more), the second type DMA transfer is performed only by the pulse width value set in the PWM signal output circuit. The generation timing of the request signal can be matched with the specific timing during the A / D conversion stop period, and the timing adjustment becomes easy.

また、請求項4に記載のように、上記特定方向のエッジを、周期エッジとデューティエッジとの両方とし、データ転送要求手段が、PWM信号に周期エッジが発生したときと、PWM信号にデューティエッジが発生したときとで、別々のDMA転送要求信号をDMAコントローラに出力するように構成すれば、1つのPWM信号で2つの第2種DMA転送要求信号を生成することができる。そして、周期エッジに対応する方のDMA転送要求信号が発生したときと、デューティエッジに対応する方のDMA転送要求信号が発生したときとで、それぞれ異なる入力端子のA/D変換データをメモリに転送することができるため、その異なる入力端子のA/D変換データを、A/D変換間隔よりも長い同じ間隔で、且つ、PWM信号のパルス幅の分だけ位相がずれたタイミングで、メモリに格納することができるようになる。   According to a fourth aspect of the present invention, the edge in the specific direction is both a periodic edge and a duty edge, and when the data transfer requesting means generates a periodic edge in the PWM signal, and the duty edge in the PWM signal. If two separate DMA transfer request signals are output to the DMA controller at the time of occurrence of the above, two second type DMA transfer request signals can be generated by one PWM signal. Then, when the DMA transfer request signal corresponding to the periodic edge is generated and when the DMA transfer request signal corresponding to the duty edge is generated, A / D conversion data at different input terminals is stored in the memory. Since the data can be transferred, the A / D conversion data of the different input terminals is stored in the memory at the same interval longer than the A / D conversion interval and at a timing shifted in phase by the pulse width of the PWM signal. Can be stored.

ところで、前述したように請求項3の信号処理装置によれば、PWM信号出力回路に設定するパルス幅の値のみによって、第2種DMA転送要求信号の発生タイミングを、A/D変換停止期間中における最適な特定タイミングに合わせることができるが、そのPWM信号出力回路に設定したパルス幅の値が、何らかの原因(外乱ノイズなど)で変わってしまったとすると、第2種DMA転送要求信号の発生タイミングが最適なタイミングからずれてしまうこととなる。そこで、こうした不都合を回避するためには、請求項5の信号処理装置のように構成すると良い。   By the way, according to the signal processing device of claim 3 as described above, the generation timing of the second type DMA transfer request signal is determined during the A / D conversion stop period only by the pulse width value set in the PWM signal output circuit. However, if the pulse width value set in the PWM signal output circuit has changed for some reason (such as disturbance noise), the generation timing of the second type DMA transfer request signal Will deviate from the optimal timing. Therefore, in order to avoid such an inconvenience, the signal processing device of the fifth aspect may be configured.

即ち、請求項5の信号処理装置では、請求項3の信号処理装置において、CPUは、PWM信号の周期を、A/D変換要求信号の出力周期(A/D変換間隔)のn倍(nは1以上の整数)に設定すると共に、PWM信号のパルス幅を所定値に設定するようになっている。   That is, in the signal processing device according to claim 5, in the signal processing device according to claim 3, the CPU sets the cycle of the PWM signal to n times (n) the output cycle (A / D conversion interval) of the A / D conversion request signal. Is an integer greater than or equal to 1), and the pulse width of the PWM signal is set to a predetermined value.

そして更に、CPUは、パルス幅補正処理を行うようになっており、そのパルス幅補正処理では、データ転送要求手段がDMA転送要求信号を出力したタイミングを検出し、その検出結果に基づいて、データ転送要求手段からのDMA転送要求信号の出力タイミング(第2種DMA転送要求信号の発生タイミング)が、A/D変換器がA/D変換動作を完了してから次回のA/D変換動作を開始するまでの期間中における特定タイミングとなるように、PWM信号のパルス幅の設定値を補正する。つまり、第2種DMA転送要求信号の実際の発生タイミングを確認して、そのタイミングが目的の上記特定タイミングとなるように、パルス幅の設定値を設定し直すのである。   Further, the CPU performs pulse width correction processing. In the pulse width correction processing, the timing at which the data transfer request means outputs the DMA transfer request signal is detected, and the data is determined based on the detection result. The output timing of the DMA transfer request signal from the transfer request means (generation timing of the second type DMA transfer request signal) is the next A / D conversion operation after the A / D converter completes the A / D conversion operation. The setting value of the pulse width of the PWM signal is corrected so that the specific timing during the period until the start is reached. That is, the actual generation timing of the second type DMA transfer request signal is confirmed, and the set value of the pulse width is reset so that the timing becomes the target specific timing.

そして、このような請求項5の信号処理装置によれば、第2種DMA転送要求信号の発生タイミングが目的のタイミングからずれたままになることを防止することができる。また仮に、パルス幅の値として最初に設定した上記所定値が不適切な値であったとしても、パルス幅補正処理が行われることで、そのパルス幅の値を適切な値(即ち、第2種DMA転送要求信号の発生タイミングを上記特定タイミングにすることのできる値)へと、自動的に設定し直すことができる。   According to such a signal processing apparatus of the fifth aspect, it is possible to prevent the generation timing of the second type DMA transfer request signal from deviating from the target timing. Even if the predetermined value initially set as the pulse width value is an inappropriate value, the pulse width correction process is performed, so that the pulse width value is changed to an appropriate value (that is, the second value). The generation timing of the seed DMA transfer request signal can be automatically reset to a value that can be the specific timing).

尚、パルス幅補正処理は、定期的に行われるようにすることが好ましいが、例えば、当該信号処理装置が起動した後の所定タイミングで一回だけ行われるようにしても良い。   The pulse width correction process is preferably performed periodically, but may be performed only once at a predetermined timing after the signal processing apparatus is activated, for example.

また、パルス幅補正処理としては、具体的には、請求項6に記載のような第1〜第3の補正処理のうちの少なくとも1つが考えられる。   As the pulse width correction process, specifically, at least one of the first to third correction processes as described in claim 6 can be considered.

即ち、第1の補正処理は、データ転送要求手段がDMA転送要求信号を出力する直前にA/D変換器がA/D変換動作を完了した時刻から、データ転送要求手段がDMA転送要求信号を出力するまでの時間であるA/D変換完了後余裕時間を、DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、A/D変換完了後余裕時間が該A/D変換完了後余裕時間の目標値となるように、PWM信号のパルス幅の設定値を補正する、という処理である。   In other words, the first correction processing is performed by the data transfer request unit receiving the DMA transfer request signal from the time when the A / D converter completes the A / D conversion operation immediately before the data transfer request unit outputs the DMA transfer request signal. The margin time after completion of A / D conversion, which is the time until output, is detected as the output timing of the DMA transfer request signal, and the margin time after completion of A / D conversion is completed based on the detection result This is a process of correcting the set value of the pulse width of the PWM signal so that the target value of the rear margin time is obtained.

また、第2の補正処理は、データ転送要求手段がDMA転送要求信号を出力してからA/D変換器が次回の前記A/D変換動作を開始するまでの時間であるA/D変換開始前余裕時間を、DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、A/D変換開始前余裕時間が該A/D変換開始前余裕時間の目標値となるように、PWM信号のパルス幅の設定値を補正する、という処理である。   In the second correction process, A / D conversion start is a time from when the data transfer request means outputs a DMA transfer request signal until the A / D converter starts the next A / D conversion operation. The previous margin time is detected as the output timing of the DMA transfer request signal, and the PWM is set so that the margin time before the start of A / D conversion becomes the target value of the margin time before the start of A / D conversion based on the detection result. This is a process of correcting the set value of the pulse width of the signal.

そして、第3の補正処理は、データ転送要求手段がDMA転送要求信号を出力する直前にA/D変換器がA/D変換動作を開始した時刻から、データ転送要求手段がDMA転送要求信号を出力するまでの時間であるA/D変換開始後余裕時間を、DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、A/D変換開始後余裕時間が該A/D変換開始後余裕時間の目標値となるように、PWM信号のパルス幅の設定値を補正する、という処理である。   In the third correction process, the data transfer request means outputs the DMA transfer request signal from the time when the A / D converter starts the A / D conversion operation immediately before the data transfer request means outputs the DMA transfer request signal. The margin time after the start of A / D conversion, which is the time until output, is detected as the output timing of the DMA transfer request signal, and the margin time after the start of A / D conversion is started based on the detection result This is a process of correcting the set value of the pulse width of the PWM signal so that the target value of the rear margin time is obtained.

尚、この第3の補正処理の場合、A/D変換開始後余裕時間の目標値は、第1の補正処理におけるA/D変換完了後余裕時間の目標値に対して、A/D変換器のA/D変換動作時間を加えた値となる。   In the case of the third correction process, the target value of the margin time after the start of A / D conversion is an A / D converter with respect to the target value of the margin time after the completion of A / D conversion in the first correction process. A / D conversion operation time is added.

一方、請求項4の信号処理装置においても、PWM信号のデューティエッジによって第2種DMA転送要求信号を発生させるという点では、請求項3の信号処理装置と同じである。   On the other hand, the signal processing device according to claim 4 is the same as the signal processing device according to claim 3 in that the second type DMA transfer request signal is generated by the duty edge of the PWM signal.

そのため、請求項7の信号処理装置では、請求項4の信号処理装置において、請求項5の信号処理装置と同様に、CPUが、PWM信号の周期を、A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定すると共に、PWM信号のパルス幅を所定値に設定するようになっており、更に、デューティエッジに対応する方のDMA転送要求信号について、請求項5の信号処理装置と同様のパルス幅補正処理を行うようになっている。尚、デューティエッジに対応する方のDMA転送要求信号とは、PWM信号にデューティエッジが発生したときに、データ転送要求手段が出力するDMA転送要求信号のことである。   Therefore, in the signal processing device according to claim 7, in the signal processing device according to claim 4, as in the signal processing device according to claim 5, the CPU sets the cycle of the PWM signal to the output cycle of the A / D conversion request signal. The DMA transfer request signal is set to n times (n is an integer of 1 or more), the pulse width of the PWM signal is set to a predetermined value, and the DMA transfer request signal corresponding to the duty edge. The same pulse width correction processing as that of the signal processing apparatus is performed. The DMA transfer request signal corresponding to the duty edge is a DMA transfer request signal output by the data transfer request means when a duty edge occurs in the PWM signal.

そして、その請求項7の信号処理装置によれば、請求項5の信号処理装置について述べた効果と同じ効果を、デューティエッジに対応する方のDMA転送要求信号に関して得ることができる。   According to the signal processing device of claim 7, the same effect as that described for the signal processing device of claim 5 can be obtained with respect to the DMA transfer request signal corresponding to the duty edge.

また、請求項7に記載のパルス幅補正処理としては、具体的には、請求項8に記載のような第1〜第3の補正処理のうちの少なくとも1つが考えられる。尚、その第1〜第3の補正処理は、請求項6に記載の第1〜第3の補正処理を、デューティエッジに対応する方のDMA転送要求信号について行うものである。   Further, as the pulse width correction process according to claim 7, specifically, at least one of the first to third correction processes as described in claim 8 can be considered. In the first to third correction processes, the first to third correction processes described in claim 6 are performed on the DMA transfer request signal corresponding to the duty edge.

ところで、第2種DMA転送要求信号の発生タイミングが常に前述の特定タイミングとなるようにするためには、PWM信号の周期をA/D変換間隔のn倍(nは1以上の整数)に設定することとなるが、CPUによってPWM信号出力回路に設定された周期の値が、何らかの原因(外乱ノイズなど)で変わってしまったとすると、第2種DMA転送要求信号の発生タイミングが最適な特定タイミングからずれてしまうこととなる。そこで、こうした不都合を回避するためには、請求項9の信号処理装置のように構成すると良い。   By the way, in order to make the generation timing of the second type DMA transfer request signal always be the above-mentioned specific timing, the period of the PWM signal is set to n times the A / D conversion interval (n is an integer of 1 or more). However, if the period value set in the PWM signal output circuit by the CPU has changed for some reason (such as disturbance noise), the generation timing of the second type DMA transfer request signal is the optimum specific timing. It will shift from. Therefore, in order to avoid such an inconvenience, the signal processing device of the ninth aspect may be configured.

即ち、請求項9の信号処理装置では、請求項1〜3,5,6の信号処理装置において、CPUは、PWM信号の周期を、A/D変換要求信号の出力周期(A/D変換間隔)のn倍(nは1以上の整数)に設定するようになっている。そして更に、CPUは、周期補正処理を行うようになっており、その周期補正処理では、データ転送要求手段がDMA転送要求信号を出力する間隔である信号出力間隔と、A/D変換器がA/D変換動作を行う間隔であるA/D変換間隔の前記n倍の間隔と検出し、その両検出値の差に基づいて、前記信号出力間隔がA/D変換間隔の前記n倍の間隔と等しくなるように、PWM信号の周期の設定値を補正する。つまり、第2種DMA転送要求信号の実際の発生間隔を確認して、その発生間隔が、実際のA/D変換間隔のn倍となるように、周期の設定値を設定し直すのである。   That is, in the signal processing device according to claim 9, in the signal processing devices according to claims 1 to 3, 5, and 6, the CPU determines the period of the PWM signal as the output period of the A / D conversion request signal (A / D conversion interval). ) N times (n is an integer of 1 or more). Further, the CPU performs a period correction process. In the period correction process, the data transfer request unit outputs a DMA transfer request signal, and the A / D converter has an A / D converter. It is detected that the interval is n times the A / D conversion interval, which is an interval for performing the / D conversion operation, and the signal output interval is the n times the A / D conversion interval based on the difference between the detected values. The set value of the period of the PWM signal is corrected so as to be equal to. That is, the actual generation interval of the second type DMA transfer request signal is confirmed, and the set value of the cycle is reset so that the generation interval is n times the actual A / D conversion interval.

そして、このような請求項9の信号処理装置によれば、第2種DMA転送要求信号の発生タイミングが目的のタイミングからずれたままになることを防止することができる。   According to such a signal processing apparatus of the ninth aspect, it is possible to prevent the generation timing of the second type DMA transfer request signal from deviating from the target timing.

尚、周期補正処理は、定期的に行われるようにすることが好ましいが、例えば、当該信号処理装置が起動した後の所定タイミングで一回だけ行われるようにしても良い。   The period correction process is preferably performed periodically, but may be performed only once at a predetermined timing after the signal processing apparatus is activated, for example.

また、請求項10の信号処理装置では、請求項4,7,8の信号処理装置において、請求項9の信号処理装置と同様に、CPUが、PWM信号の周期を、A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定するようになっており、更に、デューティエッジに対応する方のDMA転送要求信号、又は周期エッジに対応する方のDMA転送要求信号について、請求項9の信号処理装置と同様の周期補正処理を行うようになっている。尚、周期エッジに対応する方のDMA転送要求信号とは、PWM信号に周期エッジが発生したときに、データ転送要求手段が出力するDMA転送要求信号のことである。   Further, in the signal processing device according to claim 10, in the signal processing devices according to claims 4, 7, and 8, as in the case of the signal processing device according to claim 9, the CPU converts the period of the PWM signal into an A / D conversion request signal. Is set to n times (n is an integer equal to or greater than 1), and the DMA transfer request signal corresponding to the duty edge or the DMA transfer request signal corresponding to the cycle edge The same period correction processing as that of the signal processing device of claim 9 is performed. The DMA transfer request signal corresponding to the periodic edge is a DMA transfer request signal output by the data transfer request means when a periodic edge occurs in the PWM signal.

具体的には、請求項10の信号処理装置における周期補正処理では、データ転送要求手段がデューティエッジに対応する方のDMA転送要求信号を出力する間隔とデータ転送要求手段が周期エッジに対応する方のDMA転送要求信号を出力する間隔との何れかを、信号出力間隔として検出すると共に、A/D変換器がA/D変換動作を行う間隔であるA/D変換間隔のn倍の間隔を検出し、その両検出値の差に基づいて、前記信号出力間隔がA/D変換間隔の前記n倍の間隔と等しくなるように、PWM信号の周期の設定値を補正する。   Specifically, in the period correction processing in the signal processing device according to claim 10, the interval at which the data transfer request means outputs the DMA transfer request signal corresponding to the duty edge and the data transfer request means corresponding to the period edge. The interval of outputting the DMA transfer request signal is detected as a signal output interval, and an interval of n times the A / D conversion interval, which is the interval at which the A / D converter performs the A / D conversion operation, is detected. Based on the difference between the two detection values, the setting value of the period of the PWM signal is corrected so that the signal output interval is equal to the n times the A / D conversion interval.

そして、その請求項10の信号処理装置によっても、請求項9の信号処理装置と同様に、第2種DMA転送要求信号の発生タイミングが目的のタイミングからずれたままになることを防止することができる。   The signal processing device according to claim 10 can prevent the generation timing of the second type DMA transfer request signal from deviating from the target timing, similarly to the signal processing device according to claim 9. it can.

次に、請求項11の信号処理装置は、請求項1〜10の信号処理装置において、PWM信号出力回路及びデータ転送要求手段を複数組備えている。   Next, a signal processing device according to an eleventh aspect is the signal processing device according to the first to tenth aspects, comprising a plurality of sets of PWM signal output circuits and data transfer requesting means.

この請求項11の信号処理装置によれば、複数の第2種DMA転送要求信号を異なる周期で発生させることができ、また、その各第2種DMA転送要求信号について、DMAコントローラがA/D変換器のどの入力端子に対応するA/D変換データをメモリにDMA転送するのかも、CPUによって任意に設定することができる。このため、A/D変換器の異なる入力端子に対応する各A/D変換データを、A/D変換間隔とは異なる複数通りの各周期で、メモリにそれぞれ転送することができるようになる。   According to the signal processing device of claim 11, a plurality of second type DMA transfer request signals can be generated at different periods, and the DMA controller performs A / D for each of the second type DMA transfer request signals. The CPU can arbitrarily set whether the A / D conversion data corresponding to which input terminal of the converter is DMA-transferred to the memory. For this reason, each A / D conversion data corresponding to a different input terminal of the A / D converter can be transferred to the memory in each of a plurality of periods different from the A / D conversion interval.

以下に、本発明が適用された実施形態の信号処理装置としてのマイコンについて説明する。尚、本実施形態のマイコンは、例えば、車両のコモンレール式ディーゼルエンジンを制御する電子制御装置(以下、ECUという)に搭載されて、そのエンジンを制御するための処理を実行するが、以下では、本発明に直接関係する部分について説明する。
[第1実施形態]
図1に示すように、本実施形態のマイコン10は、図16に示したマイコン100と比較すると、PWM信号出力回路23とタイマユニット25を更に備えている点と、DMAコントローラ15に代わるDMAコントローラ16を備えている点とが異なっている。尚、図1において、図16と同じ構成要素については、同一の符号を付しているため、説明を省略する。
A microcomputer as a signal processing apparatus according to an embodiment to which the present invention is applied will be described below. The microcomputer of the present embodiment is mounted on, for example, an electronic control device (hereinafter referred to as an ECU) that controls a common rail diesel engine of a vehicle and executes processing for controlling the engine. The part directly related to the present invention will be described.
[First Embodiment]
As shown in FIG. 1, the microcomputer 10 of this embodiment is further provided with a PWM signal output circuit 23 and a timer unit 25 as compared with the microcomputer 100 shown in FIG. 16, and a DMA controller in place of the DMA controller 15. 16 is different. In FIG. 1, the same components as those in FIG. 16 are denoted by the same reference numerals, and description thereof is omitted.

PWM信号出力回路23は、CPU21によってPWM信号の周期の値(周期値)とパルス幅の値(パルス幅値)とがそれぞれ書き込まれる周期値レジスタ23a及びパルス幅値レジスタ23bを備えており、上記周期値レジスタ23aに書き込まれた値の周期を有し、且つ、上記パルス幅値レジスタ23bに書き込まれた値のパルス幅を有したPWM信号を生成して、そのPWM信号を当該マイコン10の信号出力端子J1から外部に出力する。尚、こうしたPWM信号出力回路23は、例えば前述の特許文献2に記載されており、その特許文献2では、PWM信号のパルス幅値のことを、デューティ値と称している。   The PWM signal output circuit 23 includes a period value register 23a and a pulse width value register 23b into which a value of the PWM signal period (period value) and a value of the pulse width (pulse width value) are written by the CPU 21, respectively. A PWM signal having a period of the value written in the period value register 23a and a pulse width of the value written in the pulse width value register 23b is generated, and the PWM signal is used as a signal of the microcomputer 10 Output from the output terminal J1 to the outside. Such a PWM signal output circuit 23 is described in, for example, the above-described Patent Document 2, and in Patent Document 2, the pulse width value of the PWM signal is referred to as a duty value.

また、本実施形態においては、PWM信号のエッジのうち、立ち上がりエッジが前述の周期エッジであり、立ち下がりエッジが前述のデューティエッジである。そして、図2に示すように、本実施形態におけるPWM信号では、立ち上がりから立ち下がりまで(周期エッジからデューティエッジまで)のハイ時間が、上記パルス幅値レジスタ23bの値に該当する時間幅を有したパルス幅Tdutyである。尚、図2において、Tpwmは、PWM信号の周期であって、周期エッジの間隔であるが、当然デューティエッジの間隔もTpwmと同じである。   In this embodiment, among the edges of the PWM signal, the rising edge is the above-described periodic edge, and the falling edge is the above-described duty edge. As shown in FIG. 2, in the PWM signal in the present embodiment, the high time from the rising edge to the falling edge (from the cycle edge to the duty edge) has a time width corresponding to the value of the pulse width value register 23b. The pulse width Tduty. In FIG. 2, Tpwm is the period of the PWM signal and is the interval between the periodic edges, but naturally the interval between the duty edges is also the same as Tpwm.

タイマユニット25は、フリーランタイマ回路や、タイマ割込を発生させるための回路や、インプットキャプチャ機能の回路を有したブロックである。そして、図16では図示を省略したが、そのタイマユニット25と同様のものは、図16に示したマイコン100にも備えられる。   The timer unit 25 is a block having a free-run timer circuit, a circuit for generating a timer interrupt, and a circuit for an input capture function. Although not shown in FIG. 16, the same unit as the timer unit 25 is also provided in the microcomputer 100 shown in FIG.

但し、本実施形態のマイコン10に備えられたタイマユニット25は、更に、当該マイコン10の信号入力端子J2からの入力信号に特定方向のエッジが発生すると、DMAコントローラ16に、A/D変換完了信号(TrgB)とは別のDMA転送要求信号を出力するDMA転送要求機能の回路25aを有している。   However, the timer unit 25 provided in the microcomputer 10 of the present embodiment further completes the A / D conversion to the DMA controller 16 when an edge in a specific direction occurs in the input signal from the signal input terminal J2 of the microcomputer 10. A DMA transfer request function circuit 25a for outputting a DMA transfer request signal different from the signal (TrgB) is provided.

そして、上記信号入力端子J2は、当該マイコン10の外部の配線により、上記信号出力端子J1と接続されている。このため、タイマユニット25には、PWM信号出力回路23によってマイコン10の外部に出力されたPWM信号が、信号入力端子J2から入力される。   The signal input terminal J2 is connected to the signal output terminal J1 by an external wiring of the microcomputer 10. For this reason, the PWM signal output to the outside of the microcomputer 10 by the PWM signal output circuit 23 is input to the timer unit 25 from the signal input terminal J2.

また、本実施形態において、上記特定方向のエッジは、立ち下がりエッジである。つまり、タイマユニット25(詳しくは、上記DMA転送要求機能の回路25a)は、信号入力端子J2からの入力信号に立ち下がりエッジが発生すると、DMAコントローラ16にDMA転送要求信号を出力するようになっている。   In the present embodiment, the edge in the specific direction is a falling edge. That is, the timer unit 25 (specifically, the DMA transfer request function circuit 25a) outputs a DMA transfer request signal to the DMA controller 16 when a falling edge occurs in the input signal from the signal input terminal J2. ing.

よって、タイマユニット25は、PWM信号出力回路23からのPWM信号に、立ち下がりエッジであるデューティエッジが生じると、DMAコントローラ16にDMA転送要求信号を出力することとなる。尚、そのタイマユニット25からDMAコントローラ16へのDMA転送要求信号も、DMA転送実施のトリガであることから、以下では、そのタイマユニット25からの上記DMA転送要求信号のことを、トリガCを意味するTrgCとも言う。   Therefore, the timer unit 25 outputs a DMA transfer request signal to the DMA controller 16 when a duty edge that is a falling edge occurs in the PWM signal from the PWM signal output circuit 23. Since the DMA transfer request signal from the timer unit 25 to the DMA controller 16 is also a trigger for DMA transfer, the DMA transfer request signal from the timer unit 25 means trigger C below. Also referred to as TrgC.

DMAコントローラ16は、自己に与えられるDMA転送要求信号(本実施形態では、A/D変換器11からのTrgBと、タイマユニット25からのTrgC)の各々について、A/D変換器11の何れの入力端子に対応するA/D変換データをRAM17に転送するか(即ち、A/D変換器11のどのチャンネルのA/D変換データをRAM17に転送するか)がCPU21によって指定(設定)されるようになっている。そして、DMAコントローラ16は、DMA転送要求信号の何れかを受けると、A/D変換器11のチャンネルのうち、その受けたDMA転送要求信号についてCPU21により事前に転送対象として指定されているチャンネルのA/D変換データを、A/D変換器11からRAM17に転送(DMA転送)する。   For each of the DMA transfer request signals (TrgB from the A / D converter 11 and TrgC from the timer unit 25 in this embodiment) given to itself, the DMA controller 16 determines which of the A / D converters 11 The CPU 21 designates (sets) whether the A / D conversion data corresponding to the input terminal is transferred to the RAM 17 (that is, which channel of the A / D converter 11 is transferred to the RAM 17). It is like that. Upon receiving any of the DMA transfer request signals, the DMA controller 16 selects a channel of the A / D converter 11 that is designated as a transfer target in advance by the CPU 21 for the received DMA transfer request signal. The A / D conversion data is transferred from the A / D converter 11 to the RAM 17 (DMA transfer).

一方、図1に示すように、マイコン10が搭載されたECU1の制御対象であるエンジン3では、そのエンジン3の各気筒(本実施形態では4気筒の各々)へコモンレールからの燃料を噴射する各インジェクタIJ1〜IJ4に、そのインジェクタIJ1〜IJ4内の燃料圧(以下、インジェクタ圧という)を検出する圧力センサS1〜S4が設けられている。   On the other hand, as shown in FIG. 1, in the engine 3 that is the control target of the ECU 1 in which the microcomputer 10 is mounted, each fuel that is injected from the common rail into each cylinder of the engine 3 (four cylinders in the present embodiment). The injectors IJ1 to IJ4 are provided with pressure sensors S1 to S4 for detecting fuel pressure in the injectors IJ1 to IJ4 (hereinafter referred to as injector pressure).

そして、その各圧力センサS1〜S4からのアナログ信号であるインジェクタ圧信号P1〜P4が、ECU1に設けられた入力回路5を介して、マイコン10内におけるA/D変換器11の各チャンネル(各入力端子)ch1〜ch4に入力されるようになっている。   The injector pressure signals P1 to P4, which are analog signals from the pressure sensors S1 to S4, are sent to the channels (each of the A / D converter 11 in the microcomputer 10 via the input circuit 5 provided in the ECU 1). Input terminals) are input to ch1 to ch4.

次に、マイコン10における各部の動作等について説明する。   Next, the operation of each part in the microcomputer 10 will be described.

図2に示すように、マイコン10では、A/D起動タイマ13が、CPU21によって設定された一定時間毎に、A/D変換器11へ、A/D変換要求信号であるTrgAを出力する。そして、A/D変換器11は、そのTrgAが出力される毎に起動して、各チャンネルch1〜ch4のアナログ信号(即ち、各気筒のインジェクタ圧信号P1〜P4)を順次(本実施形態ではチャンネル番号が小さいものから順に)A/D変換し、そのA/D変換動作が完了すると、DMAコントローラ16へ、A/D変換完了信号且つDMA転送要求信号であるTrgBを出力する。   As shown in FIG. 2, in the microcomputer 10, the A / D activation timer 13 outputs TrgA, which is an A / D conversion request signal, to the A / D converter 11 at regular intervals set by the CPU 21. The A / D converter 11 is activated each time the TrgA is output, and sequentially outputs the analog signals of the channels ch1 to ch4 (that is, the injector pressure signals P1 to P4 of each cylinder) (in this embodiment). When A / D conversion is performed (in order from the smallest channel number) and the A / D conversion operation is completed, an A / D conversion completion signal and TrgB which is a DMA transfer request signal are output to the DMA controller 16.

また、A/D起動タイマ13からのTrgAの出力周期であってA/D変換間隔である上記一定時間は、何れかの気筒のインジェクタ圧信号P1〜P4をサンプリングする最小の間隔(本実施形態では例えば20μs)に設定されている。   In addition, the output time of TrgA from the A / D activation timer 13 and the above-mentioned fixed time which is the A / D conversion interval is the minimum interval for sampling the injector pressure signals P1 to P4 of any cylinder (this embodiment) For example, it is set to 20 μs).

一方、PWM信号出力回路23の周期値レジスタ23aには、TrgAの出力周期のn倍(nは1以上の整数であり、本実施形態ではn=2)の時間に相当する値がCPU21によりセットされる。   On the other hand, in the period value register 23a of the PWM signal output circuit 23, the CPU 21 sets a value corresponding to a time that is n times the output period of TrgA (n is an integer of 1 or more, and n = 2 in this embodiment). Is done.

このため、図2に示すように、PWM信号出力回路23からは、周期TpwmがTrgAの周期の2倍であるPWM信号が出力される。   For this reason, as shown in FIG. 2, the PWM signal output circuit 23 outputs a PWM signal having a cycle Tpwm that is twice the cycle of TrgA.

そして、そのPWM信号にデューティエッジ(立ち下がりエッジ)が生じる毎に、タイマユニット25からDMAコントローラ16へ、TrgBとは別のDMA転送要求信号(第2種DMA転送要求信号)であるTrgCが出力される。尚、PWM信号のデューティエッジも、周期エッジと同様に、そのPWM信号の周期Tpwm毎に生じるため、TrgCは、TrgA及びTrgBの発生周期の2倍の周期で発生することとなる。   Each time a duty edge (falling edge) is generated in the PWM signal, TrgC, which is a DMA transfer request signal (second type DMA transfer request signal) different from TrgB, is output from the timer unit 25 to the DMA controller 16. Is done. Note that the duty edge of the PWM signal is also generated every period Tpwm of the PWM signal, similarly to the periodic edge, so that TrgC is generated at a period twice as long as the generation period of TrgA and TrgB.

また、PWM信号出力回路23のパルス幅値レジスタ23bには、図3に示すように、TrgCの発生タイミングが、A/D変換器11のA/D変換動作が完了してから次回のA/D変換動作が開始されるまでのA/D変換停止期間中における特定タイミングとなるように、CPU21によって値がセットされる。そして、その特定タイミングとは、A/D変換器11での全チャンネルのA/D変換データが確定し、且つ、次回のA/D変換動作が開始されるまでにDMAコントローラ16がDMA転送を終了できるタイミングである。尚、このように設定するのは、TrgCによるA/D変換データのRAM17へのDMA転送を確実に行えるようにするためである。   In addition, as shown in FIG. 3, the pulse width value register 23b of the PWM signal output circuit 23 indicates that the generation timing of TrgC is the next A / D converter after the A / D conversion operation of the A / D converter 11 is completed. A value is set by the CPU 21 so as to be a specific timing during the A / D conversion stop period until the D conversion operation is started. The specific timing means that the A / D conversion data of all channels in the A / D converter 11 is fixed and the DMA controller 16 performs DMA transfer until the next A / D conversion operation is started. It is time to finish. The reason for setting in this way is to ensure that DMA transfer of A / D conversion data to the RAM 17 by TrgC can be performed.

ここで、パルス幅値レジスタ23bに設定するパルス幅値について、図4を用い更に詳しく説明する。   Here, the pulse width value set in the pulse width value register 23b will be described in more detail with reference to FIG.

まず、CPU21は、動作を開始して、初期設定処理により、TrgAの出力周期の設定と、PWM信号の周期値及びパルス幅値の設定を行った後、A/D起動タイマ13とPWM信号出力回路23を起動するが、その両者の起動時間差は、図4に示すように、A/D起動タイマ13からのTrgAの出力タイミングと、PWM信号出力回路23からのPWM信号に周期エッジが発生するタイミングとの時間差Tsdとして現れる。そして、その時間差Tsdは既知である。尚、本実施形態において、CPU21は、A/D起動タイマ13とPWM信号出力回路23とを、プログラム中の連続した各処理ステップで順次起動するようになっている。そして、上記時間差Tsdは、その各処理ステップの実行時間差と、CPU21がA/D起動タイマ13の起動処理を行ってから該A/D起動タイマ13が動作を開始してTrgAを出力するまでの時間と、CPU21がPWM信号出力回路23の起動処理を行ってから該PWM信号出力回路23が動作を開始してPWM信号を最初にハイへと変化させるまでの時間とから計算することができる。   First, the CPU 21 starts the operation, sets the output cycle of TrgA, sets the cycle value of the PWM signal and the pulse width value by the initial setting process, and then outputs the A / D start timer 13 and the PWM signal output. As shown in FIG. 4, the circuit 23 is activated, and the difference in activation time between the two causes a periodic edge in the output timing of the TrgA from the A / D activation timer 13 and the PWM signal from the PWM signal output circuit 23. It appears as a time difference Tsd from the timing. The time difference Tsd is known. In the present embodiment, the CPU 21 sequentially starts the A / D start timer 13 and the PWM signal output circuit 23 at successive processing steps in the program. The time difference Tsd is the difference between the execution time of each processing step and the time from when the CPU 21 starts the A / D start timer 13 until the A / D start timer 13 starts operating and outputs TrgA. It can be calculated from the time and the time from when the CPU 21 starts the PWM signal output circuit 23 to when the PWM signal output circuit 23 starts operating to first change the PWM signal to high.

また、図4において、時刻Tsadは、パルス幅値を決定するための基準となるTrgAの出力タイミングであり、時刻Ttrgは、TrgCを発生させたい目標の上記特定タイミングであり、時間Ttgは、時刻Tsadから時刻Ttrgまでの時間であって、TrgAが発生してからTrgCを発生させるまでの時間である。   In FIG. 4, time Tsad is the output timing of TrgA serving as a reference for determining the pulse width value, time Ttrg is the target specific timing at which TrgC is to be generated, and time Ttg is time This is the time from Tsad to time Ttrg until TrgC is generated after TrgA is generated.

そして、Tiadは、TrgAの出力タイミングからA/D変換器11がA/D変換動作を完了するまでのA/D変換時間(A/D変換動作をする時間)である。   Tiad is an A / D conversion time (time for the A / D conversion operation) from the output timing of TrgA until the A / D converter 11 completes the A / D conversion operation.

また、余裕時間Tmaは、A/D変換器11がA/D変換動作を完了した時刻(A/D変換完了時刻)Teadから、TrgCを発生させたい目標の時刻Ttrgまでの時間である。そして、その余裕時間Tmaは、A/D変換器11でのA/D変換動作が完了してから全チャンネルのA/D変換データが確定してDMA転送を開始できるまでの最大時間と同じか、それよりも若干の余裕分だけ長い時間である。   The margin time Tma is the time from the time (A / D conversion completion time) Tead when the A / D converter 11 completes the A / D conversion operation to the target time Ttrg at which TrgC is to be generated. Whether the margin time Tma is the same as the maximum time from the completion of the A / D conversion operation in the A / D converter 11 until the A / D conversion data of all channels is determined and the DMA transfer can be started. It ’s a little longer than that.

また、余裕時間Tmbは、TrgCを発生させたい目標の時刻Ttrgから、TrgAの次の出力タイミングまでの時間である。そして、その余裕時間Tmbは、DMAコントローラ16によるDMA転送に必要な最大時間と同じか、それよりも若干の余裕分だけ長い時間である。   The margin time Tmb is the time from the target time Ttrg at which TrgC is to be generated to the next output timing of TrgA. The margin time Tmb is the same as the maximum time required for the DMA transfer by the DMA controller 16 or a time slightly longer than that.

更に、「Tma+Tmb」は、A/D変換完了時刻TeadからTrgAの次の出力タイミングまでの時間(換言すれば、TrgAの出力周期であるA/D変換間隔TadからA/D変換時間Tiadを引いた残りの時間)と等しくなるように定められている。   Furthermore, “Tma + Tmb” is the time from the A / D conversion completion time Tead to the next output timing of TrgA (in other words, the A / D conversion time Tad is subtracted from the A / D conversion interval Tad which is the output cycle of TrgA). The remaining time).

一方、図4において、Tdutyは、PWM信号のパルス幅であり、Tidは、PWM信号にデューティエッジが発生してから、タイマユニット25がTrgCを出力するまでのハードウェア上の遅れ時間である。   On the other hand, in FIG. 4, Tduty is the pulse width of the PWM signal, and Tid is the delay time in hardware from when the duty edge occurs in the PWM signal until the timer unit 25 outputs TrgC.

そして、図4から明らかなように、下記の式1が成立し、その式1を変形すると、下記の式2となる。   As is clear from FIG. 4, the following expression 1 is established, and when the expression 1 is modified, the following expression 2 is obtained.

Ttg=Tiad+Tma=Tsd+Tduty+Tid …式1
Tduty=Tiad+Tma−(Tsd+Tid) …式2
よって、パルス幅値レジスタ23bに、「Tiad+Tma−(Tsd+Tid)」の時間に相当する値をセットすれば、TrgCを、A/D変換データのRAM17へのDMA転送が確実に行える上記特定タイミングで発生させることができる。
Ttg = Tiad + Tma = Tsd + Tduty + Tid Equation 1
Tduty = Tad + Tma− (Tsd + Tid) Equation 2
Therefore, if a value corresponding to the time of “Tiad + Tma− (Tsd + Tid)” is set in the pulse width value register 23b, TrgC is generated at the above specific timing at which DMA transfer of the A / D conversion data to the RAM 17 can be performed reliably. Can be made.

このため、CPU21は、上記初期設定処理において、パルス幅値レジスタ23bに、「Tiad+Tma−(Tsd+Tid)」の時間に相当する値をセットするようになっている。   Therefore, the CPU 21 sets a value corresponding to the time “Tiad + Tma− (Tsd + Tid)” in the pulse width value register 23b in the initial setting process.

尚、PWM信号のパルス幅Tdutyを、A/D変換間隔Tad以上の値に設定することも考えられる。そして、Tdutyを、Tadのm倍(mは1以上の整数)以上で、且つ、Tadの「m+1」倍未満の範囲内に設定するのであれば、上記式1及び式2における「Tiad」を、「Tad×m+Tiad」に置き換えれば良い。   It is also conceivable to set the pulse width Tduty of the PWM signal to a value greater than or equal to the A / D conversion interval Tad. If Tduty is set within a range that is greater than or equal to m times Tad (m is an integer equal to or greater than 1) and less than “m + 1” times Tad, “Tiad” in Equation 1 and Equation 2 above is set. , “Tad × m + Tiad”.

一方、CPU21は、TrgBとTrgCとの各々ついて、DMAコントローラ16がDMA転送の対象とするA/D変換器11のチャンネル(以下、転送対象A/Dチャンネルという)を、下記のように切り替える。   On the other hand, for each of TrgB and TrgC, the CPU 21 switches the channel of the A / D converter 11 (hereinafter referred to as a transfer target A / D channel) that the DMA controller 16 targets for DMA transfer as follows.

まず、TrgBについての転送対象A/Dチャンネルは、各気筒の燃料噴射タイミングを含む180°CA分の期間毎に、その今回の180°CA分の期間中において燃料噴射タイミングが到来する気筒のインジェクタ圧信号P1〜P4が入力されているチャンネルに切り替える。そして、TrgCについての転送対象A/Dチャンネルは、上記180°CA分の期間毎に、その今回の180°CA分の期間中において燃料噴射タイミングが到来しない気筒(本実施形態では、TrgBについての転送対象A/Dチャンネルに対応する気筒とは360°CAだけ行程がずれている気筒)のインジェクタ圧信号P1〜P4が入力されているチャンネルに切り替える。尚、CAは、エンジン3のクランク軸の回転角度を意味する慣用語である。   First, a transfer target A / D channel for TrgB is an injector for a cylinder that has fuel injection timing during the current 180 ° CA period for each period of 180 ° CA including the fuel injection timing of each cylinder. The channel is switched to the channel in which the pressure signals P1 to P4 are input. The transfer target A / D channel for TrgC is a cylinder for which the fuel injection timing does not arrive during the current 180 ° CA period (in this embodiment, for TrgB). The cylinder corresponding to the transfer target A / D channel is switched to the channel to which the injector pressure signals P1 to P4 of the cylinder whose stroke is shifted by 360 ° CA are input. CA is a common term meaning the rotation angle of the crankshaft of the engine 3.

このため、エンジン3の1サイクル(720°CA分の期間)を4等分した180°CA分の期間のうち、第1気筒の燃料噴射タイミングを含む180°CA分の期間においては、図2に示すように、A/D変換器11のチャンネルch1〜ch4のうち、第1気筒のインジェクタ圧信号P1が入力されるチャンネルch1が、TrgBについての転送対象A/Dチャンネルとして設定されると共に、第3気筒のインジェクタ圧信号P3が入力されるチャンネルch3が、TrgCについての転送対象A/Dチャンネルとして設定されることとなる。   For this reason, in the period of 180 ° CA including the fuel injection timing of the first cylinder in the period of 180 ° CA of one cycle of the engine 3 (period of 720 ° CA) divided into four, FIG. As shown in FIG. 4, among the channels ch1 to ch4 of the A / D converter 11, the channel ch1 to which the injector pressure signal P1 of the first cylinder is input is set as the transfer target A / D channel for TrgB. The channel ch3 to which the injector pressure signal P3 for the third cylinder is input is set as the transfer target A / D channel for TrgC.

そして、この場合、DMAコントローラ16は、A/D変換器11からのTrgBを受ける毎に、チャンネルch1のA/D変換データ(即ち、第1気筒のインジェクタ圧信号P1のA/D変換データ)をRAM17にDMA転送し、また、タイマユニット25からのTrgCを受ける毎に、チャンネルch3のA/D変換データ(即ち、第3気筒のインジェクタ圧信号P3のA/D変換データ)をRAM17にDMA転送することとなる。尚、図2及び後述する他の図において、「DMA転送B」とは、TrgBを契機にしたDMA転送のことであり、同様に「DMA転送C」とは、TrgCを契機にしたDMA転送のことである。   In this case, every time TrgB from the A / D converter 11 is received, the DMA controller 16 performs A / D conversion data of the channel ch1 (that is, A / D conversion data of the injector pressure signal P1 of the first cylinder). Is transferred to the RAM 17 and every time TrgC is received from the timer unit 25, the A / D conversion data of the channel ch3 (that is, the A / D conversion data of the injector pressure signal P3 of the third cylinder) is DMA-transferred to the RAM 17. Will be transferred. In FIG. 2 and other figures to be described later, “DMA transfer B” refers to DMA transfer triggered by TrgB. Similarly, “DMA transfer C” refers to DMA transfer triggered by TrgC. That is.

このように、本実施形態では、燃料噴射が行われる噴射対象気筒のインジェクタ圧信号のA/D変換データを、A/D変換間隔と同じ間隔でRAM17にDMA転送し、また、それと並行して、燃料噴射が行われない非噴射対象気筒のインジェクタ圧信号のA/D変換データを、A/D変換間隔の2倍の間隔でRAM17にDMA転送するようになっている。そして、このようにしている理由は、下記の通りである。   Thus, in this embodiment, the A / D conversion data of the injector pressure signal of the injection target cylinder where fuel injection is performed is DMA-transferred to the RAM 17 at the same interval as the A / D conversion interval, and in parallel therewith. The A / D conversion data of the injector pressure signal of the non-injection target cylinder where fuel injection is not performed is DMA-transferred to the RAM 17 at an interval twice the A / D conversion interval. The reason why this is done is as follows.

まず、本実施形態では、噴射対象気筒に燃料噴射が行われたときの、その噴射対象気筒のインジェクタ圧を積分することで、実際の燃料噴射量を計算し、エンジン3への燃料噴射量を高精度に制御する。   First, in this embodiment, the actual fuel injection amount is calculated by integrating the injector pressure of the injection target cylinder when the fuel injection is performed on the injection target cylinder, and the fuel injection amount to the engine 3 is calculated. Control with high precision.

しかし、燃料噴射の実施中に、例えばコモンレールに燃料を圧送する高圧ポンプが動作を開始したりしてコモンレールの圧力に変化が生じると、その変化による影響がインジェクタ圧にも現れることとなる。このため、噴射対象気筒のインジェクタ圧から、非噴射対象気筒のインジェクタ圧を減算する補正を行うことで、噴射対象気筒の正確なインジェクタ圧を算出するようにしている。   However, if a change occurs in the pressure of the common rail, for example, when a high-pressure pump that pumps fuel to the common rail starts operation during the fuel injection, the influence of the change also appears in the injector pressure. For this reason, the correct injector pressure of the injection target cylinder is calculated by correcting the injector pressure of the non-injection target cylinder from the injector pressure of the injection target cylinder.

ここで、噴射対象気筒のインジェクタ圧は、燃料噴射の実施に伴い短時間に急な変化を示すこととなるが、非噴射対象気筒のインジェクタ圧は、たとえ変化しても、緩やかに且つ単調にしか変化しないと考えられるため、噴射対象気筒のインジェクタ圧よりもサンプリング間隔を長くして、補完演算等により任意の時点の値を算出することができる。   Here, the injector pressure of the injection target cylinder shows a sudden change in a short time with the fuel injection, but the injector pressure of the non-injection target cylinder gradually and monotonously even if it changes. Therefore, it is possible to calculate the value at an arbitrary time point by a complementary calculation or the like by setting the sampling interval longer than the injector pressure of the injection target cylinder.

このため、本実施形態のマイコン10では、非噴射対象気筒のインジェクタ圧信号については、それのA/D変換データをA/D変換間隔の2倍の間隔でRAM17にDMA転送することにより、実質的なサンプリング間隔をA/D変換間隔の2倍にし、CPU21が、そのRAM17に転送されたA/D変換データの何れかに対して補完演算を行うことにより、上記減算補正に用いる非噴射対象気筒のインジェクタ圧を得るようにしている。   Therefore, in the microcomputer 10 of the present embodiment, the injector pressure signal of the non-injection target cylinder is substantially transferred by DMA transfer of the A / D conversion data to the RAM 17 at an interval twice the A / D conversion interval. Non-injection target used for the subtraction correction by making the sampling interval twice the A / D conversion interval and the CPU 21 performing a complementary operation on any of the A / D conversion data transferred to the RAM 17 Cylinder injector pressure is obtained.

以上のような実施形態のマイコン10によれば、DMAコントローラ16に対して、TrgBとは別のDMA転送要求信号であるTrgCをPMW信号の周期で与えることができ、そのTrgCの発生周期は、CPU21によって(換言すればプログラムによって)PWM信号出力回路23に設定する周期の値により任意に設定することができる。   According to the microcomputer 10 of the embodiment as described above, the DMA transfer request signal TrgC, which is different from the TrgB, can be given to the DMA controller 16 in the cycle of the PMW signal. It can be arbitrarily set by the CPU 21 (in other words, by a program) according to the value of the period set in the PWM signal output circuit 23.

更に、DMAコントローラ16による転送対象A/Dチャンネルも、TrgBとTrgCとの各々ついて、CPU21により任意に設定することができる。   Furthermore, the transfer target A / D channel by the DMA controller 16 can be arbitrarily set by the CPU 21 for each of TrgB and TrgC.

よって、TrgCに対する転送対象A/DチャンネルのA/D変換データについては、A/D変換器11からRAM17へのDMA転送を、A/D変換間隔とは異なる任意の間隔で行うことができる。   Therefore, for the A / D conversion data of the transfer target A / D channel for TrgC, the DMA transfer from the A / D converter 11 to the RAM 17 can be performed at an arbitrary interval different from the A / D conversion interval.

このため、本実施形態のマイコン10によれば、一定時間毎にA/D変換器11を起動して複数のアナログ信号をA/D変換する場合に、任意のアナログ信号について、それのA/D変換データのA/D変換器11からRAM17へのDMA転送を、A/D変換間隔とは異なる任意の間隔で行うことができる。   For this reason, according to the microcomputer 10 of this embodiment, when the A / D converter 11 is activated at regular intervals to perform A / D conversion of a plurality of analog signals, the A / D of any analog signal is obtained. DMA transfer of D conversion data from the A / D converter 11 to the RAM 17 can be performed at an arbitrary interval different from the A / D conversion interval.

そして更に、このことから、前述した[1],[2]の効果が得られる。尚、本実施形態では、噴射対象気筒のインジェクタ圧信号が、[1],[2]で説明したアナログ信号As1(必要なサンプリング間隔が短い方のアナログ信号)に相当し、非噴射対象気筒のインジェクタ圧信号が、[1],[2]で説明したアナログ信号As2(必要なサンプリング間隔が長い方のアナログ信号)に相当することとなる。   Furthermore, from this, the effects [1] and [2] described above can be obtained. In this embodiment, the injector pressure signal of the cylinder to be injected corresponds to the analog signal As1 described in [1] and [2] (the analog signal having the shorter required sampling interval), and the cylinder of the non-injection target cylinder. The injector pressure signal corresponds to the analog signal As2 (analog signal having a longer required sampling interval) described in [1] and [2].

また、本実施形態では、PWM信号のデューティエッジによってTrgCが発生するようにしているため、そのTrgCの発生タイミングを、PWM信号出力回路23に設定するパルス幅の値により、PWM信号の周期エッジを基準にして設定し易いという利点がある。   In this embodiment, since TrgC is generated by the duty edge of the PWM signal, the generation timing of the TrgC is determined based on the pulse width value set in the PWM signal output circuit 23. There is an advantage that it is easy to set with reference.

尚、本実施形態では、A/D起動タイマ13がA/D変換要求手段に相当し、RAM17がメモリに相当している。そして、タイマユニット25内の回路のうち、TrgCを出力するDMA転送要求機能の回路25aがデータ転送要求手段に相当している。
[第2実施形態]
第2実施形態のマイコンは、第1実施形態のマイコン10と比較すると下記の点が異なっている。尚、以下の第2実施形態に関する説明においては、符号として第1実施形態と同じものを用いる。
In the present embodiment, the A / D activation timer 13 corresponds to A / D conversion request means, and the RAM 17 corresponds to a memory. Of the circuits in the timer unit 25, the DMA transfer request function circuit 25a that outputs TrgC corresponds to the data transfer request means.
[Second Embodiment]
The microcomputer according to the second embodiment differs from the microcomputer 10 according to the first embodiment in the following points. In the following description of the second embodiment, the same reference numerals as those in the first embodiment are used.

即ち、第2実施形態のマイコン10では、図5に示すように、タイマユニット25(詳しくは、DMA転送要求機能の回路25a)が、信号入力端子J2からの入力信号であって、PWM信号出力回路23からのPWM信号に、デューティエッジではなく周期エッジ(立ち上がりエッジ)が発生すると、TrgCを出力するようになっている。   That is, in the microcomputer 10 of the second embodiment, as shown in FIG. 5, the timer unit 25 (specifically, the DMA transfer request function circuit 25a) is an input signal from the signal input terminal J2 and outputs a PWM signal. When a periodic edge (rising edge) occurs instead of a duty edge in the PWM signal from the circuit 23, TrgC is output.

このため、本第2実施形態において、CPU21は、図5に示すように、TrgCの発生タイミングが、前述したA/D変換停止期間中における特定タイミングとなるように、A/D起動タイマ13を起動してから所定の時間差を空けてPWM信号出力回路23を起動するようにしている。つまり、図4における時間差Tsdが、図4における「Tiad+Tma−Tid」となるように、A/D起動タイマ13の起動タイミングとPWM信号出力回路23の起動タイミングとを故意にずらしている。尚、A/D起動タイマ13とPWM信号出力回路23とをずらして起動するには、例えばタイマ割込を利用しても良い。   Therefore, in the second embodiment, as shown in FIG. 5, the CPU 21 sets the A / D activation timer 13 so that the generation timing of TrgC becomes the specific timing during the A / D conversion stop period described above. The PWM signal output circuit 23 is activated after a predetermined time difference from the activation. That is, the activation timing of the A / D activation timer 13 and the activation timing of the PWM signal output circuit 23 are intentionally shifted so that the time difference Tsd in FIG. 4 becomes “Tiad + Tma−Tid” in FIG. In order to start the A / D start timer 13 and the PWM signal output circuit 23 by shifting, a timer interrupt may be used, for example.

そして、このような第2実施形態によっても第1実施形態と同様の効果が得られる。また、PWM信号のパルス幅値は何でも良いという利点がある。
[第3実施形態]
図6に示すように、第3実施形態のマイコン20は、第1実施形態のマイコン10と比較すると下記(1)〜(3)の点が異なっている。尚、以下において、既述した他の実施形態と同じ構成要素については、その実施形態と同一の符号を用いるため、説明を省略する。
The same effects as those of the first embodiment can be obtained by the second embodiment. Moreover, there is an advantage that the pulse width value of the PWM signal may be anything.
[Third Embodiment]
As shown in FIG. 6, the microcomputer 20 of the third embodiment differs from the microcomputer 10 of the first embodiment in the following points (1) to (3). In the following description, the same constituent elements as those of the other embodiments described above are denoted by the same reference numerals as those of the embodiments, and the description thereof is omitted.

(1)PWM信号出力回路23と同じPWM信号出力回路24を更に備えている。   (1) The same PWM signal output circuit 24 as the PWM signal output circuit 23 is further provided.

そして、そのPWM信号出力回路24は、CPU21により周期値レジスタ24aに書き込まれた値の周期を有し、且つ、CPU21によりパルス幅値レジスタ24bに書き込まれた値のパルス幅を有したPWM信号を生成して、そのPWM信号を当該マイコン20の信号出力端子J3から外部に出力する。更に、その信号出力端子J3は、当該マイコン20の外部の配線により、当該マイコン20の信号入力端子J4に接続されている。   The PWM signal output circuit 24 outputs a PWM signal having the period of the value written in the period value register 24a by the CPU 21 and the pulse width of the value written in the pulse width value register 24b by the CPU 21. The PWM signal is generated and output from the signal output terminal J3 of the microcomputer 20 to the outside. Further, the signal output terminal J3 is connected to the signal input terminal J4 of the microcomputer 20 by wiring outside the microcomputer 20.

(2)DMAコントローラ16に代えて、DMAコントローラ26を備えている。   (2) A DMA controller 26 is provided instead of the DMA controller 16.

そして、そのDMAコントローラ26には、TrgB及びTrgCとは別のDMA転送要求信号(以下、TrgDと言う)も入力されるようになっている。更に、DMAコントローラ26は、そのTrgDについても、転送対象A/DチャンネルがCPU21によって設定されるようになっている。   The DMA controller 26 is also supplied with a DMA transfer request signal (hereinafter referred to as TrgD) different from TrgB and TrgC. Further, in the DMA controller 26, the transfer target A / D channel is also set by the CPU 21 for the TrgD.

(3)タイマユニット25は、DMA転送要求機能の回路25aと同じ回路25bを更に備えている。そして、その回路25bは、当該マイコン20の信号入力端子J4からの入力信号(即ち、PWM信号出力回路24からのPWM信号)に特定方向のエッジ(本実施形態では、立ち下がりエッジ)が発生すると、DMAコントローラ26に上記TrgDを出力する。   (3) The timer unit 25 further includes a circuit 25b that is the same as the circuit 25a of the DMA transfer request function. When the circuit 25b generates an edge in a specific direction (a falling edge in this embodiment) in the input signal from the signal input terminal J4 of the microcomputer 20 (that is, the PWM signal from the PWM signal output circuit 24). The TrgD is output to the DMA controller 26.

このため、タイマユニット25からDMAコントローラ26へは、PWM信号出力回路24からのPWM信号にデューティエッジが生じるとTrgDが出力され、また、第1実施形態と同様に、PWM信号出力回路23からのPWM信号にデューティエッジが生じるとTrgCが出力されることとなる。   For this reason, TrgD is output from the timer unit 25 to the DMA controller 26 when a duty edge occurs in the PWM signal from the PWM signal output circuit 24. Similarly to the first embodiment, the PWM signal output circuit 23 outputs the TrgD. When a duty edge occurs in the PWM signal, TrgC is output.

そして、このような第3実施形態のマイコン20によれば、図7に示すように、DMAコントローラ26に対して、TrgBとは別に2つのTrgCとTrgDを異なる周期で発生させることができ、また、TrgDについても転送対象A/DチャンネルをCPU21によって任意に設定することができるため、A/D変換器11の異なるチャンネルの各A/D変換データを、A/D変換間隔とは異なる複数通りの各周期で、RAM17にそれぞれ転送することができるようになる。   According to the microcomputer 20 of the third embodiment as described above, as shown in FIG. 7, the DMA controller 26 can generate two TrgCs and TrgDs with different periods separately from the TrgB. Since the CPU 21 can arbitrarily set the transfer target A / D channel for TrgD, a plurality of A / D conversion data of different channels of the A / D converter 11 are different from the A / D conversion interval. In each cycle, the data can be transferred to the RAM 17.

尚、図7及び後述する他の図において、「PWM信号C」とは、TrgCの源となるPWM信号出力回路23からのPWM信号であり、同様に「PWM信号D」とは、TrgDの源となるPWM信号出力回路24からのPWM信号であり、「DMA転送D」とは、TrgDを契機にしたDMA転送のことである。また、図7の例では、PWM信号出力回路23から、A/D変換間隔(TrgAの周期)の2倍の周期のPWM信号を出力することにより、TrgCをA/D変換間隔の2倍の周期で発生させ、PWM信号出力回路24からは、A/D変換間隔の4倍の周期のPWM信号を出力することにより、TrgDをA/D変換間隔の4倍の周期で発生させている。そして、図7は、TrgBによってチャンネルch1のA/D変換データをRAM17にDMA転送し、TrgCによってチャンネルch3のA/D変換データをRAM17にDMA転送し、TrgDによってチャンネルch4のA/D変換データをRAM17にDMA転送している場合を示している。   In FIG. 7 and other figures to be described later, “PWM signal C” is a PWM signal from the PWM signal output circuit 23 serving as the source of TrgC, and similarly “PWM signal D” is the source of TrgD. The PWM signal output from the PWM signal output circuit 24 is “DMA transfer D”, which is DMA transfer triggered by TrgD. In the example of FIG. 7, the PWM signal output circuit 23 outputs a PWM signal having a period twice as long as the A / D conversion interval (the period of TrgA), so that TrgC is doubled as the A / D conversion interval. The PWM signal output circuit 24 generates a PWM signal having a period four times the A / D conversion interval, thereby generating TrgD at a period four times the A / D conversion interval. In FIG. 7, A / D conversion data of channel ch1 is DMA-transferred to RAM 17 by TrgB, A / D conversion data of channel ch3 is DMA-transferred to RAM 17 by TrgC, and A / D conversion data of channel ch4 is TrgD. Is shown in FIG.

一方、本第3実施形態では、タイマユニット25内の上記回路25a,25bの各々が、データ転送要求手段に相当している。   On the other hand, in the third embodiment, each of the circuits 25a and 25b in the timer unit 25 corresponds to a data transfer request unit.

また、タイマユニット25内の上記各回路25a,25bのうちの両方又は一方は、第2実施形態と同様に、PWM信号に周期エッジが発生するとDMA転送要求信号(TrgC又はTrgD)を出力するように構成しても良い。
[第4実施形態]
図8に示すように、第4実施形態のマイコン30は、第1実施形態のマイコン10と比較すると下記(a)及び(b)の点が異なっている。
Also, both or one of the circuits 25a and 25b in the timer unit 25 outputs a DMA transfer request signal (TrgC or TrgD) when a periodic edge occurs in the PWM signal, as in the second embodiment. You may comprise.
[Fourth Embodiment]
As shown in FIG. 8, the microcomputer 30 of the fourth embodiment is different from the microcomputer 10 of the first embodiment in the following points (a) and (b).

(a)DMAコントローラ16に代えて、第3実施形態(図6)と同じDMAコントローラ26を備えている。   (A) Instead of the DMA controller 16, the same DMA controller 26 as that of the third embodiment (FIG. 6) is provided.

(b)タイマユニット25は、DMA転送要求機能の回路25aに代わる回路25cを備えている。   (B) The timer unit 25 includes a circuit 25c in place of the DMA transfer request function circuit 25a.

そして、そのDMA転送要求機能の回路25cは、当該マイコン20の信号入力端子J2からの入力信号に立ち下がりエッジが発生すると、DMAコントローラ26にTrgCを出力し、その信号入力端子J2からの入力信号に立ち上がりエッジが発生すると、DMAコントローラ26にTrgDを出力する。   When a falling edge occurs in the input signal from the signal input terminal J2 of the microcomputer 20, the DMA transfer request function circuit 25c outputs TrgC to the DMA controller 26, and the input signal from the signal input terminal J2 When a rising edge occurs, TrgD is output to the DMA controller 26.

このため、タイマユニット25からDMAコントローラ26へは、PWM信号出力回路23からのPWM信号にデューティエッジが生じるとTrgCが出力されるだけでなく、そのPWM信号に周期エッジが生じるとTrgDが出力されることとなる。   For this reason, from the timer unit 25 to the DMA controller 26, not only TrgC is output when a duty edge occurs in the PWM signal from the PWM signal output circuit 23, but also TrgD is output when a periodic edge occurs in the PWM signal. The Rukoto.

そして、このような第4実施形態のマイコン30によれば、図9に示すように、1つのPWM信号で2つのTrgCとTrgDを生成することができる。そして、そのTrgCとTrgDの各々について、転送対象A/DチャンネルをCPU21によって任意に設定することができるため、A/D変換器11の異なるチャンネルの各A/D変換データを、A/D変換間隔よりも長い間隔(図9の例ではA/D変換間隔の2倍の間隔)で、且つ、PWM信号のパルス幅Tdutyの分だけ位相がずれたタイミングで、RAM17に格納することができるようになる。   And according to the microcomputer 30 of such 4th Embodiment, as shown in FIG. 9, two TrgC and TrgD are generable with one PWM signal. Since the transfer target A / D channel can be arbitrarily set by the CPU 21 for each of the TrgC and TrgD, the A / D conversion data of the different channels of the A / D converter 11 is converted to A / D conversion. It can be stored in the RAM 17 at an interval longer than the interval (in the example of FIG. 9, twice the A / D conversion interval) and at a timing shifted in phase by the pulse width Tduty of the PWM signal. become.

尚、図9も、前述した図7と同様に、TrgBによってチャンネルch1のA/D変換データをRAM17にDMA転送し、TrgCによってチャンネルch3のA/D変換データをRAM17にDMA転送し、TrgDによってチャンネルch4のA/D変換データをRAM17にDMA転送している場合を示している。   9 also DMA-transfers the A / D conversion data of the channel ch1 to the RAM 17 by TrgB, and DMA-transfers the A / D conversion data of the channel ch3 to the RAM 17 by TrgC. A case where the A / D conversion data of the channel ch4 is DMA-transferred to the RAM 17 is shown.

また、本第4実施形態においても、PWM信号の周期エッジによって発生するTrgDについては、第2実施形態で述べた手法(A/D起動タイマ13とPWM信号出力回路23との起動をずらす手法)により、そのTrgDの発生タイミングがA/D変換停止期間中の特定タイミングとなるようにすれば良い。そして、PWM信号のデューティエッジによって発生するTrgCについては、第1実施形態で述べたPWM信号のパルス幅値の設定手法により、そのTrgCの発生タイミングがA/D変換停止期間中の特定タイミングとなるようにすれば良い。   Also in the fourth embodiment, the TrgD generated by the periodic edge of the PWM signal is the method described in the second embodiment (the method of shifting the activation of the A / D activation timer 13 and the PWM signal output circuit 23). Therefore, the generation timing of TrgD may be set to the specific timing during the A / D conversion stop period. For TrgC generated by the duty edge of the PWM signal, the generation timing of the TrgC becomes a specific timing during the A / D conversion stop period by the method for setting the pulse width value of the PWM signal described in the first embodiment. You can do that.

一方、本第4実施形態では、タイマユニット25内の回路25cがデータ転送要求手段に相当している。
[第5実施形態]
ところで、PWM信号出力回路23からのPWM信号のデューティエッジによってTrgCを発生させる第1、第3及び第4実施形態のマイコン10,20,30においては、PWM信号出力回路23に設定したパルス幅の値(パルス幅値レジスタ23bの値)が、外乱ノイズなどの要因で変わってしまうと、そのTrgCの発生タイミングが最適なタイミングからずれてしまうこととなる。また、第3実施形態のマイコン20では、PWM信号出力回路24からのPWM信号のデューティエッジによってTrgDを発生させるため、そのTrgDの発生タイミングも、PWM信号出力回路24に設定したパルス幅の値(パルス幅値レジスタ24bの値)が外乱ノイズなどの要因で変わってしまうと、最適なタイミングからずれてしまう。
On the other hand, in the fourth embodiment, the circuit 25c in the timer unit 25 corresponds to a data transfer request unit.
[Fifth Embodiment]
By the way, in the microcomputers 10, 20, and 30 of the first, third, and fourth embodiments that generate TrgC by the duty edge of the PWM signal from the PWM signal output circuit 23, the pulse width set in the PWM signal output circuit 23 is set. If the value (the value of the pulse width value register 23b) changes due to factors such as disturbance noise, the generation timing of the TrgC will deviate from the optimal timing. Further, since the microcomputer 20 of the third embodiment generates TrgD by the duty edge of the PWM signal from the PWM signal output circuit 24, the generation timing of the TrgD is also the pulse width value (set to the PWM signal output circuit 24 ( If the value of the pulse width value register 24b is changed due to disturbance noise or the like, the optimum timing is deviated.

そこで、第5実施形態として、こうした不都合を回避するための技術について述べる。尚、ここでは、第3実施形態のマイコン20に対して本第5実施形態の技術を適用した場合を例に挙げて説明するが、本第5実施形態の技術は、第1及び第4実施形態のマイコンについても同様に適用することができる。また、以下の第5実施形態に関する説明においては、符号として第3実施形態と同じものを用いる。   Therefore, as a fifth embodiment, a technique for avoiding such inconvenience will be described. Here, the case where the technique of the fifth embodiment is applied to the microcomputer 20 of the third embodiment will be described as an example. However, the technique of the fifth embodiment is the first and fourth embodiments. The present invention can be similarly applied to the form of the microcomputer. Moreover, in the following description regarding the fifth embodiment, the same reference numerals as those in the third embodiment are used.

第5実施形態のマイコン20は、第3実施形態のマイコン20と比較すると、CPU21が、タイマユニット25から出力されるDMA転送要求信号(TrgCとTrgD)の各々について、それの源であるPWM信号のパルス幅設定値を補正するためのパルス幅補正処理を、例えば定期的に行う点が異なっている。   Compared with the microcomputer 20 of the third embodiment, the microcomputer 20 of the fifth embodiment has a PWM signal that is the source of each of the DMA transfer request signals (TrgC and TrgD) output from the timer unit 25 by the CPU 21. The difference is that, for example, the pulse width correction processing for correcting the pulse width setting value is periodically performed.

TrgCの方を例に挙げて説明すると、パルス幅補正処理では、タイマユニット25がTrgCを出力したタイミングを検出し、その検出結果に基づいて、TrgCの出力タイミングが前述のA/D変換停止期間中における特定タイミングとなるように、そのTrgCの源であるPWM信号出力回路23からのPWM信号(以下、PWM信号Cという)のパルス幅設定値を補正する。   For example, in the pulse width correction process, the timing at which the timer unit 25 outputs the TrgC is detected, and the output timing of the TrgC is determined based on the detection result in the A / D conversion stop period. The pulse width setting value of the PWM signal (hereinafter referred to as PWM signal C) from the PWM signal output circuit 23 which is the source of the TrgC is corrected so as to be at a specific timing.

次に、パルス幅補正処理の具体的な内容について説明する。尚、以下においても、説明を簡略化するために、TrgCとTrgDとのうち、TrgCの方を例に挙げて説明するが、TrgDの方についても同様の処理が行われる。   Next, specific contents of the pulse width correction process will be described. In the following, in order to simplify the description, TrgC is described as an example of TrgC and TrgD, but the same processing is performed for TrgD.

パルス幅補正処理は、以下に述べる第1〜第3の補正処理からなっている。そして、パルス幅設定値の補正を実施すべき定期タイミングが到来すると、第1〜第3の各補正処理がA/D変換間隔よりも十分に短い一定の時間毎に繰り返し実行され、その各補正処理の何れかによってパルス幅設定値が補正されると、第1〜第3の補正処理の全ての実行が停止される(つまり、1回のパルス幅補正処理の実施が終了する)。   The pulse width correction process includes first to third correction processes described below. When the regular timing at which the correction of the pulse width set value is to be performed, the first to third correction processes are repeatedly executed at regular intervals sufficiently shorter than the A / D conversion interval. When the pulse width set value is corrected by any of the processes, the execution of all of the first to third correction processes is stopped (that is, the execution of one pulse width correction process is ended).

[第1の補正処理]
まず、第1の補正処理では、図10における時間t1であって、タイマユニット25からTrgCが出力される直前にA/D変換器11がA/D変換動作を完了した時刻から、TrgCが出力されるまでの時間であるA/D変換完了後余裕時間t1を、TrgCの出力タイミングとして検出する。そして、その検出結果に基づいて、A/D変換完了後余裕時間t1が該時間t1の目標値である図4の余裕時間Tmaと等しくなるように、PWM信号Cのパルス幅設定値(即ち、パルス幅値レジスタ23bの値)を補正する。
[First correction processing]
First, in the first correction process, TrgC is output from the time t1 in FIG. 10 at the time when the A / D converter 11 completes the A / D conversion operation just before the TrgC is output from the timer unit 25. A margin time t1 after the completion of A / D conversion, which is a time until completion, is detected as an output timing of TrgC. Based on the detection result, the pulse width setting value of the PWM signal C (ie, the margin time t1 after completion of A / D conversion is equal to the margin time Tma in FIG. 4 which is the target value of the time t1). The value of the pulse width value register 23b) is corrected.

次に、図11を用い更に具体的に説明する。尚、図11は、第1の補正処理を表すフローチャートである。   Next, a more specific description will be given with reference to FIG. FIG. 11 is a flowchart showing the first correction process.

図11に示すように、CPU21は第1の補正処理の実行を開始すると、まずS110にて、今回の処理タイミングが、A/D変換完了タイミング(即ち、A/D変換器11がA/D変換動作を完了したタイミングであり、図4,図10におけるTeadのタイミング)であるか否かを判定する。   As shown in FIG. 11, when the CPU 21 starts executing the first correction process, first, in S110, the current process timing is A / D conversion completion timing (ie, the A / D converter 11 is A / D converted). It is determined whether or not it is the timing at which the conversion operation is completed, that is, the timing of the Lead in FIGS.

尚、本実施形態では、A/D変換器11がA/D変換動作を完了したか否かを、A/D変換器11内のステータス情報によって判定できるようになっている。このため、S110では、上記ステータス情報を読み込んで、前回のステータス情報がA/D変換動作の未完了(A/D変換実施中)を示し、今回のステータス情報がA/D変換動作の完了を示していれば、今回がA/D変換完了タイミングであると判定する。   In the present embodiment, whether or not the A / D converter 11 has completed the A / D conversion operation can be determined from the status information in the A / D converter 11. Therefore, in S110, the status information is read, the previous status information indicates that the A / D conversion operation has not been completed (A / D conversion is being performed), and the current status information indicates that the A / D conversion operation has been completed. If it is shown, it is determined that this time is the A / D conversion completion timing.

このS110にて、A/D変換完了タイミングではないと判定した場合には、そのままS130に移行するが、A/D変換完了タイミングであると判定した場合には、S120に進んで、現在時刻に該当するフリーランタイマの現在値を、A/D変換完了時刻Teadとして更新記憶し、その後、S130に進む。   If it is determined in S110 that it is not the A / D conversion completion timing, the process directly proceeds to S130, but if it is determined that it is the A / D conversion completion timing, the process proceeds to S120 and the current time is reached. The current value of the corresponding free-run timer is updated and stored as the A / D conversion completion time Tead, and then the process proceeds to S130.

S130では、上記S120の処理によってA/D変換完了時刻Teadが既に記憶されているか否かを判定し、A/D変換完了時刻Teadが記憶されていなければ、そのまま当該第1の補正処理を一旦終了するが、A/D変換完了時刻Teadが既に記憶されていれば、S140に進む。   In S130, it is determined whether or not the A / D conversion completion time Tead is already stored by the process of S120. If the A / D conversion completion time Tead is not stored, the first correction process is temporarily performed. If the A / D conversion completion time Tead is already stored, the process proceeds to S140.

そして、S140では、PWM信号のデューティエッジによるDMA転送要求信号(この例ではTrgC)が発生したか否かを判定する。   In S140, it is determined whether or not a DMA transfer request signal (TrgC in this example) due to the duty edge of the PWM signal has occurred.

尚、本実施形態では、タイマユニット25がTrgCを出力すると、そのタイマユニット25内において、TrgCの発生を示すトリガ発生フラグがセットされる共に、フリーランタイマの現在値がトリガ発生時刻レジスタにコピーされる。また、前述のS120では、上記トリガ発生フラグのリセットも行うようになっている。そして、S140では、上記トリガ発生フラグを参照することにより、TrgCが発生したか否かを判定する。つまり、トリガ発生フラグがセットされていれば、TrgCが発生したと判定する。   In this embodiment, when the timer unit 25 outputs TrgC, a trigger generation flag indicating the generation of TrgC is set in the timer unit 25 and the current value of the free-run timer is copied to the trigger generation time register. Is done. In S120 described above, the trigger generation flag is also reset. In S140, it is determined whether TrgC has occurred by referring to the trigger generation flag. That is, if the trigger generation flag is set, it is determined that TrgC has occurred.

このS140にて、TrgCが発生していないと判定した場合には、そのまま当該第1の補正処理を一旦終了するが、TrgCが発生したと判定した場合には、S150に進んで、タイマユニット25内の上記トリガ発生時刻レジスタに記憶されている値(即ち、TrgCが発生したときのフリーランタイマの値)を、DMA転送要求信号発生時刻Tgとして記憶し、その後、S160に進む。尚、上記トリガ発生時刻レジスタが無ければ、S150では、フリーランタイマの現在値をDMA転送要求信号発生時刻Tgとして記憶すれば良い。   If it is determined in S140 that TrgC has not occurred, the first correction process is temporarily terminated. If it is determined that TrgC has occurred, the process proceeds to S150 and the timer unit 25 is processed. The value stored in the trigger generation time register (that is, the value of the free-run timer when TrgC is generated) is stored as the DMA transfer request signal generation time Tg, and then the process proceeds to S160. If there is no trigger generation time register, in S150, the current value of the free-run timer may be stored as the DMA transfer request signal generation time Tg.

S160では、S120で記憶した最新のA/D変換完了時刻Teadと、S150で記憶したDMA転送要求信号発生時刻Tgとを、下記の式3に代入することにより、パルス幅補正値Tdmを算出する。   In S160, the pulse width correction value Tdm is calculated by substituting the latest A / D conversion completion time Tad stored in S120 and the DMA transfer request signal generation time Tg stored in S150 into the following Expression 3. .

Tdm=Tma−(Tg−Tead) …式3
尚、式3において、Tmaは、図4の余裕時間Tmaであり、「Tg−Tead」は、A/D変換完了後余裕時間t1の実測値である。
Tdm = Tma− (Tg−Tead) (Formula 3)
In Equation 3, Tma is the margin time Tma in FIG. 4, and “Tg−Tead” is an actual measurement value of the margin time t1 after the A / D conversion is completed.

次にS170にて、PWM信号Cの現在のパルス幅設定値Tdutyに、上記S160で算出したパルス幅補正値Tdmを加算し、その加算後の値「Tduty+Tdm」を、補正後のパルス幅設定値Tdutyとして、PWM信号出力回路23におけるパルス幅値レジスタ23bに再セットする。つまり、A/D変換完了後余裕時間t1の実測値と、それの目標値であるTmaとの差分だけ、パルス幅設定値Tdutyを補正するようにしている。   Next, in S170, the pulse width correction value Tdm calculated in S160 is added to the current pulse width setting value Tduty of the PWM signal C, and the value “Tduty + Tdm” after the addition is added to the corrected pulse width setting value. As Tduty, the pulse width value register 23b in the PWM signal output circuit 23 is reset. That is, the pulse width set value Tduty is corrected by the difference between the measured value of the margin time t1 after completion of A / D conversion and the target value Tma.

尚、TrgCの発生タイミングが目標の特定タイミングから大幅にずれて、例えば、次のA/D変換完了タイミングの直前辺りにまで遅れていた場合には、式3における「Tg−Tead」が大きくなって、上記加算後の値「Tduty+Tdm」が0以下になる可能性がある。このため、S170では、「Tduty+Tdm」が0以下になった場合、その「Tduty+Tdm」にA/D変換間隔Tadを加えた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。また、S170において、もし上記加算後の「Tduty+Tdm」が周期値Tpwm以上になった場合には、その「Tduty+Tdm」からA/D変換間隔Tadを引いた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。   Note that if the generation timing of TrgC is significantly deviated from the target specific timing, for example, if it is delayed to just before the next A / D conversion completion timing, “Tg−Tead” in Expression 3 becomes large. Therefore, there is a possibility that the value “Tduty + Tdm” after the addition becomes 0 or less. Therefore, in S170, when “Tduty + Tdm” becomes 0 or less, a value obtained by adding the A / D conversion interval Tad to “Tduty + Tdm” is stored in the pulse width value register 23b as a corrected pulse width setting value Tduty. set. In S170, if “Tduty + Tdm” after the addition is equal to or greater than the period value Tpwm, a value obtained by subtracting the A / D conversion interval Tad from “Tduty + Tdm” is used as the corrected pulse width setting value Tduty. Is set in the pulse width value register 23b.

そして、このようなS170の後、当該第1の補正処理を終了する。   And after such S170, the said 1st correction process is complete | finished.

以上のような第1の補正処理により、TrgCのA/D変換完了後余裕時間t1が図4の余裕時間Tmaと等しくなるように、PWM信号Cのパルス幅設定値が補正される。   By the first correction process as described above, the pulse width setting value of the PWM signal C is corrected so that the margin time t1 after completion of A / D conversion of TrgC becomes equal to the margin time Tma of FIG.

また同様に、TrgDについて行われる第1の補正処理により、TrgDのA/D変換完了後余裕時間t1(図10参照)が図4の余裕時間Tmaと等しくなるように、PWM信号出力回路24からのPWM信号(以下、PWM信号Dという)のパルス幅設定値(即ち、パルス幅値レジスタ24bの値)が補正されることとなる。   Similarly, from the PWM signal output circuit 24, the first correction process performed on TrgD causes the margin time t1 (see FIG. 10) after completion of A / D conversion of TrgD to be equal to the margin time Tma in FIG. The pulse width setting value (that is, the value of the pulse width value register 24b) of the PWM signal (hereinafter referred to as PWM signal D) is corrected.

[第2の補正処理]
まず、第2の補正処理では、図10における時間t2であって、TrgCが出力されてからA/D変換器11が次回のA/D変換動作を開始するまでの時間であるA/D変換開始前余裕時間t2を、TrgCの出力タイミングとして検出する。そして、その検出結果に基づいて、A/D変換開始前余裕時間t2が該時間t2の目標値である図4の余裕時間Tmbと等しくなるように、PWM信号Cのパルス幅設定値を補正する。
[Second correction process]
First, in the second correction process, A / D conversion is time t2 in FIG. 10 and is the time from when TrgC is output until the A / D converter 11 starts the next A / D conversion operation. The pre-start margin time t2 is detected as the output timing of TrgC. Based on the detection result, the pulse width setting value of the PWM signal C is corrected so that the margin time t2 before the start of A / D conversion becomes equal to the margin time Tmb in FIG. 4 which is the target value of the time t2. .

次に、図12を用い更に具体的に説明する。尚、図12は、第2の補正処理を表すフローチャートである。   Next, a more specific description will be given with reference to FIG. FIG. 12 is a flowchart showing the second correction process.

図12に示すように、CPU21は第2の補正処理の実行を開始すると、まずS210にて、PWM信号のデューティエッジによるDMA転送要求信号(この例ではTrgC)が発生したか否かを判定する。尚、このS210では、図11のS140と同様に、タイマユニット25内の上記トリガ発生フラグを参照することで、TrgCが発生したか否かを判定する。また、そのトリガ発生フラグは、当該第2の補正処理が最初に実行される前に予めCPU21によりリセットされるようになっている。   As shown in FIG. 12, when the CPU 21 starts executing the second correction process, first, in S210, the CPU 21 determines whether or not a DMA transfer request signal (TrgC in this example) due to the duty edge of the PWM signal has occurred. . In S210, as in S140 of FIG. 11, it is determined whether TrgC has occurred by referring to the trigger generation flag in the timer unit 25. The trigger generation flag is reset by the CPU 21 in advance before the second correction process is first executed.

そして、このS210にて、TrgCが発生していないと判定した場合には、そのままS230に移行するが、TrgCが発生したと判定した場合には、S220に進んで、図11のS150と同様に、タイマユニット25内の上記トリガ発生時刻レジスタに記憶されている値、或いはフリーランタイマの現在値を、DMA転送要求信号発生時刻Tgとして記憶し、その後、S230に進む。   If it is determined in this S210 that TrgC has not occurred, the process proceeds to S230 as it is, but if it is determined that TrgC has occurred, the process proceeds to S220 and is similar to S150 in FIG. The value stored in the trigger generation time register in the timer unit 25 or the current value of the free-run timer is stored as the DMA transfer request signal generation time Tg, and then the process proceeds to S230.

S230では、上記S220の処理によってDMA転送要求信号発生時刻Tgが既に記憶されているか否かを判定し、DMA転送要求信号発生時刻Tgが記憶されていなければ、そのまま当該第2の補正処理を一旦終了するが、DMA転送要求信号発生時刻Tgが既に記憶されていれば、S240に進む。   In S230, it is determined whether or not the DMA transfer request signal generation time Tg is already stored by the process of S220. If the DMA transfer request signal generation time Tg is not stored, the second correction process is temporarily performed as it is. If the DMA transfer request signal generation time Tg is already stored, the process proceeds to S240.

S240では、今回の処理タイミングが、A/D変換開始タイミング(即ち、A/D変換器11がA/D変換動作を開始したタイミングであり、図4,図10におけるTsadのタイミング)であるか否かを判定する。   In S240, is the current processing timing the A / D conversion start timing (that is, the timing at which the A / D converter 11 starts the A / D conversion operation, and the timing of Tsad in FIGS. 4 and 10)? Determine whether or not.

尚、このS240では、A/D変換器11内の上記ステータス情報を読み込んで、前回のステータス情報がA/D変換動作の完了を示し、今回のステータス情報がA/D変換動作の未完了を示していれば、今回がA/D変換開始タイミングであると判定する。また、TrgAが発生したこと自体をCPU21がモニタできるのであれば、S240では、TrgAの発生有無を判定するようにしても良い。   In S240, the status information in the A / D converter 11 is read, the previous status information indicates the completion of the A / D conversion operation, and the current status information indicates that the A / D conversion operation is not completed. If it is shown, it is determined that this time is the A / D conversion start timing. Further, if the CPU 21 can monitor the occurrence of TrgA itself, in S240, it may be determined whether or not TrgA has occurred.

そして、S240にて、A/D変換開始タイミングではないと判定した場合には、そのまま当該第2の補正処理を一旦終了するが、A/D変換開始タイミングであると判定した場合には、S250に進んで、現在時刻に該当するフリーランタイマの現在値を、A/D変換開始時刻Tsadとして記憶し、その後、S260に進む。   If it is determined in S240 that it is not the A / D conversion start timing, the second correction process is temporarily terminated as it is, but if it is determined that it is the A / D conversion start timing, S250 is performed. , The current value of the free-run timer corresponding to the current time is stored as the A / D conversion start time Tsad, and then the process proceeds to S260.

S260では、S220で記憶したDMA転送要求信号発生時刻Tgと、S250で記憶したA/D変換開始時刻Tsadとを、下記の式4に代入することにより、パルス幅補正値Tdmを算出する。   In S260, the pulse width correction value Tdm is calculated by substituting the DMA transfer request signal generation time Tg stored in S220 and the A / D conversion start time Tsad stored in S250 into the following equation 4.

Tdm=(Tsad−Tg)−Tmb …式4
尚、式4において、Tmbは、図4の余裕時間Tmbであり、「Tsad−Tg」は、A/D変換開始前余裕時間t2の実測値である。
Tdm = (Tsad−Tg) −Tmb Equation 4
In Equation 4, Tmb is the margin time Tmb in FIG. 4, and “Tsad−Tg” is an actual measurement value of the margin time t2 before the start of A / D conversion.

次にS270にて、PWM信号Cの現在のパルス幅設定値Tdutyに、上記S260で算出したパルス幅補正値Tdmを加算し、その加算後の値「Tduty+Tdm」を、補正後のパルス幅設定値Tdutyとして、PWM信号出力回路23におけるパルス幅値レジスタ23bに再セットする。つまり、A/D変換開始前余裕時間t2の実測値と、それの目標値であるTmbとの差分だけ、パルス幅設定値Tdutyを補正するようにしている。   Next, in S270, the pulse width correction value Tdm calculated in S260 is added to the current pulse width setting value Tduty of the PWM signal C, and the value “Tduty + Tdm” after the addition is added to the corrected pulse width setting value. As Tduty, the pulse width value register 23b in the PWM signal output circuit 23 is reset. That is, the pulse width setting value Tduty is corrected by the difference between the measured value of the margin time t2 before the start of A / D conversion and the target value Tmb.

尚、TrgCの発生タイミングが目標の特定タイミングから大幅にずれて、例えば、次のA/D変換開始タイミングの直後辺りにまで遅れていた場合には、式4における「Tsad−Tg」がA/D変換間隔Tadと同程度の値となり、上記加算後の値「Tduty+Tdm」がPWM信号の周期値Tpwm以上になる可能性がある。このため、S270では、「Tduty+Tdm」が周期値Tpwm以上になった場合、その「Tduty+Tdm」からA/D変換間隔Tadを引いた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。また、S270において、もし上記加算後の「Tduty+Tdm」が0以下になった場合には、その「Tduty+Tdm」にA/D変換間隔Tadを加えた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。   When the generation timing of TrgC is significantly deviated from the target specific timing, for example, when it is delayed to just after the next A / D conversion start timing, “Tsad−Tg” in Equation 4 is A / There is a possibility that the value “Tduty + Tdm” after the addition becomes equal to or greater than the period value Tpwm of the PWM signal. Therefore, in S270, when “Tduty + Tdm” becomes equal to or greater than the period value Tpwm, a value obtained by subtracting the A / D conversion interval Tad from “Tduty + Tdm” is used as the pulse width setting value Tduty after correction. Set to 23b. In S270, if “Tduty + Tdm” after the addition becomes 0 or less, a value obtained by adding the A / D conversion interval Tad to “Tduty + Tdm” is used as the corrected pulse width setting value Tduty. Set to the pulse width value register 23b.

そして、このようなS270の後、当該第2の補正処理を終了する。   And after such S270, the said 2nd correction process is complete | finished.

以上のような第2の補正処理により、TrgCのA/D変換開始前余裕時間t2が図4の余裕時間Tmbと等しくなるように、PWM信号Cのパルス幅設定値が補正される。   By the second correction process as described above, the pulse width setting value of the PWM signal C is corrected so that the margin time t2 before the start of A / D conversion of TrgC becomes equal to the margin time Tmb of FIG.

また同様に、TrgDについて行われる第2の補正処理により、TrgDのA/D変換開始前余裕時間t2(図10参照)が図4の余裕時間Tmbと等しくなるように、PWM信号Dのパルス幅設定値が補正されることとなる。   Similarly, the pulse width of the PWM signal D is set so that the margin time t2 (see FIG. 10) before the start of A / D conversion of TrgD becomes equal to the margin time Tmb in FIG. 4 by the second correction process performed on TrgD. The set value is corrected.

[第3の補正処理]
まず、第3の補正処理では、図10における時間t3であって、タイマユニット25からTrgCが出力される直前にA/D変換器11がA/D変換動作を開始した時刻から、TrgCが出力されるまでの時間であるA/D変換開始後余裕時間t3を、TrgCの出力タイミングとして検出する。そして、その検出結果に基づいて、A/D変換開始後余裕時間t3が該時間t3の目標値である図4の「Tiad+Tma」と等しくなるように、PWM信号Cのパルス幅設定値を補正する。
[Third correction processing]
First, in the third correction processing, TrgC is output from the time t3 in FIG. 10 at the time when the A / D converter 11 starts the A / D conversion operation just before the TrgC is output from the timer unit 25. A margin time t3 after the start of A / D conversion, which is the time until start, is detected as the output timing of TrgC. Based on the detection result, the pulse width setting value of the PWM signal C is corrected so that the margin time t3 after the start of A / D conversion becomes equal to “Tiad + Tma” in FIG. 4 which is the target value of the time t3. .

次に、図13を用い更に具体的に説明する。尚、図13は、第3の補正処理を表すフローチャートである。   Next, a more specific description will be given with reference to FIG. FIG. 13 is a flowchart showing the third correction process.

図13に示すように、CPU21は第3の補正処理の実行を開始すると、まずS310にて、図12のS240と同様に、今回の処理タイミングがA/D変換開始タイミングであるか否かを判定する。   As shown in FIG. 13, when the CPU 21 starts executing the third correction process, first, in S310, whether or not the current processing timing is the A / D conversion start timing, as in S240 of FIG. judge.

そして、A/D変換開始タイミングではないと判定した場合には、そのままS330に移行するが、A/D変換開始タイミングであると判定した場合には、S320に進んで、現在時刻に該当するフリーランタイマの現在値を、A/D変換開始時刻Tsadとして更新記憶すると共に、タイマユニット25内の上記トリガ発生フラグをリセットする処理を行い、その後、S330に進む。   If it is determined that it is not the A / D conversion start timing, the process proceeds to S330 as it is, but if it is determined that it is the A / D conversion start timing, the process proceeds to S320, and the free time corresponding to the current time is reached. The current value of the run timer is updated and stored as the A / D conversion start time Tsad, and the trigger generation flag in the timer unit 25 is reset. Thereafter, the process proceeds to S330.

S330では、上記S320の処理によってA/D変換開始時刻Tsadが既に記憶されているか否かを判定し、A/D変換開始時刻Tsadが記憶されていなければ、そのまま当該第3の補正処理を一旦終了するが、A/D変換開始時刻Tsadが既に記憶されていれば、S340に進む。   In S330, it is determined whether or not the A / D conversion start time Tsad is already stored by the process of S320. If the A / D conversion start time Tsad is not stored, the third correction process is temporarily performed as it is. If the A / D conversion start time Tsad is already stored, the process proceeds to S340.

そして、S340では、PWM信号のデューティエッジによるDMA転送要求信号(この例ではTrgC)が発生したか否かを判定する。尚、このS340では、図11のS140と同様に、タイマユニット25内の上記トリガ発生フラグを参照することで、TrgCが発生したか否かを判定する。   In S340, it is determined whether or not a DMA transfer request signal (TrgC in this example) due to the duty edge of the PWM signal has occurred. In S340, as in S140 of FIG. 11, it is determined by referring to the trigger generation flag in the timer unit 25 whether TrgC has occurred.

上記S340にて、TrgCが発生していないと判定した場合には、そのまま当該第3の補正処理を一旦終了するが、TrgCが発生したと判定した場合には、S350に進んで、図11のS150と同様に、タイマユニット25内の上記トリガ発生時刻レジスタに記憶されている値、或いはフリーランタイマの現在値を、DMA転送要求信号発生時刻Tgとして記憶し、その後、S360に進む。   If it is determined in step S340 that TrgC has not occurred, the third correction process is temporarily terminated. If it is determined that TrgC has occurred, the process proceeds to step S350, and FIG. As in S150, the value stored in the trigger generation time register in the timer unit 25 or the current value of the free-run timer is stored as the DMA transfer request signal generation time Tg, and then the process proceeds to S360.

S360では、S320で記憶した最新のA/D変換開始時刻Tsadと、S350で記憶したDMA転送要求信号発生時刻Tgとを、下記の式5に代入することにより、パルス幅補正値Tdmを算出する。   In S360, the pulse width correction value Tdm is calculated by substituting the latest A / D conversion start time Tsad stored in S320 and the DMA transfer request signal generation time Tg stored in S350 into Equation 5 below. .

Tdm=(Tiad+Tma)−(Tg−Tsad) …式5
尚、式5において、「Tiad+Tma」は、図4に示したA/D変換時間Tiadに図4の余裕時間Tmaを加えた時間であり、「Tg−Tsad」は、A/D変換開始後余裕時間t3の実測値である。
Tdm = (Tad + Tma) − (Tg−Tsad) (Formula 5)
In Equation 5, “Tad + Tma” is a time obtained by adding the margin time Tma of FIG. 4 to the A / D conversion time Tad shown in FIG. 4, and “Tg−Tsad” is a margin after the start of A / D conversion. It is an actual measurement value at time t3.

次にS370にて、PWM信号Cの現在のパルス幅設定値Tdutyに、上記S360で算出したパルス幅補正値Tdmを加算し、その加算後の値「Tduty+Tdm」を、補正後のパルス幅設定値Tdutyとして、PWM信号出力回路23におけるパルス幅値レジスタ23bに再セットする。つまり、A/D変換開始後余裕時間t3の実測値と、それの目標値である「Tiad+Tma」との差分だけ、パルス幅設定値Tdutyを補正するようにしている。   Next, in S370, the pulse width correction value Tdm calculated in S360 is added to the current pulse width setting value Tduty of the PWM signal C, and the value “Tduty + Tdm” after the addition is added to the corrected pulse width setting value. As Tduty, the pulse width value register 23b in the PWM signal output circuit 23 is reset. That is, the pulse width setting value Tduty is corrected by the difference between the actually measured value of the margin time t3 after the start of A / D conversion and the target value “Tiad + Tma”.

尚、S370において、もし上記加算後の「Tduty+Tdm」が周期値Tpwm以上になった場合には、その「Tduty+Tdm」からA/D変換間隔Tadを引いた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。また、もし上記加算後の「Tduty+Tdm」が0以下になった場合には、その「Tduty+Tdm」にA/D変換間隔Tadを加えた値を、補正後のパルス幅設定値Tdutyとして上記パルス幅値レジスタ23bにセットする。   In S370, if “Tduty + Tdm” after the addition is equal to or greater than the period value Tpwm, a value obtained by subtracting the A / D conversion interval Tad from “Tduty + Tdm” is used as the corrected pulse width setting value Tduty. Is set in the pulse width value register 23b. If “Tduty + Tdm” after the addition becomes 0 or less, a value obtained by adding the A / D conversion interval Tad to “Tduty + Tdm” is used as the corrected pulse width setting value Tduty. Set in register 23b.

そして、このようなS370の後、当該第3の補正処理を終了する。   And after such S370, the said 3rd correction process is complete | finished.

以上のような第3の補正処理により、TrgCのA/D変換開始後余裕時間t3が図4の「Tiad+Tma」と等しくなるように、PWM信号Cのパルス幅設定値が補正される。   By the third correction process as described above, the pulse width setting value of the PWM signal C is corrected so that the margin time t3 after the start of A / D conversion of TrgC becomes equal to “Tiad + Tma” in FIG.

また同様に、TrgDについて行われる第3の補正処理により、TrgDのA/D変換開始後余裕時間t3(図10参照)が図4の「Tiad+Tma」と等しくなるように、PWM信号Dのパルス幅設定値が補正されることとなる。   Similarly, the pulse width of the PWM signal D is set so that the margin time t3 (see FIG. 10) after the start of A / D conversion of TrgD becomes equal to “Tiad + Tma” in FIG. 4 by the third correction process performed on TrgD. The set value is corrected.

そして、以上のような第5実施形態のマイコン20によれば、PWM信号のデューティティエッジを源としたTrgCとTrgDの発生タイミングが目的のタイミングからずれたままになることを防止することができる。また仮に、前述の初期設定処理によって最初に設定したPWM信号のパルス幅値が不適切な値であったとしても、そのパルス幅値を適切な値へと自動的に設定し直すことができる。   According to the microcomputer 20 of the fifth embodiment as described above, the generation timing of TrgC and TrgD using the duty edge of the PWM signal as a source can be prevented from deviating from the target timing. . Even if the pulse width value of the PWM signal initially set by the above-described initial setting process is an inappropriate value, the pulse width value can be automatically reset to an appropriate value.

尚、第4実施形態のマイコン30ならば、TrgCとTrgDのうち、TrgCを対象にして上記パルス幅補正処理(第1〜第3の補正処理)を行うようにすれば良い。   In the microcomputer 30 of the fourth embodiment, the pulse width correction process (first to third correction processes) may be performed on TrgC out of TrgC and TrgD.

一方、パルス幅補正処理としては、第1〜第3の補正処理のうち、1つ又は2つだけを行うようにしても良い。また、パルス幅補正処理は、定期的にではなく、不定期に行うようにしたり、例えばマイコンが起動した後の所定タイミングで一回だけ行うようにしても良い。
[第6実施形態]
上記各実施形態のマイコン10,20,30においては、PWM信号出力回路23,24に設定した周期の値(周期値レジスタ23a,24aの値)が、外乱ノイズなどの要因で変わってしまうと、PWM信号の周期とA/D変換間隔との倍数関係が崩れるため、TrgC,TrgDの発生タイミングが最適な特定タイミングからずれてしまう。
On the other hand, as the pulse width correction process, only one or two of the first to third correction processes may be performed. Further, the pulse width correction process may be performed not periodically but irregularly, or may be performed only once at a predetermined timing after the microcomputer is activated, for example.
[Sixth Embodiment]
In the microcomputers 10, 20, and 30 of each of the embodiments described above, if the period values (values of the period value registers 23 a and 24 a) set in the PWM signal output circuits 23 and 24 change due to factors such as disturbance noise, Since the multiple relationship between the period of the PWM signal and the A / D conversion interval is broken, the generation timing of TrgC and TrgD is deviated from the optimum specific timing.

そこで、第6実施形態として、こうした不都合を回避するための技術について述べる。尚、ここでは、第1実施形態のマイコン10に対して本第6実施形態の技術を適用した場合を例に挙げて説明するが、本第6実施形態の技術は、第2〜第5実施形態のマイコンについても同様に適用することができる。また、以下の第6実施形態に関する説明においては、符号として第1実施形態と同じものを用いる。   Therefore, as a sixth embodiment, a technique for avoiding such inconvenience will be described. Here, a case where the technique of the sixth embodiment is applied to the microcomputer 10 of the first embodiment will be described as an example, but the technique of the sixth embodiment is described in the second to fifth embodiments. The present invention can be similarly applied to the form of the microcomputer. Moreover, in the following description regarding the sixth embodiment, the same reference numerals as those in the first embodiment are used.

第6実施形態のマイコン10は、第1実施形態のマイコン10と比較すると、CPU21が、図14に示す周期補正処理を例えば定期的に行う点が異なっている。   The microcomputer 10 of the sixth embodiment is different from the microcomputer 10 of the first embodiment in that the CPU 21 periodically performs the period correction process shown in FIG.

そして、図14の周期補正処理では、まず、S410にて、実際のA/D変換間隔を計測する処理を行う。   In the period correction process of FIG. 14, first, in S410, a process of measuring an actual A / D conversion interval is performed.

具体的には、A/D変換間隔よりも十分に短い一定の時間毎に、前述した図12のS240と同様の手順により、A/D変換開始タイミングが到来したか否かを判定し、A/D変換開始タイミングと判定する毎に、その時のフリーランタイマの値をA/D変換開始時刻Tsadとして記憶する。そして、図15に示すように、2回記憶した各A/D変換開始時刻Tsadの間隔を、実際のA/D変換間隔Tadの計測値として記憶する。尚、このS410の処理は、A/D変換間隔Tadを1回計測できたならば、以後はスキップされる。また、A/D変換完了タイミングの間隔を、A/D変換間隔Tadとして計測するようにしても良い。   Specifically, it is determined whether or not the A / D conversion start timing has arrived at a constant time sufficiently shorter than the A / D conversion interval by the same procedure as S240 in FIG. Each time it is determined as the / D conversion start timing, the value of the free-run timer at that time is stored as the A / D conversion start time Tsad. Then, as shown in FIG. 15, the interval of each A / D conversion start time Tsad stored twice is stored as a measured value of the actual A / D conversion interval Tad. The process of S410 is skipped after the A / D conversion interval Tad can be measured once. Further, the A / D conversion completion timing interval may be measured as the A / D conversion interval Tad.

次に、S420にて、タイマユニット25からのDMA転送要求信号(この例ではTrgC)の出力間隔を計測する処理を行う。   Next, in S420, processing for measuring the output interval of the DMA transfer request signal (TrgC in this example) from the timer unit 25 is performed.

具体的に説明すると、まず、準備処理として、タイマユニット25内の上記トリガ発生フラグをリセットする処理を行い、その後、A/D変換間隔よりも十分に短い一定の時間毎に、上記トリガ発生フラグを参照することにより、TrgCが発生したか否かを判定する。そして、TrgCが発生したと判定する毎に、上記トリガ発生フラグをリセットすると共に、前述した図11の150と同様に、タイマユニット25内の上記トリガ発生時刻レジスタに記憶されている値、或いはフリーランタイマの現在値を、DMA転送要求信号発生時刻Tgとして記憶する。そして更に、図15に示すように、2回記憶した各DMA転送要求信号発生時刻Tgの間隔を、TrgCの出力間隔Tintとして記憶する。   More specifically, first, as a preparation process, a process for resetting the trigger generation flag in the timer unit 25 is performed, and then the trigger generation flag is set at regular intervals sufficiently shorter than the A / D conversion interval. To determine whether TrgC has occurred. Each time it is determined that TrgC has occurred, the trigger generation flag is reset, and the value stored in the trigger generation time register in the timer unit 25, or the free value, as in 150 of FIG. The current value of the run timer is stored as the DMA transfer request signal generation time Tg. Further, as shown in FIG. 15, the interval between the DMA transfer request signal generation times Tg stored twice is stored as an output interval Tint of TrgC.

次に、S430にて、A/D変換間隔TadとTrgCの出力間隔Tintとの計測が完了したか否かを判定し、それらの計測が完了したならば、S440に移行する。   Next, in S430, it is determined whether or not the measurement of the A / D conversion interval Tad and the output interval Tint of TrgC is completed, and if those measurements are completed, the process proceeds to S440.

そして、S440では、S410の処理で計測したA/D変換間隔Tadと、S420の処理で計測したTrgCの出力間隔Tintとを、下記の式6に代入することにより、PWM信号の周期の補正値である周期補正値Ttmを算出する。   In S440, the A / D conversion interval Tad measured in the process of S410 and the output interval Tint of TrgC measured in the process of S420 are substituted into Equation 6 below, thereby correcting the period of the PWM signal. A period correction value Ttm is calculated.

Ttm=Tad×n−Tint …式6
尚、式6における「n」は、PWM信号の周期をTrgAの出力周期(A/D変換間隔)の何倍に初期設定しているかを示す整数値であり、本実施形態では既述した通り「n=2」である。
Ttm = Tad × n−Tint Equation 6
Note that “n” in Equation 6 is an integer value indicating how many times the PWM signal cycle is initially set to the output cycle (A / D conversion interval) of TrgA. In this embodiment, as described above. “N = 2”.

次にS450にて、PWM信号の現在の周期設定値Tpwmに、上記S440で算出した周期補正値Ttmを加算し、その加算後の値「Tpwm+Ttm」を、補正後の周期設定値Tpwmとして、PWM信号出力回路23における周期値レジスタ23aに再セットする。そして、この再セットにより、当該周期補正処理が終了する。   Next, in S450, the period correction value Ttm calculated in S440 is added to the current period setting value Tpwm of the PWM signal, and the value “Tpwm + Ttm” after the addition is used as the period setting value Tpwm after correction. Reset to the period value register 23a in the signal output circuit 23. And the period correction process is completed by this resetting.

つまり、周期補正処理では、A/D変換間隔Tadのn倍の間隔(=Tad×n)と、本来ならそれと同じはずであるTrgCの出力間隔Tintとを検出し、それらの差分だけPWM信号の周期設定値Tpwmを補正することで、TrgCの出力間隔Tintが実際のA/D変換間隔Tadのn倍の間隔と等しくなるようにしている。   That is, in the period correction process, an interval n times the A / D conversion interval Tad (= Tad × n) and an output interval Tint of TrgC that should be the same as that of the A / D conversion interval Tad are detected. By correcting the cycle setting value Tpwm, the output interval Tint of TrgC is made equal to the interval n times the actual A / D conversion interval Tad.

そして、このような第6実施形態のマイコン10によれば、TrgCの発生タイミングが目的のタイミングからずれたままになることを防止することができる。   According to the microcomputer 10 of the sixth embodiment, it is possible to prevent the generation timing of TrgC from being deviated from the target timing.

尚、周期補正処理によって周期設定値を補正した後(具体的にはS450の後)、第5実施形態で説明したパルス幅補正処理を実施して、パルス幅設定値の補正も行うことが好ましい。PWM信号の周期が変更されたことにより、TrgCの発生タイミングが最適タイミングからずれてしまうのを防止するためである。   In addition, after correcting the cycle setting value by the cycle correction processing (specifically after S450), it is preferable to perform the pulse width correction processing described in the fifth embodiment to also correct the pulse width setting value. . This is to prevent the generation timing of TrgC from deviating from the optimal timing due to the change in the period of the PWM signal.

また、上記の周期補正処理は、第2〜第5実施形態のマイコンにおいても同様に実施することができる。そして、第3実施形態のマイコン20ならば、TrgC及びPWM信号Cについてだけでなく、TrgD及びPWM信号Dについても周期補正処理を行うようにすれば良い。また、第4実施形態のマイコン30ならば、図14のS420にて、TrgCとTrgDとのうちの何れか一方の出力間隔を計測すれば良い。   Moreover, said period correction process can be implemented similarly in the microcomputers of the second to fifth embodiments. In the microcomputer 20 of the third embodiment, the period correction process may be performed not only for the TrgC and the PWM signal C but also for the TrgD and the PWM signal D. In the microcomputer 30 of the fourth embodiment, the output interval of either one of TrgC and TrgD may be measured in S420 of FIG.

一方、周期補正処理は、定期的にではなく、不定期に行うようにしたり、例えばマイコンが起動した後の所定タイミングで一回だけ行うようにしても良い。   On the other hand, the period correction process may be performed not regularly but irregularly, or may be performed only once at a predetermined timing after the microcomputer is activated, for example.

また、上記S410の処理では、A/D変換間隔Tadの計測値に僅かながら誤差が生じることとなる。なぜなら、本実施形態では、A/D変換器11の状態を一定の時間毎にモニタすることで、A/D変換開始タイミングを検知していることと、A/D変換開始タイミングと判定してからフリーランタイマの値を記憶するまでに若干の処理遅れがあるためであり、更に、厳密にはフリーランタイマの1カウント分の時間も計測誤差の要因となる。また、このことは、A/D変換完了タイミングの間隔をA/D変換間隔Tadとして計測するようにした場合も同様である。   In the process of S410, a slight error occurs in the measured value of the A / D conversion interval Tad. This is because, in the present embodiment, by monitoring the state of the A / D converter 11 at regular time intervals, it is determined that the A / D conversion start timing is detected and the A / D conversion start timing is determined. This is because there is a slight processing delay until the value of the free-run timer is stored, and more strictly speaking, the time for one count of the free-run timer also causes a measurement error. This also applies to the case where the A / D conversion completion timing interval is measured as the A / D conversion interval Tad.

このため、例えば、S410ではA/D変換間隔Tadの計測を複数回行い、その平均値を周期設定値の補正に使用(具体的には、前述の式6に代入)するようにして、A/D変換間隔Tadの計測誤差による影響を少なくするようにしても良い。また更に、計測したA/D変換間隔Tadの平均値をそのまま用いるのではなく、その平均値から、設計上想定される計測誤差(計測値のばらつき)の中央値を引き、その減算後の値をA/D変換間隔Tadの計測値として、前述の式6に代入するようにしても良い。   For this reason, for example, in S410, the A / D conversion interval Tad is measured a plurality of times, and the average value is used to correct the cycle setting value (specifically, substituted into the above-described equation 6). You may make it reduce the influence by the measurement error of / D conversion space | interval Tad. Furthermore, the average value of the measured A / D conversion interval Tad is not used as it is, but the median value of the measurement error (measurement value variation) assumed in design is subtracted from the average value, and the value after the subtraction May be substituted into Equation 6 as a measurement value of the A / D conversion interval Tad.

尚、A/D変換器11のA/D変換開始タイミング(あるいはA/D変換完了タイミング)にて、フリーランタイマの値が特定のレジスタにコピーされるようになっているのであれば、その特定のレジスタからA/D変換開始時刻(あるいはA/D変換完了時刻)を取得することができるため、A/D変換器11の状態を一定の時間毎にモニタすることによる誤差やフリーランタイマの値を記憶するまでの処理遅れによる誤差の心配はない。   If the value of the free-run timer is copied to a specific register at the A / D conversion start timing (or A / D conversion completion timing) of the A / D converter 11, Since the A / D conversion start time (or A / D conversion completion time) can be acquired from a specific register, an error caused by monitoring the state of the A / D converter 11 at regular intervals and a free-run timer There is no worry of errors due to processing delays until the value is stored.

以上、本発明の一実施形態について説明したが、本発明はこうした実施形態に何等限定されるものではなく、本発明の要旨を逸脱しない範囲において、種々なる態様で実施し得ることは勿論である。   As mentioned above, although one Embodiment of this invention was described, this invention is not limited to such Embodiment at all, Of course, in the range which does not deviate from the summary of this invention, it can implement in a various aspect. .

例えば、A/D変換器11は、各入力端子のアナログ信号を複数のA/D変換回路でそれぞれ並行してA/D変換する構成のものでも良い。   For example, the A / D converter 11 may be configured to A / D-convert analog signals at each input terminal in parallel by a plurality of A / D conversion circuits.

また、DMAコントローラ16に対して設定する転送対象A/Dチャンネルは、各DMA転送要求信号(TrgB、TrgC、TrgD)について1つに限らず複数設定できるようになっていても良い。   Further, the transfer target A / D channel set for the DMA controller 16 is not limited to one for each DMA transfer request signal (TrgB, TrgC, TrgD), and a plurality of transfer target A / D channels may be set.

また、マイコン10,20,30は、1チップマイコンに限らず、前述した構成要素の一部が別チップになっていても良い。つまり、本発明の信号処理装置は、複数チップからなるマイコンの形態でも良く、また、マイコン以外の形態でも良い。   Further, the microcomputers 10, 20, and 30 are not limited to one-chip microcomputers, and some of the above-described constituent elements may be separate chips. That is, the signal processing apparatus of the present invention may be in the form of a microcomputer composed of a plurality of chips, or may be in a form other than the microcomputer.

また、A/D起動タイマ13は、全てハードウェアによって構成されたタイマに限らず、ソフトウェアを利用したタイマでも良い。   Further, the A / D activation timer 13 is not limited to a timer composed entirely of hardware, but may be a timer using software.

また、A/D変換対象は、インジェクタ圧信号に限らず、例えばエンジンの気筒内の圧力を検出するための気筒内圧センサからの信号等でも良い。   The A / D conversion target is not limited to the injector pressure signal, but may be, for example, a signal from a cylinder pressure sensor for detecting the pressure in the cylinder of the engine.

また、PWM信号出力回路23,24は、パルス幅値レジスタ23b,24bに書き込まれた値に該当する時間だけローになるPWM信号(即ち、ロー時間がパルス幅であるPWM信号)を出力するようになっていても良い。   The PWM signal output circuits 23 and 24 output a PWM signal that is low for a time corresponding to the value written in the pulse width value registers 23b and 24b (that is, a PWM signal whose low time is a pulse width). It may be.

第1実施形態のマイコンと、それを搭載したECUとを表す構成図である。It is a block diagram showing the microcomputer of 1st Embodiment and ECU which mounts it. 第1実施形態のマイコンにおける各部の動作を表すタイムチャートである。It is a time chart showing operation | movement of each part in the microcomputer of 1st Embodiment. DMA転送要求信号(TrgC)を発生させるタイミングを説明するための説明図である。It is explanatory drawing for demonstrating the timing which generates a DMA transfer request signal (TrgC). パルス幅値レジスタに設定するPWM信号のパルス幅Tdutyを説明するための説明図である。It is explanatory drawing for demonstrating the pulse width Tduty of the PWM signal set to a pulse width value register. 第2実施形態のマイコンにおける各部の動作を表すタイムチャートである。It is a time chart showing operation | movement of each part in the microcomputer of 2nd Embodiment. 第3実施形態のマイコンと、それを搭載したECUとを表す構成図である。It is a block diagram showing the microcomputer of 3rd Embodiment, and ECU which mounts it. 第3実施形態のマイコンにおける各部の動作を表すタイムチャートである。It is a time chart showing operation | movement of each part in the microcomputer of 3rd Embodiment. 第4実施形態のマイコンと、それを搭載したECUとを表す構成図である。It is a block diagram showing the microcomputer of 4th Embodiment and ECU which mounts it. 第4実施形態のマイコンにおける各部の動作を表すタイムチャートである。It is a time chart showing operation | movement of each part in the microcomputer of 4th Embodiment. 第5実施形態のマイコンで行われる第1〜第3の補正処理を説明するための説明図である。It is explanatory drawing for demonstrating the 1st-3rd correction process performed with the microcomputer of 5th Embodiment. 第1の補正処理を表すフローチャートである。It is a flowchart showing a 1st correction process. 第2の補正処理を表すフローチャートである。It is a flowchart showing a 2nd correction process. 第3の補正処理を表すフローチャートである。It is a flowchart showing a 3rd correction process. 第6実施形態のマイコンで行われる周期補正処理を表すフローチャートである。It is a flowchart showing the period correction process performed with the microcomputer of 6th Embodiment. 周期補正処理を説明するための説明図である。It is explanatory drawing for demonstrating a period correction process. 従来のマイコンを説明するための説明図である。It is explanatory drawing for demonstrating the conventional microcomputer.

符号の説明Explanation of symbols

1…ECU(電子制御装置)、3…エンジン、5…入力回路、IJ1〜IJ4…インジェクタ、S1〜S4…圧力センサ、10,20,30…マイコン、11…A/D変換器、13…A/D起動タイマ、16,26…DMAコントローラ、17…RAM、19…ROM、21…CPU、23,24…PWM信号出力回路、23a,24a…周期値レジスタ、23b,24b…パルス幅値レジスタ、25…タイマユニット、25a,25b,25c…DMA転送要求機能の回路、J1,J3…信号出力端子、J2,J4…信号入力端子   DESCRIPTION OF SYMBOLS 1 ... ECU (electronic control apparatus), 3 ... Engine, 5 ... Input circuit, IJ1-IJ4 ... Injector, S1-S4 ... Pressure sensor, 10, 20, 30 ... Microcomputer, 11 ... A / D converter, 13 ... A / D start timer, 16, 26 ... DMA controller, 17 ... RAM, 19 ... ROM, 21 ... CPU, 23,24 ... PWM signal output circuit, 23a, 24a ... period value register, 23b, 24b ... pulse width value register, 25 ... Timer unit, 25a, 25b, 25c ... DMA transfer request function circuit, J1, J3 ... Signal output terminal, J2, J4 ... Signal input terminal

Claims (11)

プログラムを実行するCPUと、
A/D変換対象のアナログ信号が入力される入力端子を複数有すると共に、A/D変換の実施を指令するA/D変換要求信号を受けると、前記各入力端子からの複数のアナログ信号をA/D変換するA/D変換動作を開始して、該A/D変換動作が完了すると、A/D変換完了信号を出力するA/D変換器と、
前記A/D変換器に前記A/D変換要求信号を一定時間毎に出力するA/D変換要求手段と、
前記A/D変換器によってA/D変換された後のデータであるA/D変換データを格納するためのメモリと、
前記A/D変換器からの前記A/D変換完了信号が、前記A/D変換器から前記メモリへのDMA転送を指令するDMA転送要求信号として与えられるようになっており、そのDMA転送要求信号を受けると、前記A/D変換器から前記メモリへのデータ転送を行うDMAコントローラと、
を備えた信号処理装置であって、
前記CPUにより任意に設定される周期及びパルス幅のPWM信号を出力するPWM信号出力回路と、
前記PWM信号出力回路から出力されるPWM信号が入力され、そのPWM信号に特定方向のエッジが発生すると、前記DMAコントローラに、前記A/D変換完了信号とは別のDMA転送要求信号を出力するデータ転送要求手段とを備え、
更に、前記DMAコントローラは、自己に与えられる前記DMA転送要求信号の各々について、前記A/D変換器の何れの入力端子に対応するA/D変換データを前記メモリに転送するかが前記CPUによって指定されるようになっており、前記DMA転送要求信号の何れかを受けると、前記A/D変換器の各入力端子のうち、その受けたDMA転送要求信号について前記CPUにより事前に指定されている入力端子に対応したA/D変換データを、前記A/D変換器から前記メモリに転送すること、
を特徴とする信号処理装置。
A CPU for executing the program;
When a plurality of input terminals to which analog signals to be A / D converted are input and an A / D conversion request signal instructing execution of A / D conversion is received, a plurality of analog signals from the input terminals are converted to A An A / D converter that outputs an A / D conversion completion signal when the A / D conversion operation is started and the A / D conversion operation is completed;
A / D conversion request means for outputting the A / D conversion request signal to the A / D converter at regular intervals;
A memory for storing A / D conversion data which is data after A / D conversion by the A / D converter;
The A / D conversion completion signal from the A / D converter is provided as a DMA transfer request signal for instructing DMA transfer from the A / D converter to the memory. When receiving a signal, a DMA controller for transferring data from the A / D converter to the memory;
A signal processing apparatus comprising:
A PWM signal output circuit for outputting a PWM signal having a period and a pulse width arbitrarily set by the CPU;
When a PWM signal output from the PWM signal output circuit is input and an edge in a specific direction occurs in the PWM signal, a DMA transfer request signal different from the A / D conversion completion signal is output to the DMA controller. Data transfer request means,
Further, the CPU determines whether the A / D conversion data corresponding to which input terminal of the A / D converter is transferred to the memory for each of the DMA transfer request signals given to the DMA controller. When any of the DMA transfer request signals is received, the received DMA transfer request signal is designated in advance by the CPU among the input terminals of the A / D converter. Transferring A / D conversion data corresponding to the input terminal from the A / D converter to the memory;
A signal processing device.
請求項1に記載の信号処理装置において、
前記PWM信号のエッジは、前記CPUによって前記PWM信号出力回路に設定される周期及びパルス幅の各値のうち、前記周期の値により発生間隔が変化し、且つ、前記パルス幅の値によっては発生タイミングが変化しない方のエッジである周期エッジと、その周期エッジとは逆方向のエッジであって、前記パルス幅の値により前記周期エッジからの発生間隔が変化する方のデューティエッジとがあり、
前記特定方向のエッジは、前記周期エッジであること、
を特徴とする信号処理装置。
The signal processing device according to claim 1,
The edge of the PWM signal is generated depending on the value of the period among the values of the period and pulse width set in the PWM signal output circuit by the CPU, and is generated depending on the value of the pulse width. There is a periodic edge which is an edge whose timing does not change, and an edge in a direction opposite to the periodic edge, and a duty edge whose generation interval from the periodic edge changes according to the value of the pulse width,
The edge in the specific direction is the periodic edge;
A signal processing device.
請求項1に記載の信号処理装置において、
前記PWM信号のエッジは、前記CPUによって前記PWM信号出力回路に設定される周期及びパルス幅の各値のうち、前記周期の値により発生間隔が変化し、且つ、前記パルス幅の値によっては発生タイミングが変化しない方のエッジである周期エッジと、その周期エッジとは逆方向のエッジであって、前記パルス幅の値により前記周期エッジからの発生間隔が変化する方のデューティエッジとがあり、
前記特定方向のエッジは、前記デューティエッジであること、
を特徴とする信号処理装置。
The signal processing device according to claim 1,
The edge of the PWM signal is generated depending on the value of the period among the values of the period and pulse width set in the PWM signal output circuit by the CPU, and is generated depending on the value of the pulse width. There is a periodic edge which is an edge whose timing does not change, and an edge in a direction opposite to the periodic edge, and a duty edge whose generation interval from the periodic edge changes according to the value of the pulse width,
The edge in the specific direction is the duty edge;
A signal processing device.
請求項1に記載の信号処理装置において、
前記PWM信号のエッジは、前記CPUによって前記PWM信号出力回路に設定される周期及びパルス幅の各値のうち、前記周期の値により発生間隔が変化し、且つ、前記パルス幅の値によっては発生タイミングが変化しない方のエッジである周期エッジと、その周期エッジとは逆方向のエッジであって、前記パルス幅の値により前記周期エッジからの発生間隔が変化する方のデューティエッジとがあり、
前記特定方向のエッジは、前記周期エッジと、前記デューティエッジとの両方であり、
前記データ転送要求手段は、前記PWM信号に前記周期エッジが発生したときと、前記PWM信号に前記デューティエッジが発生したときとで、別々のDMA転送要求信号を前記DMAコントローラに出力するようになっていること、
を特徴とする信号処理装置。
The signal processing device according to claim 1,
The edge of the PWM signal is generated depending on the value of the period among the values of the period and pulse width set in the PWM signal output circuit by the CPU, and is generated depending on the value of the pulse width. There is a periodic edge which is an edge whose timing does not change, and an edge in a direction opposite to the periodic edge, and a duty edge whose generation interval from the periodic edge changes according to the value of the pulse width,
The edge in the specific direction is both the periodic edge and the duty edge,
The data transfer request means outputs different DMA transfer request signals to the DMA controller when the periodic edge occurs in the PWM signal and when the duty edge occurs in the PWM signal. That
A signal processing device.
請求項3に記載の信号処理装置において、
前記CPUは、前記PWM信号の周期を、前記A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定すると共に、前記PWM信号のパルス幅を所定値に設定するようになっており、
更に、前記CPUは、前記データ転送要求手段が前記DMA転送要求信号を出力したタイミングを検出し、その検出結果に基づいて、前記データ転送要求手段からの前記DMA転送要求信号の出力タイミングが、前記A/D変換器が前記A/D変換動作を完了してから次回の前記A/D変換動作を開始するまでの期間中における特定タイミングとなるように、前記PWM信号のパルス幅の設定値を補正するパルス幅補正処理を行うこと、
を特徴とする信号処理装置。
The signal processing device according to claim 3.
The CPU sets the period of the PWM signal to n times the output period of the A / D conversion request signal (n is an integer of 1 or more), and sets the pulse width of the PWM signal to a predetermined value. And
Further, the CPU detects the timing at which the data transfer request means outputs the DMA transfer request signal, and based on the detection result, the output timing of the DMA transfer request signal from the data transfer request means is The setting value of the pulse width of the PWM signal is set so that it becomes a specific timing during a period from when the A / D converter completes the A / D conversion operation to when the next A / D conversion operation starts. Performing pulse width correction processing to correct,
A signal processing device.
請求項5に記載の信号処理装置において、
前記CPUは、前記パルス幅補正処理として、
前記データ転送要求手段が前記DMA転送要求信号を出力する直前に前記A/D変換器が前記A/D変換動作を完了した時刻から、前記データ転送要求手段が前記DMA転送要求信号を出力するまでの時間であるA/D変換完了後余裕時間を、前記DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換完了後余裕時間が該A/D変換完了後余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第1の補正処理と、
前記データ転送要求手段が前記DMA転送要求信号を出力してから前記A/D変換器が次回の前記A/D変換動作を開始するまでの時間であるA/D変換開始前余裕時間を、前記DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換開始前余裕時間が該A/D変換開始前余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第2の補正処理と、
前記データ転送要求手段が前記DMA転送要求信号を出力する直前に前記A/D変換器が前記A/D変換動作を開始した時刻から、前記データ転送要求手段が前記DMA転送要求信号を出力するまでの時間であるA/D変換開始後余裕時間を、前記DMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換開始後余裕時間が該A/D変換開始後余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第3の補正処理とのうち、
少なくとも1つを行うことを特徴とする信号処理装置。
The signal processing device according to claim 5,
The CPU performs the pulse width correction process as follows.
From the time when the A / D converter completes the A / D conversion operation immediately before the data transfer request means outputs the DMA transfer request signal, until the data transfer request means outputs the DMA transfer request signal. A margin time after completion of A / D conversion is detected as the output timing of the DMA transfer request signal, and the margin time after completion of A / D conversion is determined based on the detection result after completion of the A / D conversion. A first correction process for correcting a set value of a pulse width of the PWM signal so as to be a target value of a margin time;
A margin time before the start of A / D conversion, which is a time from when the data transfer request means outputs the DMA transfer request signal to when the A / D converter starts the next A / D conversion operation, The pulse of the PWM signal is detected as the output timing of the DMA transfer request signal, and based on the detection result, the margin time before the start of A / D conversion becomes the target value of the margin time before the start of A / D conversion. A second correction process for correcting the set value of the width;
From the time when the A / D converter starts the A / D conversion operation immediately before the data transfer request means outputs the DMA transfer request signal, until the data transfer request means outputs the DMA transfer request signal. A margin time after the start of A / D conversion is detected as an output timing of the DMA transfer request signal, and based on the detection result, the margin time after the start of A / D conversion is Among the third correction processes for correcting the setting value of the pulse width of the PWM signal so as to be the target value of the margin time,
A signal processing device that performs at least one.
請求項4に記載の信号処理装置において、
前記CPUは、前記PWM信号の周期を、前記A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定すると共に、前記PWM信号のパルス幅を所定値に設定するようになっており、
更に、前記CPUは、前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力したタイミングを検出し、その検出結果に基づいて、前記デューティエッジに対応する方のDMA転送要求信号の出力タイミングが、前記A/D変換器が前記A/D変換動作を完了してから次回の前記A/D変換動作を開始するまでの期間中における特定タイミングとなるように、前記PWM信号のパルス幅の設定値を補正するパルス幅補正処理を行うこと、
を特徴とする信号処理装置。
The signal processing device according to claim 4,
The CPU sets the period of the PWM signal to n times the output period of the A / D conversion request signal (n is an integer of 1 or more), and sets the pulse width of the PWM signal to a predetermined value. And
Further, the CPU detects the timing at which the data transfer request means outputs the DMA transfer request signal corresponding to the duty edge, and based on the detection result, the DMA transfer request corresponding to the duty edge. The PWM signal is set so that the output timing of the signal becomes a specific timing during a period from when the A / D converter completes the A / D conversion operation until the next A / D conversion operation starts. Performing pulse width correction processing to correct the set value of the pulse width of
A signal processing device.
請求項7に記載の信号処理装置において、
前記CPUは、前記パルス幅補正処理として、
前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力する直前に前記A/D変換器が前記A/D変換動作を完了した時刻から、前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力するまでの時間であるA/D変換完了後余裕時間を、前記デューティエッジに対応する方のDMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換完了後余裕時間が該A/D変換完了後余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第1の補正処理と、
前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力してから前記A/D変換器が次回の前記A/D変換動作を開始するまでの時間であるA/D変換開始前余裕時間を、前記デューティエッジに対応する方のDMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換開始前余裕時間が該A/D変換開始前余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第2の補正処理と、
前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力する直前に前記A/D変換器が前記A/D変換動作を開始した時刻から、前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力するまでの時間であるA/D変換開始後余裕時間を、前記デューティエッジに対応する方のDMA転送要求信号の出力タイミングとして検出し、その検出結果に基づいて、前記A/D変換開始後余裕時間が該A/D変換開始後余裕時間の目標値となるように、前記PWM信号のパルス幅の設定値を補正する第3の補正処理とのうち、
少なくとも1つを行うことを特徴とする信号処理装置。
The signal processing device according to claim 7,
The CPU performs the pulse width correction process as follows.
From the time when the A / D converter completes the A / D conversion operation immediately before the data transfer request means outputs the DMA transfer request signal corresponding to the duty edge, the data transfer request means The margin time after completion of A / D conversion, which is the time until the DMA transfer request signal corresponding to the edge is output, is detected as the output timing of the DMA transfer request signal corresponding to the duty edge, and the detection result A first correction process for correcting the set value of the pulse width of the PWM signal so that the margin time after completion of A / D conversion becomes a target value of the margin time after completion of A / D conversion, based on
A / D conversion which is the time from when the data transfer request means outputs the DMA transfer request signal corresponding to the duty edge to when the A / D converter starts the next A / D conversion operation A margin time before start is detected as an output timing of the DMA transfer request signal corresponding to the duty edge, and based on the detection result, the margin time before A / D conversion start is the margin before the A / D conversion start. A second correction process for correcting the set value of the pulse width of the PWM signal so as to be a target value of time;
From the time when the A / D converter starts the A / D conversion operation immediately before the data transfer request means outputs the DMA transfer request signal corresponding to the duty edge, the data transfer request means The margin time after the start of A / D conversion, which is the time until the DMA transfer request signal corresponding to the edge is output, is detected as the output timing of the DMA transfer request signal corresponding to the duty edge, and the detection result And a third correction process for correcting the set value of the pulse width of the PWM signal so that the margin time after the start of A / D conversion becomes the target value of the margin time after the start of A / D conversion. home,
A signal processing device that performs at least one.
請求項1ないし請求項3、請求項5及び請求項6の何れか1項に記載の信号処理装置において、
前記CPUは、前記PWM信号の周期を、前記A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定するようになっており、
更に、前記CPUは、前記データ転送要求手段が前記DMA転送要求信号を出力する間隔である信号出力間隔と、前記A/D変換器が前記A/D変換動作を行う間隔であるA/D変換間隔の前記n倍の間隔と検出し、その両検出値の差に基づいて、前記信号出力間隔が前記A/D変換間隔の前記n倍の間隔と等しくなるように、前記PWM信号の周期の設定値を補正する周期補正処理を行うこと、
を特徴とする信号処理装置。
In the signal processing device according to any one of claims 1 to 3, claim 5, and claim 6,
The CPU sets the period of the PWM signal to n times the output period of the A / D conversion request signal (n is an integer of 1 or more),
The CPU further includes a signal output interval that is an interval at which the data transfer request means outputs the DMA transfer request signal and an A / D conversion that is an interval at which the A / D converter performs the A / D conversion operation. The interval of the PWM signal is detected so that the interval of the PWM signal is equal to the interval of n times the A / D conversion interval based on the difference between the detected values. Performing a period correction process to correct the set value,
A signal processing device.
請求項4、請求項7及び請求項8の何れか1項に記載の信号処理装置において、
前記CPUは、前記PWM信号の周期を、前記A/D変換要求信号の出力周期のn倍(nは1以上の整数)に設定するようになっており、
更に、前記CPUは、前記データ転送要求手段が前記デューティエッジに対応する方のDMA転送要求信号を出力する間隔と前記データ転送要求手段が前記周期エッジに対応する方のDMA転送要求信号を出力する間隔との何れかである信号出力間隔と、前記A/D変換器が前記A/D変換動作を行う間隔であるA/D変換間隔の前記n倍の間隔とを検出し、その両検出値の差に基づいて、前記信号出力間隔が前記A/D変換間隔の前記n倍の間隔と等しくなるように、前記PWM信号の周期の設定値を補正する周期補正処理を行うこと、
を特徴とする信号処理装置。
In the signal processing device according to any one of claims 4, 7, and 8,
The CPU sets the period of the PWM signal to n times the output period of the A / D conversion request signal (n is an integer of 1 or more),
Further, the CPU outputs an interval at which the data transfer request means outputs a DMA transfer request signal corresponding to the duty edge and a data transfer request means at which the data transfer request means corresponds to the periodic edge. A signal output interval that is any one of the intervals, and an interval that is n times the A / D conversion interval that is the interval at which the A / D converter performs the A / D conversion operation, and both detected values thereof Performing a period correction process for correcting a set value of the period of the PWM signal so that the signal output interval is equal to the interval of n times the A / D conversion interval based on the difference of
A signal processing device.
請求項1ないし請求項10の何れか1項に記載の信号処理装置において、
前記PWM信号出力回路及び前記データ転送要求手段を複数組備えていること、
を特徴とする信号処理装置。
The signal processing device according to any one of claims 1 to 10,
A plurality of sets of the PWM signal output circuit and the data transfer request means;
A signal processing device.
JP2008322284A 2008-12-18 2008-12-18 Signal processing device Active JP5163475B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008322284A JP5163475B2 (en) 2008-12-18 2008-12-18 Signal processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008322284A JP5163475B2 (en) 2008-12-18 2008-12-18 Signal processing device

Publications (2)

Publication Number Publication Date
JP2010146258A JP2010146258A (en) 2010-07-01
JP5163475B2 true JP5163475B2 (en) 2013-03-13

Family

ID=42566642

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008322284A Active JP5163475B2 (en) 2008-12-18 2008-12-18 Signal processing device

Country Status (1)

Country Link
JP (1) JP5163475B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5593212B2 (en) 2010-12-21 2014-09-17 ルネサスエレクトロニクス株式会社 Semiconductor device
JP5973307B2 (en) * 2012-10-03 2016-08-23 ダイヤモンド電機株式会社 Ion current detection device for internal combustion engine
JP2018096273A (en) * 2016-12-13 2018-06-21 株式会社デンソー Electronic controller
JP6981512B2 (en) * 2016-12-13 2021-12-15 株式会社デンソー Electronic control device
JP6886317B2 (en) * 2017-03-16 2021-06-16 アズビル株式会社 Multi-channel AD converter and processing equipment
JP7435182B2 (en) 2020-04-03 2024-02-21 株式会社デンソー electronic control unit

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0993799A (en) * 1995-09-22 1997-04-04 Denso Corp Drive control device for rotary unit
JP3458602B2 (en) * 1996-06-17 2003-10-20 株式会社デンソー Electric load energization control device
JP3578614B2 (en) * 1998-01-29 2004-10-20 Necマイクロシステム株式会社 PWM signal generation circuit
JP3777963B2 (en) * 2000-09-18 2006-05-24 株式会社デンソー Engine control device
JP4299657B2 (en) * 2003-12-25 2009-07-22 株式会社ルネサステクノロジ Microcontroller
JP4532450B2 (en) * 2006-09-06 2010-08-25 株式会社デンソー Engine control data processing apparatus and engine control apparatus

Also Published As

Publication number Publication date
JP2010146258A (en) 2010-07-01

Similar Documents

Publication Publication Date Title
JP5163475B2 (en) Signal processing device
US7310575B2 (en) Apparatus for processing sensor signal from knock sensor of internal combustion engine
JP2014086860A (en) On-vehicle electronic control device
US8914222B2 (en) Electronic control unit of internal combustion engine
JP5326952B2 (en) A / D conversion processor
JP5365551B2 (en) Internal combustion engine control device
JP2011160199A (en) A/d conversion processing apparatus
US7353104B2 (en) Signal output unit and electronic control unit
WO2004031789A1 (en) Test device and test method
JP4751343B2 (en) A / D converter
US20230125037A1 (en) Adaptation to a pulse width modulation frequency variation for a sensor operating in a synchronous mode
TWI487269B (en) Phase interpolating apparatus and phase interpolating method
JP2019035377A (en) Ad-conversion processor
JPH0610818A (en) Knocking control device for internal combustion engine
US20100313055A1 (en) Memory system
JP2021163425A (en) Electronic control device
JP4660987B2 (en) Inductive load current controller
JP2010251842A (en) Controller and control method
US8131455B2 (en) Engine control apparatus including computing section and A/D converting section
JP2010041152A (en) Ad conversion controller, and vehicle controller
JP2019027340A (en) Fuel injection control device
JP2006217507A (en) Electronic controller
JP6981512B2 (en) Electronic control device
JP6631177B2 (en) Control device for internal combustion engine
JP5940945B2 (en) Automotive control device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110304

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120413

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120424

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120620

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20121120

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121203

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151228

Year of fee payment: 3

R151 Written notification of patent or utility model registration

Ref document number: 5163475

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151228

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250