JPH08265156A - Semiconductor integrated circuit device and control system - Google Patents

Semiconductor integrated circuit device and control system

Info

Publication number
JPH08265156A
JPH08265156A JP7085929A JP8592995A JPH08265156A JP H08265156 A JPH08265156 A JP H08265156A JP 7085929 A JP7085929 A JP 7085929A JP 8592995 A JP8592995 A JP 8592995A JP H08265156 A JPH08265156 A JP H08265156A
Authority
JP
Japan
Prior art keywords
conversion
signal
data
register
bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP7085929A
Other languages
Japanese (ja)
Inventor
Naomiki Mitsuishi
直幹 三ツ石
Hiroyuki Kobayashi
浩之 小林
Hiroshi Saito
博 斉藤
Mitsumasa Sato
光正 佐藤
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.)
Hitachi ULSI Engineering Corp
Hitachi Ltd
Original Assignee
Hitachi ULSI Engineering Corp
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi ULSI Engineering Corp, Hitachi Ltd filed Critical Hitachi ULSI Engineering Corp
Priority to JP7085929A priority Critical patent/JPH08265156A/en
Publication of JPH08265156A publication Critical patent/JPH08265156A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE: To improve the processing capability by storing A/D conversion result to a 1st data register of plural data registers, transferring the stored data to a 2nd data register and incorporating the result of A/D conversion. CONSTITUTION: A control logic conducts data input-output with control registers ADCSR, ADCR and data registers ADDRA-ADDRH via a bus interface. As soon as the result of A/D conversion is stored in the register ADDRA, the conversion result having been stored previously is transferred to other data register according to the data stored in the register ADCR. That is, any of two-stage operations as AINO→ADDRA→ADDRB and two-sets of two-stage operations as AINO→ADDRA→ADDRC and AINI→ADDRB→ADDRD and one-set of 4-stage operations as AINO→ADDRA→ADDRB→ADDRC→ADDRD is selected.

Description

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

【0001】[0001]

【産業上の利用分野】この発明は、半導体集積回路装置
と制御システムに関し、特にアナログ/ディジタル変換
回路内蔵のシングルチップのマイクロコンピュータとそ
れを用いた制御システムに利用して有効な技術に関する
ものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a semiconductor integrated circuit device and a control system, and more particularly to a technique effective for use in a single-chip microcomputer incorporating an analog / digital conversion circuit and a control system using the same. is there.

【0002】[0002]

【従来の技術】シングルチップのマイクロコンピュータ
は、昭和59年11月30日オーム社発行の「LSIハ
ンドブック」第540頁〜第541頁に記載されている
ように、中央処理装置(CPU)を中心にしてプログラ
ム保持用のROM(リード・オンリー・メモリ)、デー
タ保持用のRAM(ランダム・アクセス・メモリ)、及
びデータの入出力を行うための入出力回路などの機能ブ
ロックが1つの半導体基板上に形成されてなる。かかる
入出力回路にはA/D(アナログ/ディジタル)変換回
路も含まれる。A/D変換回路を内蔵したシングルチッ
プマイクロコンピュータの例としては、平成5年3月
(株)日立製作所発行「H8/3003 ハードウェア
マニュアル」がある。
2. Description of the Related Art A single-chip microcomputer mainly includes a central processing unit (CPU) as described in "LSI Handbook", pages 540 to 541, issued by Ohmsha on November 30, 1984. On a semiconductor substrate, functional blocks such as a ROM (read only memory) for holding programs, a RAM (random access memory) for holding data, and an input / output circuit for inputting / outputting data It is formed in. Such an input / output circuit also includes an A / D (analog / digital) conversion circuit. An example of a single-chip microcomputer incorporating an A / D conversion circuit is "H8 / 3003 Hardware Manual" issued by Hitachi, Ltd. in March 1993.

【0003】高速のA/D変換回路の例としては、特開
昭60−124125号公報、特開平2−126726
号公報等があり、サンプリングホールド回路を複数持
ち、共通のA/D変換回路とパイプライン(前回のサン
プンリグした結果の変換と次のサンプリングを同時に行
う、換言すれば、サンプリング回路が交互に動作する)
をさせることによって高速化を実現している。また、サ
ブレンジ方式のA/D変換方式としては、例えば特開平
4−176215号公報があり、部分的なフラッシュ変
換を行うことにより、回路規模をさほど増加させずに高
速化を実現している。
As examples of high-speed A / D conversion circuits, there are JP-A-60-124125 and JP-A-2-126726.
There is a plurality of sampling and holding circuits, and a common A / D conversion circuit and a pipeline (conversion of the result of the previous sampling and the next sampling are performed at the same time, in other words, the sampling circuits operate alternately. )
By doing so, speeding up is realized. As an A / D conversion method of the sub-range method, there is, for example, Japanese Patent Laid-Open No. 4-176215, and partial flash conversion is performed to realize high speed operation without increasing the circuit scale.

【0004】[0004]

【発明が解決しようとする課題】シングルチップマイク
ロコンピュータに内蔵されたA/D変換回路に設けられ
た複数のアナログ入力チャンネルは、それが用いられる
システムによってそれぞれ異なる。例えば、モータを制
御する場合には、モータ駆動電流を電圧変換した値を入
力する。モータの制御が3相であれば、アナログ入力は
3乃至6チャンネルとなる。電流値の検出を2相のみで
よいならば2チャンネルでよい。上記のシステムにおい
て、雰囲気温度やモータの温度などをアナログ入力する
ことが必要である。モータの駆動を内蔵のタイマ出力で
行うとすれば、かかる駆動電流の測定は、タイマの所望
のタイミングから短時間に行うことが望ましい。3相目
の電流値を計算により求めるようにすると、測定対象の
2相の電流値を、同時点のアナログ値が得られるように
すること、つまり同時サンプリングを行うことが望まし
い。A/D変換動作の高速化や複数のアナログ入力を同
時に得ることによってタイマの所定のタイミングでの、
より正確な電流値を得ることができ、ひいてはモータの
駆動制御の精度を向上させることができる。これに対し
て、雰囲気温度やモータの温度などの検出頻度は低くて
よく、かつ、モータの駆動タイミングとは独立したタイ
ミングでよい。
The plurality of analog input channels provided in the A / D conversion circuit incorporated in the single-chip microcomputer differ depending on the system in which they are used. For example, when controlling a motor, a value obtained by converting the motor drive current into a voltage is input. If the control of the motor is three-phase, the analog input is 3 to 6 channels. If the current value can be detected in only two phases, two channels can be used. In the above system, it is necessary to input the ambient temperature and the temperature of the motor in analog form. If the motor is driven by a built-in timer output, it is desirable to measure the drive current in a short time from the desired timing of the timer. When the current value of the third phase is obtained by calculation, it is desirable that the current values of the two phases to be measured be analog values at the same time, that is, simultaneous sampling be performed. By accelerating A / D conversion operation and obtaining multiple analog inputs at the same time,
A more accurate current value can be obtained, which in turn can improve the accuracy of motor drive control. On the other hand, the detection frequency of the ambient temperature and the temperature of the motor may be low, and the timing may be independent of the drive timing of the motor.

【0005】入力するアナログ値によって必要な分解能
が異なる場合が多い。例えば、上記のモータ駆動電流は
10ビット分解能が必要であるが、雰囲気温度などは8
ビット分解能でも十分である場合が多い。上記のA/D
変換回路内蔵のシングルチップマイクロコンピュータの
例では、変換結果が上位詰めになっているため、8ビッ
ト分解能を得る場合には上位バイトのみを読み出せばよ
い。10ビット分解能が必要な場合には2バイトをリー
ドすればよい。しかしながら、10ビットのA/D変換
の結果を、他の例えば10ビットのデータと処理する場
合には、いずれかを6ビットシフトしなければならな
い。このようなデータビットのシフトの処理をソフトウ
ェアにより行うようにすると、その負担はかならずしも
無視できるものではない。
The required resolution is often different depending on the input analog value. For example, the motor drive current described above requires 10-bit resolution, but the ambient temperature is 8
Bit resolution is often sufficient. A / D above
In the example of the single-chip microcomputer having the built-in conversion circuit, the conversion result is in the upper order, so that only the upper byte needs to be read in order to obtain 8-bit resolution. If 10-bit resolution is required, 2 bytes may be read. However, when processing the result of 10-bit A / D conversion with other data of 10 bits, for example, either of them must be shifted by 6 bits. If such data bit shift processing is performed by software, the burden is not always negligible.

【0006】A/D変換動作の起動要因として、ソフト
ウェアによる起動、及び外部トリガ端子による起動を選
択できるようにする事が便利である。また、汎用性を持
たせるためには、タイマのコンペアマッチでも起動する
ことが便利となる。例えば、タイマのコンペアマッチに
よる波形出力によって、モータを制御する場合には、か
かるコンペアマッチを利用して同時にモータの駆動電流
をモニタするような場合に有効となる。変換モードとし
ては、1回だけの変換を行うモードと繰り返して変換を
行うモード、あるいは1チャンネルの変換を行うモード
と、複数のチャンネルを連続して変換するモードなどが
考えられる。
It is convenient to be able to select activation by software or activation by an external trigger terminal as the activation factor of the A / D conversion operation. Also, in order to have versatility, it becomes convenient to start even with a timer compare match. For example, when the motor is controlled by the waveform output by the compare match of the timer, it is effective when the drive current of the motor is simultaneously monitored by using the compare match. The conversion mode may be a mode in which conversion is performed only once, a mode in which conversion is repeated, a mode in which conversion is performed in one channel, or a mode in which a plurality of channels are continuously converted.

【0007】かかる複数からなる入力チャンネル、起動
要因、及び変換モードを有する場合、マイクロコンピュ
ータを用いたシステムにおていは、これらの入力チャン
ネル、起動要因及び変換モードが相互に関連しているこ
とになる。例えば、上記のモータの例では、モータ駆動
電流を電圧変換した値を入力するチャンネル値は、タイ
マのコンペアマッチで起動され、複数の各チャンネルに
供給される入力アナログ信号がA/D変換される。1本
の駆動電流を変換して判定しても、その他の起動要因で
変換しても都合が悪い。一方、雰囲気温度やモータの温
度などを入力するチャンネルは、モータの駆動タイミン
グとは独立したタイミングで、例えばソフトウェアによ
ってそれぞれ独立して入力アナログ信号のA/D変換が
される。
In the case of having a plurality of input channels, activation factors, and conversion modes, in a system using a microcomputer, these input channels, activation factors, and conversion modes are related to each other. Become. For example, in the above-mentioned example of the motor, the channel value to which the value obtained by converting the motor drive current into the voltage is input is activated by the compare match of the timer, and the input analog signals supplied to each of the plurality of channels are A / D converted. . It is inconvenient to convert a single drive current for determination or to convert it with another activation factor. On the other hand, the channels for inputting the ambient temperature, the temperature of the motor, and the like are subjected to A / D conversion of the input analog signal independently by, for example, software at a timing independent of the driving timing of the motor.

【0008】更に、A/D変換終了時点で割り込みを発
生し、いわゆるデータトランスファコントローラDTC
によって、変換結果をメモリ(Random Access Memory;
RAM)に転送することができる。しかしながら、いわ
ゆるスキャンモードにおいて複数のチャンネルのA/D
変換を繰り返して行う場合、指定した全てのチャンネル
の変換が終了すると、A/D変換終了割り込みが発生し
て、上記DTCが起動される。一方、A/D変換回路は
再び第1チャンネルから変換を開始する。上記DTCが
起動されてから、実際のデータ転送が行われるまでの時
間は、そのほかの動作条件などによって変動するが、前
記のシングルチップマイクロコンピュータの例ではデー
タ転送に35ステートを必要としてしまう。前記のシン
グルチップマイクロコンピュータにおけるA/D変換回
路の1チャンネル当たりのA/D変換時間は135ステ
ートであるが、シングルチップマイクロコンピュータの
データ転送時間を35ステートのままで、A/D変換時
間をシングルチップマイクロコンピュータのデータ転送
時間より高速化(35ステートより高速化)しようすと
ると、上記DTCによる変換結果の読み出し以前に次の
変換動作が終了してしまうことがあり得る。例えば、複
数チャンネルの第1チャンネルは2回目の変換結果、そ
のほかは1回目の変換結果となってしまい、第1チャン
ネルの1回目の変換結果が失われてしまうことがあり得
る。
Further, an interrupt is generated at the end of the A / D conversion, so-called data transfer controller DTC.
The conversion result is a memory (Random Access Memory;
RAM). However, in so-called scan mode, A / D of multiple channels
When the conversion is repeated, when the conversion of all the designated channels is completed, an A / D conversion end interrupt is generated and the DTC is activated. On the other hand, the A / D conversion circuit starts conversion from the first channel again. The time from the activation of the DTC to the actual data transfer varies depending on other operating conditions, but in the example of the single chip microcomputer described above, 35 states are required for data transfer. Although the A / D conversion time per channel of the A / D conversion circuit in the single chip microcomputer is 135 states, the data transfer time of the single chip microcomputer remains 35 states and the A / D conversion time is If the data transfer time of the single-chip microcomputer is made faster (more than 35 states), the next conversion operation may end before the conversion result is read by the DTC. For example, the first conversion result of the plurality of channels may be the second conversion result and the other conversion results may be the first conversion result, and the first conversion result of the first channel may be lost.

【0009】また、前記高速のA/D変換回路は、シン
グルチップマイクロコンピュータに内蔵させることに考
慮されていない。それは単一のアドレス入力を連続かつ
高速に変換することが目的であって、この連続かつ高速
に変換するアナログ入力が複数あっても、多数の異なる
アナログ入力の判定を行うことは考慮されていない。ま
た、連続かつ高速なA/D変換が必要でない応用分野に
おいては、サンプリング回路を複数もっていても、これ
が有効に利用されなくなる。シングルチップのマイクロ
コンピュータなどのアナログ入力としては、アナログ入
力毎に、必要な分解能が異なったり、連続変換が必要な
ものがあったり、単一の変換でよくて、パイプライン動
作に意味がなくなったり、高速化ができないばかりか、
サンプルホールド回路などが無駄になる場合があった
り、複数のアナログ入力の相対値が重要であったりする
場合等種々である。
The high-speed A / D conversion circuit is not considered to be built in a single-chip microcomputer. Its purpose is to convert a single address input continuously and at high speed, and even if there are multiple analog inputs that convert continuously and at high speed, it is not considered to judge many different analog inputs. . Further, in an application field where continuous and high-speed A / D conversion is not required, even if there are a plurality of sampling circuits, this cannot be effectively used. For analog inputs such as single-chip microcomputers, the required resolution differs for each analog input, there are some that require continuous conversion, or only a single conversion is necessary and the pipeline operation becomes meaningless. , Not only can not speed up,
There are various cases such as when the sample and hold circuit is wasted and when the relative values of a plurality of analog inputs are important.

【0010】A/D変換回路による変換結果は、CPU
がこれを処理しなければならず、変換結果の一時退避用
にデータ転送値による変換結果のリードなどを行う。こ
れらのCPUがDTCの動作状態によっては、常に変換
結果のリードや処理が可能とは限らない。CPUがA/
D変換回路の変換結果をリードする場合、前記のシング
ルチップマイクロコンピュータでは命令実行に6ステー
トを必要とし、A/D変換回路の変換動作を高速化する
と、CPUのリード動作と同等時間になってしまい、C
PUがそのほかの処理を行うことができなくなってしま
う。この後、リード結果に基づいて所望のデータ処理を
行う。シングルチップのマイクロコンピュータの全体的
な高速化のためには、これらのリードや処理に必要な負
担を軽減することが必要となる。また、半導体集積回路
装置に内蔵されるA/D変換回路としては、消費電流が
小さいことが望ましい。
The conversion result by the A / D conversion circuit is the CPU
Must process this and read the conversion result by the data transfer value for temporary saving of the conversion result. Depending on the operating state of the DTC, these CPUs may not always be able to read or process the conversion result. CPU is A /
When reading the conversion result of the D conversion circuit, the single chip microcomputer requires 6 states for instruction execution, and if the conversion operation of the A / D conversion circuit is speeded up, it takes the same time as the read operation of the CPU. Ended up, C
The PU cannot perform any other processing. After that, desired data processing is performed based on the read result. In order to increase the overall speed of the single-chip microcomputer, it is necessary to reduce the load required for these leads and processing. Further, it is desirable that the A / D conversion circuit built in the semiconductor integrated circuit device has low current consumption.

【0011】この発明の目的は、簡単な構成で多用途に
適したA/D変換器を内蔵した半導体集積回路装置と制
御システムを提供することにある。この発明の前記なら
びにそのほかの目的と新規な特徴は、本明細書の記述お
よび添付図面から明らかになるであろう。
An object of the present invention is to provide a semiconductor integrated circuit device and a control system having a built-in A / D converter which has a simple structure and is suitable for various purposes. The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

【0012】[0012]

【課題を解決するための手段】本願において開示される
発明のうち代表的なものの概要を簡単に説明すれば、下
記の通りである。すなわち、A/D変換器を内蔵した半
導体集積回路装置において、A/D変換器に変換結果を
格納させる複数のデータレジスタを設け、かかる複数の
データレジスタには、A/D変換結果が第1のデータレ
ジスタに格納されるときに、かかる第1のデータレジス
タの保持データが第2のデータレジスタに転送された後
に上記A/D変換結果を取り込む動作モードを設ける。
あるいは第1のA/D変換結果を第1のデータレジスタ
に格納し、第2のA/D変換結果を第2のデータレジス
タに格納する動作モードを設ける。上記動作モードによ
りデータレジスタがA/D変換結果により飽和したとき
にはA/D変換器の動作を停止させる。そして、上記動
作ードにおいてデータレジスタの読み出しが終了したと
きに、上記A/D変換器の動作を再開させる。
The outline of a typical one of the inventions disclosed in the present application will be briefly described as follows. That is, in a semiconductor integrated circuit device having a built-in A / D converter, a plurality of data registers for storing the conversion result in the A / D converter are provided, and the plurality of data registers store the A / D conversion result as the first data register. An operation mode for fetching the A / D conversion result after the data held in the first data register is transferred to the second data register when the data is stored in the first data register is provided.
Alternatively, an operation mode is provided in which the first A / D conversion result is stored in the first data register and the second A / D conversion result is stored in the second data register. When the data register is saturated by the A / D conversion result in the above operation mode, the operation of the A / D converter is stopped. Then, when the reading of the data register is completed in the operation mode, the operation of the A / D converter is restarted.

【0013】[0013]

【作用】上記した手段によれば、連続して入力された変
換結果を逐一中央処理装置やデータ転送装置が取り出す
ことがなく、これらを一括して処理できるので実質的な
処理能力の向上が可能となり、しかもそれら相互の関係
を保持させて処理できる。また、これらのデータ処理に
合わせてA/D変換動作を行わせるようにすることがで
きる。
According to the above-mentioned means, the conversion results continuously input can be collectively processed without being taken out by the central processing unit or the data transfer unit one by one, so that the substantial processing capability can be improved. Therefore, the processing can be performed while maintaining the mutual relationship. Further, the A / D conversion operation can be performed in accordance with the data processing.

【0014】[0014]

【実施例】図1には、この発明が適用されたシングルチ
ップのマイクロコンピュータの一実施例のブロック図が
示されている。同図の各回路ブロックは、公知の半導体
集積回路の製造技術により、単結晶シリコンのような1
個の半導体基板上において形成される。
1 is a block diagram showing an embodiment of a single-chip microcomputer to which the present invention is applied. Each circuit block shown in FIG. 1 is made of single crystal silicon by a known semiconductor integrated circuit manufacturing technique.
It is formed on each semiconductor substrate.

【0015】この実施例のシングルチップのマイクロコ
ンピュータは、中央処理装置CPU、クロック発生回路
CPG、データトランスファコントローラ(データ転送
装置)DTC、割り込みコントローラINT、プログラ
ム等が格納されたリード・オンリー・メモリROM、一
時記憶等に用いられるランダム・アクセス・メモリRA
M、タイマAとタイマB(ITU)、シリアルコミュニ
ケーションインターフェイスSCI、A/D変換器、第
1ないし第9からなる入出力ポートIOP1〜IOP9
の各機能ブロック又は機能モジュールから構成される。
かかる機能ブロック又は機能モジュールは、内部バスに
よって相互に接続される。内部バスは、アドレスバス、
データバスの他、リード信号、ライト信号を伝達するた
めの制御バスを含み、さらにバスサイズ信号(WORD) あ
るいはシステムクロックなどを含んでよい。上記機能ブ
ロック又は機能モジュールは、内部バスを介して中央処
理装置CPU又はデータトランスファコントローラDT
Cによってリード/ライトされる。特に制限されない
が、内部バスのバス幅は16ビットから構成される。
The single-chip microcomputer of this embodiment includes a central processing unit CPU, a clock generation circuit CPG, a data transfer controller (data transfer device) DTC, an interrupt controller INT, a read-only memory ROM storing programs and the like. Random access memory RA used for memory, temporary storage, etc.
M, timer A and timer B (ITU), serial communication interface SCI, A / D converter, and input / output ports IOP1 to IOP9 including first to ninth
It is composed of each functional block or functional module of.
Such functional blocks or functional modules are interconnected by an internal bus. The internal bus is the address bus,
In addition to the data bus, it includes a control bus for transmitting a read signal and a write signal, and may further include a bus size signal (WORD) or a system clock. The above-mentioned functional block or functional module is provided with a central processing unit CPU or a data transfer controller DT via an internal bus.
Read / write by C. Although not particularly limited, the bus width of the internal bus consists of 16 bits.

【0016】この実施例のシングルチップのマイクロコ
ンピュータは、電源端子として接地電位Vss、電源電圧
Vcc、アナログ接地電位AVss、アナログ電源電圧AV
cc、アナログ基準電圧Vref 、その他専用制御端子とし
てリセットRES、スタイバイSTBY、モード制御M
D0,MD1、クロック入力EXTAL、XTAL等が
設けられる。
In the single-chip microcomputer of this embodiment, the ground potential Vss, power supply voltage Vcc, analog ground potential AVss, and analog power supply voltage AV are used as power supply terminals.
cc, analog reference voltage Vref, other dedicated control terminals such as reset RES, styby STBY, mode control M
D0, MD1, clock inputs EXTAL, XTAL, etc. are provided.

【0017】各入出力ポートは、アドレスバス、データ
バス、バス制御信号あるいはタイマ、シリアルコミュニ
ケーションインターフェイスSCI、A/D変換器の入
出力端子と兼用される。すなわち、タイマ、シリアルコ
ミュニケーションインターフェイスSCI、A/D変換
器は、それぞれ入出力信号を有し、入出力ポートと兼用
された端子を介して外部と入出力されるものである。例
えば第5ポートIOP5、第6ポートIOP6、第7ポ
ートIOP7は、タイマAとBの入出力端子(タイマB
の出力信号はU,V,WとU#,V#,W#を含み、入
力信号はTCLKA、TCLKBを含む。)と兼用、第
8ポートIOP8は、シリアルコミュニケーションイン
ターフェイスSCIの入出力端子と兼用されている。ア
ナログデータの入力AIN0〜AIN7の端子は、第9
ポートIOP9と兼用されている。外部トリガ信号AD
TRGとビジー信号BUSYは、上記第8ポートIOP
8と兼用されている。
Each input / output port is also used as an input / output terminal of an address bus, a data bus, a bus control signal or a timer, a serial communication interface SCI, and an A / D converter. That is, the timer, the serial communication interface SCI, and the A / D converter each have an input / output signal and are input / output to / from the outside through a terminal which is also used as an input / output port. For example, the fifth port IOP5, the sixth port IOP6, and the seventh port IOP7 are input / output terminals of the timers A and B (timer B
Output signals include U, V, W and U #, V #, W #, and input signals include TCLKA, TCLKB. ), And the eighth port IOP8 is also used as an input / output terminal of the serial communication interface SCI. The terminals of analog data input AIN0 to AIN7 are
It is also used as port IOP9. External trigger signal AD
TRG and busy signal BUSY are the 8th port IOP
It is also used as 8.

【0018】タイマA及びタイマBのコンペアマッチ信
号、オーバーフロー信号、アンダーフロー信号は、A/
D変換開始トリガとしてA/D変換器に与えられる。割
り込み信号は、A/D変換器、タイマA、タイマB及び
シリアルコミュニケーションインターフェイスSCIが
出力し、割り込みコントローラINTがこれを受けて、
所定のレジスタなどの指定に基づいて、中央処理装置C
PUに割込要求信号を与えるか、データトランスファコ
ントローラDTCに起動要求信号を与えるかを制御す
る。かかる切り換えは、DTEビットによって行われ
る。つまり、DTEビットが“1”にセットされている
状態で割込要因が発生すると、データトランスファコン
トローラDTCに対する起動要求信号が発生され、その
データ転送が行われると自動的に割込要求がクリアされ
る。一方、DTEビットが“0”にクリアされている状
態で割込要因が発生すると、中央処理装置CPUに対す
る起動要求信号が発生され、中央処理装置CPUが所望
のデータ処理を行い、所望のデータ処理後割込要因を示
すビットをクリアする。
The compare match signal, overflow signal and underflow signal of timer A and timer B are A /
It is given to the A / D converter as a D conversion start trigger. The interrupt signal is output from the A / D converter, timer A, timer B, and serial communication interface SCI, and the interrupt controller INT receives it,
Based on the designation of a predetermined register or the like, the central processing unit C
It controls whether an interrupt request signal is given to the PU or a start request signal is given to the data transfer controller DTC. Such switching is performed by the DTE bit. That is, when an interrupt factor occurs while the DTE bit is set to "1", a start request signal to the data transfer controller DTC is generated, and when the data transfer is performed, the interrupt request is automatically cleared. It On the other hand, when an interrupt factor occurs while the DTE bit is cleared to "0", a start request signal to the central processing unit CPU is generated, the central processing unit CPU performs desired data processing, and desired data processing. Clear the bit indicating the post interrupt factor.

【0019】データトランスファコントローラDTCに
よるデータ転送時に、所定の条件が成立すると、例えば
転送カウンタが0になったりすると、割込要因を示すビ
ットをクリアせずに、対応するDTEビットを“0”に
クリアして、中央処理装置CPUに割込要求を発生する
ようにする。各割込要因には、独立したDTEビットと
独立したベクタが割り当てられている。
When a predetermined condition is satisfied during data transfer by the data transfer controller DTC, for example, when the transfer counter becomes 0, the corresponding DTE bit is set to "0" without clearing the bit indicating the interrupt factor. It is cleared to generate an interrupt request to the central processing unit CPU. An independent DTE bit and an independent vector are assigned to each interrupt factor.

【0020】データ転送装置としては、上記のようなデ
ータトランスファコントローラDTCのほかに、直接メ
モリアクセス制御装置DMACのようなものを用いるも
のであってもよい。上記のようなデータトランスファコ
ントローラDTCの例としては、昭和63年12月
(株)日立製作所発行「H8/532 ハードウェアマ
ニュアル」などに記載されているものを利用できる。直
接メモリアクセス制御装置DMACの例としては、平成
5年3月(株)日立製作所発行「H8/3003ハード
ウェアマニュアル」などに記載されているものを利用で
きる。
As the data transfer device, in addition to the data transfer controller DTC as described above, a device such as a direct memory access control device DMAC may be used. As an example of the data transfer controller DTC as described above, one described in "H8 / 532 Hardware Manual" issued by Hitachi, Ltd. in December 1988 can be used. As an example of the direct memory access control device DMAC, one described in "H8 / 3003 Hardware Manual" issued by Hitachi, Ltd. in March 1993 can be used.

【0021】これらのデータ転送装置(DTC/DMA
C)は、「H8/3003 ハードウェアマニュアル」
又は特願平4−137954号に記載されているよう
に、1回の起動によって、複数単位のデータを転送する
こと、いわゆるブロック転送モードが可能とされる。こ
れらは、ソースアドレスレジスタSAR、ディスティネ
ーションアドレスレジスタDAR、ブロックサイズカウ
ンタTCRH、ブロックサイズ保持レジスタTCRL、
ブロック転送カウンタBTCRを持ち、ブロック単位で
のデータ転送を行うことができるようにされる。
These data transfer devices (DTC / DMA
C) is "H8 / 3003 Hardware Manual"
Alternatively, as described in Japanese Patent Application No. 4-137954, it is possible to transfer a plurality of units of data by one activation, that is, a so-called block transfer mode. These are a source address register SAR, a destination address register DAR, a block size counter TCRH, a block size holding register TCRL,
It has a block transfer counter BTCR so that data can be transferred in block units.

【0022】タイマB(ITU;Integrated Timer Uni
t)は、タイマカウンタ、コンペアレジスタ(GRA〜G
RD)を有し、タイマカウンタ0〜GRA(レジスタG
RAの設定値)でアップ/ダウンカウントを行う。ダウ
ンカウントにより計数値が0になっとときアンダーフロ
ー信号を発生し、アップカウントにより上記GRAの設
定値に一致したとき、コンペアマッチAを発生する。ま
た、この途中でコンペアレジスタGRB〜GRDに設定
された値と一致したとき、タイマ出力を変化させる。タ
イマ出力はそれぞれ正相/逆相の出力を有する。これに
よって、例えば相補3相のPWM(パルス幅変調)出力
を形成することができる。かかる相補3相のPWM出力
は、上記「H8/3003 ハードウェアマニュアル」
pp.374〜381等に記載されている。上記正相/
逆相の出力間にノンオーバーラップ時間を設定するよう
なカウンタを追加してもよい。
Timer B (ITU; Integrated Timer Uni)
t) is a timer counter and a compare register (GRA to G
RD) and has timer counters 0 to GRA (register G
Up / down counting is performed with the set value of RA). An underflow signal is generated when the count value becomes 0 by the down count, and a compare match A is generated when the count value matches the set value of the GRA. Further, when the values match the values set in the compare registers GRB to GRD during this, the timer output is changed. Each timer output has a positive phase / negative phase output. Thereby, for example, complementary three-phase PWM (pulse width modulation) outputs can be formed. The complementary 3-phase PWM output is described in the above "H8 / 3003 Hardware Manual".
pp. 374-381, etc. Normal phase /
A counter for setting a non-overlap time between outputs of opposite phases may be added.

【0023】図2には、この発明が適用されたシングル
チップマイクロコンピュータに搭載されるA/D変換器
の一実施例のブロック図が示されている。A/D変換器
は、コントロールロジック、バスインターフェイス、制
御レジスタADCSR、ADCR、データレジスタAD
DRA〜ADDRH、2ビット分圧、6ビット分圧及び
2ビット分圧を行う抵抗分圧回路(D/A変換)、アナ
ログマルチプレクサ、サンプルホールド・レベルシフト
回路A,B、コンパレータアレイ(差動増幅器)A,
B、逐次比較レジスタから構成される。
FIG. 2 is a block diagram showing an embodiment of an A / D converter mounted on a single chip microcomputer to which the present invention is applied. The A / D converter includes a control logic, a bus interface, a control register ADCSR, ADCR, a data register AD.
DRA to ADDRH, resistance voltage dividing circuit (D / A conversion) for performing 2-bit voltage dividing, 6-bit voltage dividing and 2-bit voltage dividing, analog multiplexer, sample hold / level shift circuits A and B, comparator array (differential amplifier) ) A,
B, a successive approximation register.

【0024】シングルチップマイクロコンピュータの外
部からの入力としては、電源(Vcc、Vss、AVcc、A
Vss、Vref )、アナログ入力AIN0〜AIN7、外
部トリガ信号ADTRGがA/D変換器に供給される。
シングルチップマイクロコンピュータの内部信号として
は、タイマAとBからの起動信号、アドレスバスからの
アドレス信号、リード信号、ライト信号、バスサイズ信
号、要因クリア信号が与えられ、バスインターフェイス
を介して内部データバスとの間でデータの入出力が行わ
れる。また、割込信号ADIを出力する。かかる割込信
号ADIは、割り込みコントローラINTに与えられ
て、上記データトランスファコントローラDTCの起動
信号又は中央処理装置CPUの割込要求とされる。
Inputs from the outside of the single chip microcomputer include power supplies (Vcc, Vss, AVcc, A
Vss, Vref), analog inputs AIN0 to AIN7, and an external trigger signal ADTRG are supplied to the A / D converter.
As the internal signals of the single-chip microcomputer, a start signal from the timers A and B, an address signal from the address bus, a read signal, a write signal, a bus size signal, and a factor clear signal are given, and internal data is sent via the bus interface. Data is input to and output from the bus. It also outputs an interrupt signal ADI. The interrupt signal ADI is given to the interrupt controller INT and used as an activation signal of the data transfer controller DTC or an interrupt request of the central processing unit CPU.

【0025】コントロールロジックは、中央処理装置C
PUから与えられるアドレスバスからのアドレス信号、
リード信号、ライト信号に基づいて、内部データバスと
の間でバスインターフェイスを介して制御レジスタAD
CSR、ADCR、データレジスタADDRA〜ADD
RHとの間でデータの入出力を行う。コントロールロジ
ックには、外部トリガ信号ADTRG及びタイマA,B
からの起動信号が入力される。コントロールロジック
は、上記制御レジスタADCSR、ADCRの内容に基
づいて、アナログ入力動作制御を行う。そして、コント
ロールロジックは、上記割込信号ADIを出力する。
The control logic is the central processing unit C.
Address signal from the address bus given from PU,
The control register AD is connected to the internal data bus via the bus interface based on the read signal and the write signal.
CSR, ADCR, data registers ADDRA to ADD
Input and output of data with RH. The control logic includes an external trigger signal ADTRG and timers A and B.
The start signal from is input. The control logic controls the analog input operation based on the contents of the control registers ADCSR and ADCR. Then, the control logic outputs the interrupt signal ADI.

【0026】制御レジスタADCSR、ADCRは、中
央処理装置CPUから内部データバス、バスインターフ
ェイスを介してリード/ライトが行われ、コントロール
ロジックの動作を指示し、上記アナログ入力の状態を表
示する。つまり、制御レジスタADCSR、ADCRに
格納されたデータは、アナログ入力端子(以下、入力チ
ャンネルという)の選択やA/D変化器の変換モードの
選択等を示す。A/D変換モードには、後述するように
1チャンネルの変換を行うセレクトモードと、複数チャ
ンネルの変換を行うグループモードがあり、これに加え
て1回の変換を行うシングルモードと繰り返して変換を
行うスキャンモードがある。
The control registers ADCSR and ADCR are read / written from the central processing unit CPU via the internal data bus and the bus interface to instruct the operation of the control logic and display the state of the analog input. That is, the data stored in the control registers ADCSR and ADCR indicate the selection of the analog input terminal (hereinafter referred to as the input channel), the selection of the conversion mode of the A / D converter, and the like. The A / D conversion mode includes a select mode for converting one channel and a group mode for converting a plurality of channels, as will be described later. In addition to this, a single mode for performing one conversion is repeatedly performed for conversion. There is a scan mode to do.

【0027】制御レジスタADCSRは、A/Dコント
ロール/スタータスレジスタであり、8ビットのリード
R又はライトWが可能なレジスタであり、A/D変換の
動作制御とステータスの表示を行う。このレジスタAD
CRSはリセット時にH’00にイニシャライズ(初期
値)にされ、そのビット構成を次の表1に示す。
The control register ADCSR is an A / D control / status register, which is a register capable of 8-bit read R or write W, and performs A / D conversion operation control and status display. This register AD
The CRS is initialized to H'00 (initial value) at reset, and its bit configuration is shown in Table 1 below.

【0028】[0028]

【表1】 [Table 1]

【0029】ビット7のADFは、A/D変換の終了を
示すスタータスフラグであり、クリア条件は、ADF=
“1”の状態で、ADFフラグをリードした後にADF
フラグに“0”をライトするとき、あるいは割り込み信
号ADIによる割り込みに従ってデータ転送装置DTC
又はDMACが起動されたときである。セット条件は、
シングルモードのときに、指定した全てのチャンネルの
A/D変換を終了し、A/D変換が終了したときと、ス
キャンモードのときに、指定した全てのチャンネルを一
巡して変換したときである。
ADF of bit 7 is a status flag indicating the end of A / D conversion, and the clear condition is ADF =
After reading the ADF flag in the state of "1", the ADF is
When writing "0" to the flag or in response to an interrupt by the interrupt signal ADI, the data transfer device DTC
Or when the DMAC is activated. The set condition is
In the single mode, the A / D conversion of all the specified channels is completed, and the A / D conversion is completed, and in the scan mode, all the specified channels are converted in one cycle. .

【0030】ビット6のADIEは、A/D変換の終了
による割り込み(ADI)要求の許可又は禁止を選択す
る。ADIE=“0”ならA/D変換の終了による割り
込み(ADI)要求を禁止し、ADIE=“1”ならA
/D変換の終了による割り込み(ADI)要求を許可す
る。
The bit 6 ADIE selects enable or disable of an interrupt (ADI) request due to the end of A / D conversion. If ADIE = "0", the interrupt (ADI) request due to the end of A / D conversion is prohibited, and if ADIE = "1", A
Enable the interrupt (ADI) request due to the completion of / D conversion.

【0031】ビット5のADSTは、A/D変換の開始
又は停止を選択する。A/D変換中は“1”を保持す
る。ADSTは、A/D外部トリガ入力端子から供給さ
れる外部トリガ信号ADTRG、又はタイマのトリガ信
号によって“1”にセットされる。ADST=“0”の
ときはA/D変換を停止し、ADST=“1”のときシ
ングルモードならA/D変換を開始し、指定したチャン
ネルの変換が終了すると自動的に“0”にクリアされ
る。ADST=“1”のときスキャンモードならA/D
変換を開始し、ソフトウェアにより“0”にクリアされ
まで連続変換を行う。
ADST of bit 5 selects start or stop of A / D conversion. Holds "1" during A / D conversion. ADST is set to "1" by the external trigger signal ADTRG supplied from the A / D external trigger input terminal or the trigger signal of the timer. When ADST = "0", A / D conversion is stopped. When ADST = "1", A / D conversion is started in single mode, and when conversion of the specified channel is completed, it is automatically cleared to "0". To be done. A / D in scan mode when ADST = "1"
Start conversion and continue conversion until it is cleared to "0" by software.

【0032】ビット4のCKSは、クロック発生回路C
PGから発生されるクロック信号(φあるいはφ/2)
の周期を選択するためのクロックセレクト信号であり、
A/D変換時間の設定を行う。変換時間の切り替えは変
換停止中に行われる。CKS=“0”のときには変換時
間が20ステート(基準クロックφを選択)となり、C
KS=“1”のときには変換時間が40ステート(基準
クロックφ/2を選択)となる。
CKS of bit 4 is a clock generation circuit C
Clock signal generated from PG (φ or φ / 2)
Is a clock select signal for selecting the cycle of
Set the A / D conversion time. The conversion time is switched while the conversion is stopped. When CKS = “0”, the conversion time becomes 20 states (select the reference clock φ), and C
When KS = “1”, the conversion time is 40 states (reference clock φ / 2 is selected).

【0033】ビット3のGRPはグループモード信号で
あり、A/D変換チャンネルの選択をセレクトモード又
はグループモードに指定する。このGRPビットの設定
は、A/D変換停止中に行われる。GRP=“0”のと
きにはセレクトモードとされ、GRP=“1”のときに
はグループモードとされる。
GRP of bit 3 is a group mode signal and specifies the selection of the A / D conversion channel to the select mode or the group mode. The setting of the GRP bit is performed while the A / D conversion is stopped. When GRP = "0", the select mode is set, and when GRP = "1", the group mode is set.

【0034】ビット2〜0はチャンネルセレクト信号で
あり、上記GRPビットとともにアナログ入力チャンネ
ルを選択する。入力チャンネルの設定は、A/D変換停
止中に行われる。GRP=“0”のときにはセレクトモ
ードのときには上記3ビットCH2〜CH0の組み合わ
せによりAIN0〜AIN7のいずれか1つが選ばれ
る。GRP=“1”であり、グループモードのときには
上記3ビットCH2〜CH0がH’000ときにAIN
0のみが選択され、それ以外は上記AIN0とビットC
H1とCH2の組み合わせによりAIN1〜AIN7が
上記AIN0と同時に選ばれる。
Bits 2 to 0 are channel select signals and select an analog input channel together with the GRP bit. The setting of the input channel is performed while the A / D conversion is stopped. When GRP = "0", in the select mode, any one of AIN0 to AIN7 is selected by the combination of the above 3 bits CH2 to CH0. When GRP = "1" and the group mode is 3 bits CH2 to CH0 are H'000, AIN is set.
Only 0 is selected, otherwise AIN0 and bit C above
AIN1 to AIN7 are selected at the same time as AIN0 depending on the combination of H1 and CH2.

【0035】制御レジスタADCRは、A/Dコントロ
ールレジスタであり、8ビットのリードR又はライトW
が可能なレジスタであり、A/D変換の動作制御を行
う。このレジスタADCRはリセット時にH’00にイ
ニシャライズ(初期値)にされ、そのビット構成を次の
表2に示す。
The control register ADCR is an A / D control register and is an 8-bit read R or write W.
Is a register capable of performing A / D conversion operation control. This register ADCR is initialized to H'00 (initial value) at reset, and its bit configuration is shown in Table 2 below.

【0036】[0036]

【表2】 [Table 2]

【0037】ビット7のINFは、インターバルビット
であり、インターバル動作を指定する。インターバル動
作では、BUSY信号が活性状態のとき、新しいA/D
変換動作を開始しない。ADFフラグを“0”にクリア
することにより、BUSY信号を活性状態にして、新し
いA/D変換動作を開始させることができる。INF=
“0”は通常動作であり、INF=“1”が上記インタ
ーバル動作である。
INF of bit 7 is an interval bit and specifies an interval operation. In interval operation, when the BUSY signal is active, a new A / D
Do not start conversion operation. By clearing the ADF flag to "0", the BUSY signal can be activated and a new A / D conversion operation can be started. INF =
“0” is the normal operation, and INF = “1” is the interval operation.

【0038】ビット6のPWRは、電源ビットであり、
変換開始モードを設定する。変換開始モードについて
は、後に詳細に説明するように高速変換モードと低消費
電力モードからなる。
PWR of bit 6 is a power supply bit,
Set the conversion start mode. The conversion start mode includes a high speed conversion mode and a low power consumption mode, which will be described in detail later.

【0039】ビット5〜4のTRGS1,TRGS0
は、タイマトリガセレクトビットであり、トリガ信号に
よるA/D変換開始の許可又は禁止を選択する。TRG
S1,TRGS0の設定は、A/D変換停止中に設定さ
れる。上記2ビットのTRGS1,TRGS0の組み合
わせより、次の4通りが選択できる。(1)ソフトウェ
アによるA/D変換の開始のみを許可する。(2)タイ
マトリガ(タイマB)によるA/D変換の開始を許可す
る。(3)タイマトリガ(タイマA)によるA/D変換
の開始を許可する。(4)外部トリガ端子によるA/D
変換の開始を許可する。
TRGS1, TRGS0 of bits 5-4
Is a timer trigger select bit, and selects permission or prohibition of A / D conversion start by a trigger signal. TRG
The settings of S1 and TRGS0 are set while the A / D conversion is stopped. The following four ways can be selected from the combination of the 2-bit TRGS1 and TRGS0. (1) Only start A / D conversion by software is permitted. (2) Permit start of A / D conversion by timer trigger (timer B). (3) Permit start of A / D conversion by timer trigger (timer A). (4) A / D by external trigger terminal
Allow conversion to start.

【0040】ビット3のSCANは、スキャンモードで
あり、A/D変換の動作モードをシングルモード又はス
キャンモードの選択を行う。シングルモードとスキャン
モードの詳細については後に説明する。SCAN=
“0”ならシングルモードとなり、SCAN=“1”な
らスキャンモードとなる。
The SCAN of bit 3 is in the scan mode and selects the single mode or the scan mode as the A / D conversion operation mode. Details of the single mode and the scan mode will be described later. SCAN =
If "0", the single mode is set, and if SCAN = "1," the scan mode is set.

【0041】ビット2のDSMPは、同時サンプリング
モードであり、2チャンネルの同時サンプリング動作を
許可又は禁止する。この同時サンプリング動作の詳細に
つていは後に説明する。DSMP=“0”通常サンプリ
ング動作とし、DSMP=“1”なら同時サンプリング
動作とする。
The DSMP of bit 2 is a simultaneous sampling mode and enables or prohibits the simultaneous sampling operation of two channels. The details of this simultaneous sampling operation will be described later. DSMP = “0” normal sampling operation, and DSMP = “1” simultaneous sampling operation.

【0042】ビット1と0のBUFE1,BUFE0は
バッファイネーブルであり、データレジスタADDRA
〜ADDRDをバッファレジスタとして使用するかしな
いかを選択する。このバッファ動作については後に説明
する。
BUFE1 and BUFFE0 of bits 1 and 0 are buffer enable, and data register ADDRA
~ Select whether or not to use ADDRD as a buffer register. This buffer operation will be described later.

【0043】データレジスタADDRA〜ADDRH
は、中央処理装置CPUから内部データバス及びバスイ
ンターフェイスを介してリード/ライトが可能であり、
アナログ入力データ、言い換えるならば、A/D変換結
果が格納される。特に制限されないが、これらのデータ
レジスタADDRA〜ADDRHは、それぞれが16ビ
ットからなり、後述するようにA/D変換されたデータ
が10ビットであるときには、下位8ビットが下位バイ
ト(ビット7〜0)に、上位2ビットが上位バイト(ビ
ット9と8)に転送保持される。上位バイトのビット1
5〜10は使用されないが、リードすると常に“0”が
読み出されるようにされる。この実施例では、データの
読み出しは、バイト又はワード選択ができるようにされ
る。つまり、10ビット分解能のA/D変換出力はワー
ドモードとして読み出され、8ビット分解能のA/D変
換出力はバイトモードとして上位8ビット(ビット9〜
2)が読み出されるようにされる。
Data registers ADDRA to ADDRH
Can be read / written from the central processing unit CPU via an internal data bus and a bus interface,
The analog input data, in other words, the A / D conversion result is stored. Although not particularly limited, each of these data registers ADDRA to ADDRH consists of 16 bits, and when the A / D converted data is 10 bits as described later, the lower 8 bits are the lower byte (bits 7 to 0). 2), the upper 2 bits are transferred and held in the upper byte (bits 9 and 8). Bit 1 of upper byte
Although 5 to 10 are not used, "0" is always read when read. In this embodiment, the reading of data is enabled by byte or word selection. That is, the 10-bit resolution A / D conversion output is read in the word mode, and the 8-bit resolution A / D conversion output is in the high-order 8 bits (bit 9 to 9) as the byte mode.
2) is read.

【0044】アナログマルチプレクサは、制御レジスタ
ADCSRのビット0〜2(CH0〜CH2)とGRP
とで示されているデータに基づいてコントールロジック
から出力された選択信号に従いアナログ入力AIN0〜
AIN7を選択し、それに対応したアナログ信号を内部
に取り込む。このアナログマルチプレクサは、上記図1
の入出力ポートIOP9に含まれるようにしてもよい。
The analog multiplexer includes bits 0 to 2 (CH0 to CH2) of the control register ADCSR and GRP.
Analog inputs AIN0 to AIN0 according to the selection signal output from the control logic based on the data indicated by and
AIN7 is selected and an analog signal corresponding to it is taken in. This analog multiplexer is shown in FIG.
It may be included in the input / output port IOP9.

【0045】サンプルホールド・レベルシフト回路は、
コントロールロジックから出力されるサンプリング信号
に基づいて、アナログマルチプレクサで選択されたアナ
ログ入力信号をサンプリングしてホールド(蓄積)す
る。この実施例では、2個のサンプルホールド回路Aと
Bが設けられており、それぞれには独立したサンプリン
グ信号AとBが与えられる。それ故、上記サンプリング
信号AとBにより独立したタイミングでサンプリングす
ることも、同時にサンプリングすることもできるように
される。
The sample hold / level shift circuit is
Based on the sampling signal output from the control logic, the analog input signal selected by the analog multiplexer is sampled and held (accumulated). In this embodiment, two sample hold circuits A and B are provided, and independent sampling signals A and B are given to them. Therefore, the sampling signals A and B can be sampled at independent timings or simultaneously.

【0046】レベルシフト回路AとBは、レベルシフト
信号AとBにより上記ホールドされた入力信号をレベル
シフトさせる。このレベルシフト動作は、1回目のA/
D変換結果に基づいて行われる。例えば、後述するよう
に基準電圧Vref に対応したアナログ入力範囲を4等分
した電圧範囲のうち、Vref /4〜Vref /2のサブレ
ンジ領域内に上記ホールドされた入力信号をシフトさせ
る。
The level shift circuits A and B level shift the held input signal by the level shift signals A and B. This level shift operation is the first A /
It is performed based on the D conversion result. For example, as will be described later, in the voltage range obtained by dividing the analog input range corresponding to the reference voltage Vref into four equal parts, the held input signal is shifted within the subrange region of Vref / 4 to Vref / 2.

【0047】コンパレータアレイAとBは、それぞれが
5個の差動増幅回路で構成される。これらのコンパレー
タアレイAとBは、サンプルホールド回路AとBにホー
ルドされた入力信号と、局所抵抗分圧回路により形成さ
れた複数の基準電圧(5本)とを比較し、比較結果を出
力する。すなわち、2ビット分の比較を同時に行うこと
ができる。コンパレータアレイAとBのそれぞれの比較
結果は、コントロールロジックにより2進信号化されて
逐次比較レジスタに格納される。
Each of the comparator arrays A and B is composed of five differential amplifier circuits. These comparator arrays A and B compare the input signals held by the sample hold circuits A and B with a plurality of reference voltages (5 lines) formed by the local resistance voltage dividing circuit, and output the comparison result. . That is, the comparison for 2 bits can be performed at the same time. The comparison result of each of the comparator arrays A and B is converted into a binary signal by the control logic and stored in the successive approximation register.

【0048】1回目の比較では、抵抗分圧回路の上位2
ビットとの比較を行う。この比較結果に基づいてレベル
シフト信号AとBがそれぞれ形成されて、レベルシフト
回路AとBにより上記のようにサブレンジ領域内にホー
ルドされた入力信号をシフトさせる。2回目以降の変換
動作は、局所分圧回路(6ビット分圧)により1/64
の分圧電圧を形成し、そのうちの2ビット分がセレクタ
を通して選択され、この選択された分圧電圧の間を更に
2ビット分圧により分圧された電圧が上記コンパレータ
アレイA又はBに供給されることにより行われる。この
ような動作を繰り返すことにより最下位ビットまでの変
換動作が行われる。A/D変換動作の終了時に、コント
ロールロジック(逐次比較レジスタ)に保持された変換
データがデータレジスタADDRA〜ADDRHのいず
れかに転送される。
In the first comparison, the top two resistors of the resistance voltage dividing circuit are
Compare with bit. Based on the comparison result, level shift signals A and B are formed respectively, and the level shift circuits A and B shift the input signal held in the sub-range area as described above. The conversion operation after the second time is 1 / 64th by the local voltage dividing circuit (6 bits voltage dividing).
Of the two divided bits are selected through the selector, and the voltage divided by the two divided voltages between the selected divided voltages is supplied to the comparator array A or B. It is done by By repeating such an operation, the conversion operation up to the least significant bit is performed. At the end of the A / D conversion operation, the conversion data held in the control logic (successive approximation register) is transferred to any of the data registers ADDRA to ADDRH.

【0049】抵抗分圧回路(D/A変換)は、例えば1
0ビット分解能とされるときには、基準電圧Vref とア
ナログ接地電圧AVssの間を1024個の抵抗により分
圧された分圧電圧を形成することが必要とされる。この
ようにすると、抵抗数が増大してしまうので、この実施
例では上記のように上位2ビット分圧、6ビット分圧及
び下位2ビット分圧の3つの分圧回路に分けることによ
り、抵抗数を大幅に低減させている。つまり、この実施
例の分圧抵抗回路は、上位2ビット分圧回路と6ビット
と2ビットに分けられた局所分圧回路で構成される。上
位2ビット分圧回路は、Vref、3Vref /4、Vref
/2、Vref /4及び0Vを形成して、レジスタシフト
回路及びコンパレータアレイに供給する。
The resistance voltage dividing circuit (D / A conversion) is, for example, 1
When the 0-bit resolution is used, it is necessary to form a divided voltage divided by 1024 resistors between the reference voltage Vref and the analog ground voltage AVss. If this is done, the number of resistors will increase. Therefore, in this embodiment, the resistors are divided into three voltage dividing circuits of the upper 2 bit voltage division, the 6 bit voltage division and the lower 2 bit voltage division as described above. The number is greatly reduced. In other words, the voltage dividing resistor circuit of this embodiment is composed of the higher-order 2-bit voltage dividing circuit and the 6-bit and 2-bit local voltage dividing circuit. The high-order 2 bit voltage dividing circuit is Vref, 3Vref / 4, Vref
/ 2, Vref / 4 and 0V are formed and supplied to the register shift circuit and the comparator array.

【0050】6ビット局所分圧回路は、上記Vref /4
〜Vref /2の範囲を1/64に分圧してなる64通り
の分圧電圧を形成し、逐次比較レジスタの内容による指
定に基づいてセレクタが制御されて上位から順に2ビッ
ト分ずつに対応された分圧電圧を出力する。この分圧出
力は、さらに下位2ビット分圧により分圧されてコンパ
レータアレイに供給されてA/D変換動作に用いられ
る。アナログ電圧AVcc、AVssは、アナログ部(マル
チプレクサ、サンプルホールド回路、コンパレータアレ
イなど)の電源とされる。
The 6-bit local voltage dividing circuit has the above Vref / 4.
The divided voltage is divided into 1/64 to form 64 divided voltages, and the selector is controlled based on the designation by the contents of the successive approximation register to correspond to 2 bits in order from the higher order. The divided voltage is output. The divided output is further divided by the lower 2 bits to be supplied to the comparator array and used for the A / D conversion operation. The analog voltages AVcc and AVss are used as a power source for the analog section (multiplexer, sample hold circuit, comparator array, etc.).

【0051】図3には、上記A/D変換器の動作を説明
するための基本的タイミング図が示されている。この実
施例のA/D変換器は、制御レジスタADCSRのビッ
ト4(CKS)に格納されているデータに従って、クロ
ック発生回路CPGが出力するφとφ/2の選択された
一方の内部のクロック信号CLKに同期して動作する。
クロック信号CLKのT1〜T10の期間では、サンプ
リング信号がハイレベルとなってアナログマルチプレク
サにより選択されたアナログ入力信号がサンプルホール
ド回路のキャパシタに蓄積される。この蓄積された入力
信号は、コンパレータアレイに供給される。
FIG. 3 shows a basic timing chart for explaining the operation of the A / D converter. The A / D converter according to this embodiment uses one of the internal clock signals φ and φ / 2 selected by the clock generation circuit CPG according to the data stored in bit 4 (CKS) of the control register ADCSR. It operates in synchronization with CLK.
During the period of T1 to T10 of the clock signal CLK, the sampling signal becomes high level and the analog input signal selected by the analog multiplexer is stored in the capacitor of the sample hold circuit. This accumulated input signal is supplied to the comparator array.

【0052】クロック信号CLKのT10の期間に同期
してコントロールロジックから出力された上位変換信号
がハイレベルとなり、上位2ビットとの比較動作が行わ
れる。この比較結果は、クロック信号CLKの次の期間
T11に同期して出力される。上記上位2ビットの比較
結果に基づいて、クロック信号CLKの期間T12に同
期してレベルシフト信号が発生されてレベルシフト回路
に伝えられる。これにより、上記入力信号がVref /4
〜Vref /2のサブレンジ領域に入るようにレベルシフ
ト動作が行われる。また、クロック信号CLKの期間T
12から上記サブレンジ領域Vref /4〜Vref /2を
下位2ビットD/Aで抵抗分割し、これを4分割するた
めに必要な5レベル(0、1/4、1/2、3/4、
1)の基準電圧を発生させる。
The high-order conversion signal output from the control logic becomes high level in synchronization with the period T10 of the clock signal CLK, and the comparison operation with the high-order 2 bits is performed. The comparison result is output in synchronization with the next period T11 of the clock signal CLK. Based on the comparison result of the upper 2 bits, a level shift signal is generated in synchronization with the period T12 of the clock signal CLK and transmitted to the level shift circuit. As a result, the input signal becomes Vref / 4.
The level shift operation is performed so as to enter the sub-range region of -Vref / 2. In addition, the period T of the clock signal CLK
From 12 above, the subrange areas Vref / 4 to Vref / 2 are resistance-divided by the lower 2 bits D / A, and five levels (0, 1/4, 1/2, 3/4,
The reference voltage of 1) is generated.

【0053】クロック信号CLKの期間T13で下位変
換信号がハイレベルとなって、第3、第4ビットの比較
動作が行われる。この結果は、期間T13から出力され
る。この結果に基づいて、セレクト信号を変更して局所
D/Aの出力を変更して、下位2ビットD/Aの両端の
電圧を変更する。例えば、前記比較結果が5Vref /1
6〜6Vref /16の範囲であれば、5Vref /16〜
6Vref /16の電圧を下位2ビット分圧(D/A)の
両端に与え、これを4分割するために必要な5レベルの
基準電圧を生成する。クロック信号CLKの期間T15
において、下位変換信号がハイレベルとなって第5、第
6ビットの比較が行われる。この結果は、期間T15か
ら出力される。
During the period T13 of the clock signal CLK, the lower conversion signal becomes high level, and the comparison operation of the third and fourth bits is performed. This result is output from the period T13. Based on this result, the select signal is changed to change the output of the local D / A to change the voltage across the lower 2 bits D / A. For example, if the comparison result is 5 Vref / 1
In the range of 6 to 6Vref / 16, 5Vref / 16 to
A voltage of 6Vref / 16 is applied to both ends of the voltage division (D / A) of the lower 2 bits, and a 5 level reference voltage required to divide this into 4 is generated. Period T15 of clock signal CLK
In, the lower conversion signal goes high and the fifth and sixth bits are compared. This result is output from the period T15.

【0054】以上の動作が繰り返して行われ、クロック
信号CLKの期間T20ではラッチ信号がハイレベルと
なって、変換結果がデータレジスタADDRA〜ADD
RHの中の所定のレジスタに格納される。また、所定の
条件によって、変換終了フラグADFが“1”にセット
される。
The above operation is repeated, the latch signal becomes high level during the period T20 of the clock signal CLK, and the conversion result shows the data registers ADDRA to ADD.
It is stored in a predetermined register in RH. The conversion end flag ADF is set to "1" according to a predetermined condition.

【0055】図4には、上記A/D変換器のサブレンジ
の電圧変換方式を説明するための電圧分布図が示されて
いる。アナログ入力範囲は0〜Vref であるのに対し
て、上記サブレンジ領域はVref /4〜Vref /2のよ
うにアナログ入力範囲の1/4の領域とされる。このサ
ブレンジの範囲は、より分解能の高いA/D変換動作が
行われる。つまり、1回目のA/D変換結果により、例
えば入力信号AINが3Vref /4〜Vref の範囲であ
ると、レベルシフト回路によりレベルシフトして上記V
ref /4〜Vref /2の領域にシフトさせる。具体的に
は、Vref /2分(減算)させるようにレベルシフトす
る。以後、上記図3のタイミング図に示したように、こ
のサブレンジの範囲で残り8ビット分の変換を、上位か
ら順に2ビット分ずつ4回に分けて変換動作を行うもの
である。
FIG. 4 shows a voltage distribution diagram for explaining the voltage conversion system of the sub-range of the A / D converter. The analog input range is 0 to Vref, while the subrange region is a region of 1/4 of the analog input range such as Vref / 4 to Vref / 2. In the subrange, the A / D conversion operation with higher resolution is performed. That is, according to the result of the first A / D conversion, if the input signal AIN is in the range of 3Vref / 4 to Vref, the level shift circuit shifts the level to V.
Shift to the region of ref / 4 to Vref / 2. Specifically, the level is shifted so as to be Vref / 2 minutes (subtraction). After that, as shown in the timing chart of FIG. 3, the conversion operation for the remaining 8 bits in the range of this subrange is performed by dividing the conversion by 2 bits in order from the higher order four times.

【0056】図6には、上記サンプルホールド・レベル
シフト回路Aの一実施例の回路図が示されている。サン
プルホールド・レベルシフト回路Aは、Pチャンネル型
MOSFETQ1、Nチャンネル型MOSFETQ2等
のようなCMOSスイッチとキャパシタCの組み合わせ
により構成される。
FIG. 6 shows a circuit diagram of an embodiment of the sample hold / level shift circuit A. The sample-hold / level-shift circuit A is composed of a combination of a CMOS switch such as a P-channel MOSFET Q1 and an N-channel MOSFET Q2, and a capacitor C.

【0057】サンプリング動作のときには、サンプリン
グ信号Aがハイレベルとなり、上記スイッチMOSFE
TQ1とQ2がオン状態となり、入力信号Ainをキャパ
シタCの一方の電極に与える。このとき、キャパシタC
の他方の電極には、コントロールロジックから出力され
るレベルシフトAに含まれた制御信号2がハイレベルに
されることにより、Pチャンネル型MOSFETQ7と
Nチャンネル型MOSFETQ8がオン状態となりVre
f /2の電圧が供給されている。つまり、キャパシタC
に蓄積される信号電荷は、入力信号Aに対応する電圧V
inからVref /2だけ差し引いた電圧に相当するものと
される。
During the sampling operation, the sampling signal A becomes high level, and the switch MOSFE is turned on.
TQ1 and Q2 are turned on, and the input signal Ain is applied to one electrode of the capacitor C. At this time, the capacitor C
The control signal 2 included in the level shift A output from the control logic is set to the high level on the other electrode of the P-channel type MOSFET Q7 and the N-channel type MOSFET Q8 to be turned on.
The voltage of f / 2 is supplied. That is, the capacitor C
The signal charge stored in the
It is assumed to correspond to a voltage obtained by subtracting Vref / 2 from in.

【0058】上位・下位変換信号がハイレベルに活性化
されると、Pチャンネル型MOSFETQ3とNチャン
ネル型MOSFETQ4がオン状態となり、上記入力電
圧Vinがサンプルホールド・レベルシフト回路出力とし
て前記コンパレータアレイに伝えられて上位2ビットの
分圧電圧(D/A出力)であるVref /4、3Vref/
4、Vref /2、Vref /4、0V(AVss) との比較
が行われる。この比較結果により、例えば図4のように
Vref >Vin(AIN)>3Vref /4なら、制御信号
2が非活性化のロウレベルにされ、制御信号0がハイレ
ベルに活性化されてスイッチMOSFETQ11とQ1
2がオン状態となり、キャパシタCには0V(AVss)
が与えられる。これにより、上記入力信号Vinは−Vre
f /2だけレベルシフトされ、上記サブレンジ領域にな
るようにされる。
When the upper / lower conversion signal is activated to a high level, the P-channel type MOSFET Q3 and the N-channel type MOSFET Q4 are turned on, and the input voltage Vin is transmitted to the comparator array as a sample hold / level shift circuit output. Vref / 4, 3Vref / which is the divided voltage (D / A output) of the upper 2 bits.
4, Vref / 2, Vref / 4, 0V (AVss) are compared. As a result of this comparison, for example, if Vref> Vin (AIN)> 3Vref / 4 as shown in FIG. 4, the control signal 2 is deactivated to the low level, the control signal 0 is activated to the high level, and the switch MOSFETs Q11 and Q1 are activated.
2 is turned on, and the capacitor C has 0 V (AVss)
Is given. As a result, the input signal Vin is -Vre
The level is shifted by f / 2 so as to be in the above sub-range region.

【0059】仮に、Vref /4>Vin(AIN)>0V
のような低い電圧なら、制御信号2が非活性化のロウレ
ベルにされ、制御信号3がハイレベルに活性化されてス
イッチMOSFETQ5とQ6がオン状態となり、キャ
パシタCには3Vref /4が与えられる。このため、上
記入力信号Vinは+Vref /4だけレベルシフトされ、
上記サブレンジ領域になるようにされる。
Assuming that Vref / 4> Vin (AIN)> 0V
With such a low voltage, the control signal 2 is deactivated to the low level, the control signal 3 is activated to the high level, the switch MOSFETs Q5 and Q6 are turned on, and 3Vref / 4 is given to the capacitor C. Therefore, the input signal Vin is level-shifted by + Vref / 4,
It is made to be in the sub-range area.

【0060】また、3Vref /4>Vin(AIN)>V
ref /2なら、制御信号2が非活性化のロウレベルにさ
れ、制御信号1がハイレベルに活性化されてスイッチM
OSFETQ9とQ10がオン状態となり、キャパシタ
CにはVref /4が与えられる。このため、上記入力信
号Vinは−Vref /4だけレベルシフトされ、上記サブ
レンジ領域になるようにされる。そして、Vref /2>
Vin(AIN)>Vref /4のようなサブレンジ領域な
ら、そのままレベルシフト動作は行わないのはいうまで
もない。図6において、サンプルホールド・レベルシフ
ト回路Aについて説明したが、サンプルホールド・レベ
ルシフト回路Bの回路構成及びその動作もこれと同様で
あるため、サンプルホールド・レベルシフト回路Bにつ
いての説明は省略する。
3Vref / 4> Vin (AIN)> V
If ref / 2, the control signal 2 is deactivated to the low level, the control signal 1 is activated to the high level, and the switch M
The OSFETs Q9 and Q10 are turned on, and Vref / 4 is given to the capacitor C. Therefore, the input signal Vin is level-shifted by -Vref / 4 so as to be in the sub-range region. And Vref / 2>
Needless to say, the level shift operation is not performed as it is in the sub-range region such as Vin (AIN)> Vref / 4. Although the sample-hold / level-shift circuit A has been described with reference to FIG. 6, the circuit configuration and operation of the sample-hold / level-shift circuit B are similar to those described above, and therefore the description of the sample-hold / level-shift circuit B is omitted. .

【0061】図5には、上記コンパレータアレイの概略
ブロック図が示されている。コンパレータアレイは、選
択回路と5個の差動増幅回路から構成される。選択回路
は、上位ビットD/A出力(Vref 、3Vref /4、V
ref /2、Vref /4、AVss)と下位ビットD/A出
力のいずれかを選択する。ただし、Vref とAVssに対
応された比較結果出力は無視される。つまり、3Vref
/4、Vref /2、Vref /4の3個の比較出力結果か
ら上位2ビット(9ビットと8ビット)変換出力とそれ
に対応したレベルシフト制御信号が形成される。
FIG. 5 shows a schematic block diagram of the comparator array. The comparator array is composed of a selection circuit and five differential amplification circuits. The selection circuit uses the upper bit D / A outputs (Vref, 3Vref / 4, Vref).
ref / 2, Vref / 4, AVss) or the lower bit D / A output is selected. However, the comparison result output corresponding to Vref and AVss is ignored. That is, 3Vref
From the three comparison output results of / 4, Vref / 2, and Vref / 4, the upper 2 bits (9 bits and 8 bits) conversion output and the level shift control signal corresponding thereto are formed.

【0062】下位ビットD/A変換出力は、1回目では
上記サブレンジ領域が1〜0の4等分された5通りの電
圧が選択される。これにより、範囲外を含めて6領域の
判定結果が得られる。範囲外の場合には変換済の上位ビ
ットの補正が行われる。差動増幅回路の数は、特に制限
されないが、選択回路を設けずに8個としてもよい。補
正を行わないとすれば3乃至6個にできる。なお、3V
ref /4、Vref /2、Vref /4を供給するバッファ
などに演算増幅回路が設けられる。
For the lower bit D / A conversion output, at the first time, five kinds of voltages obtained by dividing the sub-range area into 1 to 0 are selected. As a result, the determination result of 6 areas including the outside of the range can be obtained. If it is out of the range, the converted upper bits are corrected. The number of differential amplifier circuits is not particularly limited, but may be eight without providing a selection circuit. If no correction is performed, the number can be 3 to 6. 3V
An operational amplifier circuit is provided in a buffer that supplies ref / 4, Vref / 2, Vref / 4.

【0063】図7には、同時サンプリングによるA/D
変換動作の代表的な一例を説明するためのフローチャー
ト図が示されている。上記制御レジスタADCRのDS
MPビットを“1”に設定し、そのほか制御レジスタの
各ビットを所定値に設定する。次いで、制御レジスタA
DCRのADSTビットを“1”に設定し、A/D変換
動作を開始させる。このA/D変換動作の開始により、
指定された2チャンネルを同時にサンプリング動作が行
われる。第1チャンネル変換動作が行われ、その変換結
果がデータレジスタ(例えばADDRA)に格納され
る。次に、上記同時サンプリングされた第2チャンネル
の変換動作が行われ、その変換結果が別のデータレジス
タ(例えばADDRB)に格納される。ADSTビット
を“0”にクリアされてA/D変換が停止される。
FIG. 7 shows A / D by simultaneous sampling.
The flowchart figure for demonstrating a typical example of conversion operation is shown. DS of the control register ADCR
The MP bit is set to "1" and each bit of the control register is set to a predetermined value. Then control register A
The ADST bit of DCR is set to "1" to start the A / D conversion operation. With the start of this A / D conversion operation,
The sampling operation is performed on the designated two channels at the same time. The first channel conversion operation is performed, and the conversion result is stored in the data register (eg, ADDRA). Next, the conversion operation of the simultaneously sampled second channel is performed, and the conversion result is stored in another data register (for example, ADDRB). The ADST bit is cleared to "0" and A / D conversion is stopped.

【0064】制御レジスタADCRのADFビットが
“1”にセットされて変換動作の終了が表示されると、
割り込み信号ADIがコントロールロジックから発生さ
れる。割り込み信号ADIを受けた割り込みコントロー
ラINTはデータ転送装置DTCに対して起動要求を行
い、上記データレジスタADDRAとBのリードがデー
タ転送装置DTCによって行われる。ADFビットは、
中央処理装置CPUがビットクリア命令(BCLR)を
実行することによってクリアされるか、データ転送装置
DTCによって自動的にクリアされる。中央処理装置C
PU等により上記変換されたデータ処理が行われる。
When the ADF bit of the control register ADCR is set to "1" to indicate the end of the conversion operation,
The interrupt signal ADI is generated from the control logic. The interrupt controller INT which has received the interrupt signal ADI issues a start request to the data transfer device DTC, and the data transfer device DTC reads the data registers ADDRA and B. The ADF bit is
It is cleared by the central processing unit CPU executing a bit clear instruction (BCLR) or automatically by the data transfer unit DTC. Central processing unit C
The converted data is processed by the PU or the like.

【0065】図8には、通常サンプリングによるA/D
変換動作の代表的な一例を説明するためのフローチャー
ト図が示されている。上記制御レジスタADCRのDS
MPビットを“0”に設定し、そのほか制御レジスタの
各ビットを所定値にする。次いで、制御レジスタADC
SRのADSTビットを“1”に設定し、A/D変換動
作を開始させる。このA/D変換動作の開始により、指
定された第1チャンネルのサンプリング動作が行われ
る。第1チャンネル変換動作が行われ、その変換結果が
データレジスタADDRに格納されると並行して、第2
チャンネルのサンプリング動作が行われる。次に、上記
サンプリングされた第2チャンネルの変換動作が行わ
れ、その変換結果が別のデータレジスタADDRに格納
される。
FIG. 8 shows an A / D based on normal sampling.
The flowchart figure for demonstrating a typical example of conversion operation is shown. DS of the control register ADCR
The MP bit is set to "0" and each bit of the control register is set to a predetermined value. Then the control register ADC
The ADST bit of SR is set to "1" to start the A / D conversion operation. By the start of this A / D conversion operation, the sampling operation of the designated first channel is performed. The first channel conversion operation is performed, and the conversion result is stored in the data register ADDR.
The channel sampling operation is performed. Next, the conversion operation of the sampled second channel is performed, and the conversion result is stored in another data register ADDR.

【0066】制御レジスタADCSRのADFビットが
“1”にセットされて変換動作の終了が表示されると、
割り込み信号ADIが割り込みコントローラINTに出
力されて、上記データレジスタADDRのリードが行わ
れ、ADSTビットを“0”にクリアされてA/D変換
が停止される。中央処理装置CPU等により上記変換さ
れたデータ処理が行われる。
When the ADF bit of the control register ADCSR is set to "1" to indicate the end of the conversion operation,
The interrupt signal ADI is output to the interrupt controller INT, the data register ADDR is read, the ADST bit is cleared to "0", and the A / D conversion is stopped. The converted data processing is performed by the central processing unit CPU or the like.

【0067】以上のA/D変換器の概略は次の通りであ
る。A/D変換器は、10ビットの分解能を持ってい
る。動作モードとしては、セレクト又はグループ及びシ
ングル又はスキャンの4つのモードにバッファ動作、同
時サンプリング動作を組み合わせて設定することでき
る。セレクトモードは1チャンネルを選択し、グループ
モードは複数チャンネルを選択する。シングルモードは
1回の起動で、選択された全てのチャンネルの変換を行
い、スキャンモードでは1回起動すると、ソフトウェア
で停止させられるまで繰り返し変換動作を行う。
The outline of the above A / D converter is as follows. The A / D converter has a resolution of 10 bits. As the operation mode, a buffer operation and a simultaneous sampling operation can be set in combination with four modes of select or group and single or scan. Select mode selects one channel and group mode selects multiple channels. In the single mode, conversion is performed once for all the selected channels, and in the scan mode, once the conversion is started, the conversion operation is repeated until it is stopped by software.

【0068】バッファ動作は当該チャンネルの変換終了
時に前回の変換結果をバッファレジスタに退避させる。
同時サンプリングモードは2チャンネル同時にアナログ
入力電圧をサンプリングし、順次変換する。PWRビッ
トの設定により高速スタートモードと、低消費電力モー
ドの2つの動作モードが選択できる。動作モードや入力
チャンネルを切り替える場合には、ADSTビットを
“0”にクリアした状態で、制御レジスタADCSR、
ADCRの書き換えを行う。制御レジスタADCSR、
ADCRの書き換えた後に、ADSTビットを“1”に
セットすると再びA/D変換を開始する。ADSTビッ
トを“0”にクリアすることにより、A/D変換を停止
することができる。
The buffer operation saves the previous conversion result in the buffer register at the end of conversion of the channel.
In the simultaneous sampling mode, two channels simultaneously sample the analog input voltage and sequentially convert it. Two operation modes, a high speed start mode and a low power consumption mode, can be selected by setting the PWR bit. When switching the operation mode or the input channel, with the ADST bit cleared to "0", the control register ADCSR,
Rewrite ADCR. Control register ADCSR,
When the ADST bit is set to "1" after rewriting the ADCR, the A / D conversion is started again. A / D conversion can be stopped by clearing the ADST bit to "0".

【0069】図9には、セレクト・シングルモードを説
明するためのタイミング図が示されている。同図には、
制御レジスタADCSRの0〜2ビット(CH0〜CH
2)によってチャンネル1が選択された場合が示されて
いる。セレクト・シングルモード(GRP=0,SCA
N=0)は、1チャンネルのみのA/D変換を行う場合
に選択する。TRGS1,0に所定値がセットされた変
換開始条件によって、ADSTビットが“1”にセット
されると、A/D変換を開始する。ADSTビットは、
A/D変換中に“1”を保持しており、変換が終了する
と自動的に“0”にクリアされる。変換が終了すると、
ADFフラグが“1”にセットされる。このとき、AD
IEビットが“1”にセットされていると、割り込み信
号ADIによる割り込みが発生する。ADFフクグは、
制御レジスタADCSRをリードした後、“0”をライ
トするとクリアされる。また、ビットクリア(BCL
R)命令によりクリアすることもできる。
FIG. 9 shows a timing chart for explaining the select / single mode. In the figure,
0 to 2 bits of control register ADCSR (CH0 to CH
The case where channel 1 is selected by 2) is shown. Select single mode (GRP = 0, SCA
N = 0) is selected when performing A / D conversion for only one channel. When the ADST bit is set to "1" under the conversion start condition in which a predetermined value is set in TRGS1,0, A / D conversion is started. The ADST bit is
It holds "1" during A / D conversion and is automatically cleared to "0" when the conversion is completed. When the conversion is finished,
The ADF flag is set to "1". At this time, AD
When the IE bit is set to "1", an interrupt is generated by the interrupt signal ADI. ADF Fugu is
It is cleared by reading "0" after reading the control register ADCSR. Also, bit clear (BCL
It can also be cleared by the R) command.

【0070】図9において、ADSTが“1”にセット
されると、図3のようにクロック信号CLKの期間T1
〜T10の間でコントロールロジックから信号される選
択信号1Aによりチャンネル1(AIN1)が選択さ
れ、サンプリング信号Aが発生されてその取り込みが行
われ、上記最後の期間T10に上位2ビットの変換動作
が行われる。この変換結果により前記のようにレベルシ
フト信号Aが発生され、次に下位変換信号Aが発生され
て2ビットずつ4回に分けたA/D変換動作が行われ
る。クロック信号CLKの最後T20に同期してコント
ロールロジックからラッチ信号が発生されて変換結果が
データレジスタADDRBに取り込まれる。上記のよう
なA/D変換の終了によりADFフラグが“1”にセッ
トされる。
In FIG. 9, when ADST is set to "1", the period T1 of the clock signal CLK as shown in FIG.
The channel 1 (AIN1) is selected by the selection signal 1A output from the control logic during the period from to T10, the sampling signal A is generated and taken in, and the conversion operation of the upper 2 bits is performed in the last period T10. Done. As a result of this conversion, the level shift signal A is generated as described above, and then the lower conversion signal A is generated to perform the A / D conversion operation divided into four by two bits. A latch signal is generated from the control logic in synchronization with the last T20 of the clock signal CLK, and the conversion result is captured in the data register ADDRB. The ADF flag is set to "1" by the end of the A / D conversion as described above.

【0071】図10には、セレクト・スキャンモードを
説明するためのタイミング図が示されている。同図に
は、制御レジスタADCSRの0〜2ビット(CH0〜
CH2)によってチャンネル1が選択された場合が示さ
れている。セレクト・スキャンモード(GRP=0,S
CAN=1)は、1チャンネルのA/D変換を繰り返し
行う場合に選択する。TRGS0,1に所定値がセット
された変換開始条件によって、ADSTビットが“1”
にセットされると、A/D変換を開始する。ADSTビ
ットは、A/D変換中に“1”を保持しており、ソフト
ウェアにより“0”にクリアされるまで、“1”を保持
してその間、選択された入力チャンネルのA/D変換を
繰り返す。また、最初のA/D変換が終了すると、AD
Fフラグが“1”にセットされる。このとき、ADIE
ビットが“1”にセットされていると、割り込み信号A
DIによる割り込みが発生する。ADFフクグは、制御
レジスタADCSRをリードした後、“0”をライトす
るとクリアされる。また、上記同様にビットクリア(B
CLR)命令によりクリアすることもできる。
FIG. 10 shows a timing chart for explaining the select / scan mode. In the figure, 0 to 2 bits (CH0 to 0) of the control register ADCSR are shown.
The case where channel 1 is selected by CH2) is shown. Select scan mode (GRP = 0, S
CAN = 1) is selected when A / D conversion of one channel is repeatedly performed. The ADST bit is "1" depending on the conversion start condition in which a predetermined value is set in TRGS0,1.
When set to, A / D conversion is started. The ADST bit holds "1" during A / D conversion, and holds "1" until it is cleared to "0" by software, during which A / D conversion of the selected input channel is performed. repeat. When the first A / D conversion is completed, AD
The F flag is set to "1". At this time, ADIE
If the bit is set to "1", interrupt signal A
An interrupt by DI occurs. The ADF Fukugu is cleared by reading "0" after reading the control register ADCSR. In addition, bit clear (B
It can also be cleared by the (CLR) command.

【0072】図10において、ADSTが“1”にセッ
トされると、上記同様に選択信号1Aによりチャンネル
1(AIN1)が選択され、サンプリング信号Aが発生
されてその取り込みが行われ、その最後のタイミングで
上位2ビットの変換動作が行われる。この変換結果によ
り前記のようにレベルシフト信号Aが発生され、次に下
位変換信号Aが発生されて2ビットずつ4回に分けたA
/D変換動作が行われる。変換動作の最後に同期してラ
ッチ信号が発生されて変換結果がデータレジスタADD
RBに取り込まれる。このような最初のA/D変換の終
了によりADFフラグが“1”にセットされる。このよ
うな1回目のA/D変換1と同時に2回目のサンプリン
グ2が行われる。
In FIG. 10, when ADST is set to "1", channel 1 (AIN1) is selected by the selection signal 1A in the same manner as described above, the sampling signal A is generated, and the sampling signal A is fetched. The conversion operation of the upper 2 bits is performed at the timing. As a result of this conversion, the level shift signal A is generated as described above, and then the lower conversion signal A is generated and divided into 4 by 2 bits.
The / D conversion operation is performed. A latch signal is generated in synchronization with the end of the conversion operation and the conversion result is stored in the data register ADD.
Captured by RB. The ADF flag is set to "1" by the end of the first A / D conversion. Simultaneously with the first A / D conversion 1 as described above, the second sampling 2 is performed.

【0073】上記ADSTが“1”を保持していると、
上記サンプリング2により取り込んだ入力信号のA/D
変換2が行われ、それと同時に3回目のサンプリング動
作が行われる。このようにサンプリング動作とA/D変
換動作はパイプライン方式により行われる。変換結果は
次々にデータレジスタADDRBに取り込まれる。つま
り、前の変換結果は後の変換結果に置き換えられる。
When the ADST holds "1",
A / D of the input signal captured by the above sampling 2
Conversion 2 is performed, and at the same time, the third sampling operation is performed. In this way, the sampling operation and the A / D conversion operation are performed by the pipeline method. The conversion results are successively taken into the data register ADDRB. That is, the previous conversion result is replaced with the subsequent conversion result.

【0074】図11には、グループ・シングルモードを
説明するためのタイミング図が示されている。同図に
は、制御レジスタADCSRの0〜2ビット(CH0〜
CH2)によってチャンネル0〜2が選択された場合が
示されている。グループ・シングルモード(GRP=
1,SCAN=0)は、複数のチャンネルのA/D変換
を行う場合に選択する。TRGS0,1に所定値がセッ
トされた変換開始条件によって、ADSTビットが
“1”にセットされと、A/D変換を開始する。ADS
Tビットは、A/D変換中に“1”を保持しており、指
定された入力チャンネルの全ての変換が終了すると自動
的に“0”にクリアされる。また、指定された入力チャ
ンネルの全ての変換が終了すると、ADFフラグが
“1”にセットされる。このとき、ADIEビットが
“1”にセットされていると、割り込み信号ADIによ
る割り込みが発生する。ADFフクグは、制御レジスタ
ADCSRをリードした後、“0”をライトするとクリ
アされる。また、上記同様にビットクリア(BCLR)
命令によりクリアすることもできる。
FIG. 11 is a timing diagram for explaining the group / single mode. In the figure, 0 to 2 bits (CH0 to 0) of the control register ADCSR are shown.
The case where channels 0 to 2 are selected by CH2) is shown. Group single mode (GRP =
1, SCAN = 0) is selected when A / D conversion of a plurality of channels is performed. When the ADST bit is set to "1" according to the conversion start condition in which a predetermined value is set in TRGS0,1, A / D conversion is started. ADS
The T bit holds "1" during the A / D conversion, and is automatically cleared to "0" when the conversion of all the designated input channels is completed. Further, when all the conversions of the designated input channel are completed, the ADF flag is set to "1". At this time, if the ADIE bit is set to "1", an interrupt by the interrupt signal ADI occurs. The ADF Fukugu is cleared by reading "0" after reading the control register ADCSR. Also, bit clear (BCLR) as above
It can also be cleared by an instruction.

【0075】図11において、ADSTが“1”にセッ
トされると、上記同様にコントロールロジックから出力
された選択信号0Aによりチャンネル0(AIN0)が
選択され、サンプリング信号Aが発生されてその取り込
みが行われその最後に上位2ビットの変換動作が行われ
る。この変換結果により前記のようにレベルシフト信号
Aが発生され、次に下位変換信号Aが発生されて2ビッ
トずつ4回に分けたA/D変換1の動作が行われる。変
換動作の終了時にラッチ信号Aが発生されて変換結果1
がデータレジスタADDRAに取り込まれる。上記A/
D変換1の動作と並行して、選択信号1Bによりチャン
ネル1(AIN1)が選択され、サンプリング信号Bが
発生されてその取り込みが行われる。
In FIG. 11, when ADST is set to "1", channel 0 (AIN0) is selected by the selection signal 0A output from the control logic in the same manner as described above, the sampling signal A is generated, and its fetching is performed. Then, the conversion operation of the upper 2 bits is performed at the end. As a result of this conversion, the level shift signal A is generated as described above, and then the lower conversion signal A is generated, and the operation of A / D conversion 1 divided into four by two bits is performed. At the end of the conversion operation, the latch signal A is generated and the conversion result 1
Are taken into the data register ADDRA. A /
In parallel with the operation of the D conversion 1, the channel 1 (AIN1) is selected by the selection signal 1B and the sampling signal B is generated and taken in.

【0076】上記チャンネル1の下位8ビットのA/D
変換2の動作と並行して、選択信号2Aが発生されてチ
ャンネル2(AIN2)が選択され、サンプリング信号
Aが発生されてその取り込みが行われる。上記チャンネ
ル1のA/D変換結果2がデータレジスタADDRBに
取り込まれるとともに、上記チャンネル2(AIN2)
のA/D変換3の動作が行われる。この最後のチャンネ
ルのA/D変換動作の終了により、ADFフラグが
“1”にセットされる。このように複数チャンネルでの
サンプリングとその変換動作とがパイプライン方式によ
り行われる。
A / D of lower 8 bits of channel 1
In parallel with the operation of the conversion 2, the selection signal 2A is generated and the channel 2 (AIN2) is selected, and the sampling signal A is generated and taken in. The A / D conversion result 2 of the channel 1 is taken into the data register ADDRB and the channel 2 (AIN2)
The operation of A / D conversion 3 is performed. The ADF flag is set to "1" by the end of the A / D conversion operation of the last channel. In this way, sampling on a plurality of channels and its conversion operation are performed by a pipeline method.

【0077】図12には、グループ・スキャンモードを
説明するためのタイミング図が示されている。同図に
は、制御レジスタADCSRの0〜2ビット(CH0〜
CH2)によってチャンネル0〜2が選択された場合が
示されている。グループ・スキャンモード(GRP=
1,SCAN=1)は、複数のチャンネルのA/D変換
を繰り返し行う場合に選択する。TRGS1,0に所定
値がセットされた変換開始条件によって、ADSTビッ
トが“1”にセットされと、A/D変換を開始する。A
DSTビットは、A/D変換中に“1”を保持してお
り、ソフトウェアにより“0”にクリアされるまで
“1”を保持する。指定された入力チャンネルの最初の
全ての変換が終了すると、ADFフラグが“1”にセッ
トされる。このとき、ADIEビットが“1”にセット
されていると、割り込み信号ADIによる割り込みが発
生する。ADFフクグは、制御レジスタADCSRをリ
ードした後、“0”をライトするとクリアされる。ま
た、上記同様にビットクリア(BCLR)命令によりク
リアすることもできる。
FIG. 12 is a timing chart for explaining the group scan mode. In the figure, 0 to 2 bits (CH0 to 0) of the control register ADCSR are shown.
The case where channels 0 to 2 are selected by CH2) is shown. Group scan mode (GRP =
1, SCAN = 1) is selected when A / D conversion of a plurality of channels is repeatedly performed. When the ADST bit is set to "1" according to the conversion start condition in which a predetermined value is set in TRGS1,0, A / D conversion is started. A
The DST bit holds "1" during A / D conversion, and holds "1" until it is cleared to "0" by software. The ADF flag is set to "1" when all the first conversions of the designated input channel are completed. At this time, if the ADIE bit is set to "1", an interrupt by the interrupt signal ADI occurs. The ADF Fukugu is cleared by reading "0" after reading the control register ADCSR. It can also be cleared by a bit clear (BCLR) instruction as in the above.

【0078】図12において、ADSTが“1”にセッ
トされると、上記同様に選択信号0Aによりチャンネル
0(AIN0)が選択され、サンプリング信号Aが発生
されてその取り込み(サンプリグ1)が行われその最後
に上位2ビットの変換動作が行われる。この変換結果に
より前記のようにレベルシフト信号Aが発生され、次に
下位変換信号Aが発生されて2ビットずつ4回に分けた
A/D変換1の動作が行われる。変換動作の終了時にコ
ントロールロジックからラッチ信号Aが発生されて変換
結果1がデータレジスタADDRAに取り込まれる。上
記A/D変換1の動作と並行して、選択信号1Bにより
チャンネル1(AIN1)が選択され、サンプリング信
号Bが発生されてその取り込み(サンプリング2)が行
われる。
In FIG. 12, when ADST is set to "1", channel 0 (AIN0) is selected by the selection signal 0A in the same manner as described above, the sampling signal A is generated, and its sampling (sampler 1) is performed. Finally, the conversion operation of the upper 2 bits is performed. As a result of this conversion, the level shift signal A is generated as described above, and then the lower conversion signal A is generated, and the operation of A / D conversion 1 divided into four by two bits is performed. At the end of the conversion operation, the latch signal A is generated from the control logic and the conversion result 1 is taken into the data register ADDRA. In parallel with the operation of the A / D conversion 1, the channel 1 (AIN1) is selected by the selection signal 1B, and the sampling signal B is generated and taken in (sampling 2).

【0079】上記チャンネル1の下位8ビットのA/D
変換2の動作と並行して、選択信号2Aが発生されてチ
ャンネル2(AIN2)が選択され、サンプリング信号
Aが発生されてその取り込み(サンプリング3)が行わ
れる。上記チャンネル1のA/D変換結果2がデータレ
ジスタADDRBに取り込まれるとともに、上記チャン
ネル2(AIN2)のA/D変換3の動作が行われる。
このA/D変換3の動作と並行し選択信号0Bが発生さ
れてチャンネル0(AIN0)が選択され、サンプリン
グ信号Bによりその取り込み(サンプリング4)が行わ
れる。この最後のチャンネルのA/D変換動作の終了に
より、ADFフラグが“1”にセットされる。このよう
に複数チャンネルでのサンプリングとその変換動作とが
パイプライン方式により繰り返し行われ、ソフトウェア
によりADSTが“0”にクリアされると変換動作が停
止される。
A / D of lower 8 bits of channel 1
In parallel with the operation of the conversion 2, the selection signal 2A is generated and the channel 2 (AIN2) is selected, and the sampling signal A is generated and taken in (sampling 3). The A / D conversion result 2 of the channel 1 is taken into the data register ADDRB, and the operation of the A / D conversion 3 of the channel 2 (AIN2) is performed.
In parallel with the operation of the A / D conversion 3, the selection signal 0B is generated to select the channel 0 (AIN0), and the sampling signal B captures it (sampling 4). The ADF flag is set to "1" by the end of the A / D conversion operation of the last channel. In this way, sampling on a plurality of channels and its conversion operation are repeatedly performed by a pipeline method, and when ADST is cleared to "0" by software, the conversion operation is stopped.

【0080】図13には、バッファ動作を説明するため
のタイミング図が示されている。同図には、セレクト・
スキャンモード(GRP=0,SCAN=1)の場合が
例として示されている。バッファ動作では、当該チャン
ネルの変換が終了すると、変換結果をデータレジスタA
DDRAに格納すると同時に、その以前に格納していた
変換結果を別のデータレジスタに転送する。バッファ動
作には、制御レジスタADCRのビット0,1(BUF
E0,BUFE1)に格納されているデータに従って、
AIN0→ADDRA→ADDRBの2段の動作と、A
IN0→ADDRA→ADDRC、AIN1→ADDR
B→ADDRDの2段2組の動作と、AIN0→ADD
RA→ADDRB→ADDRC→ADDRDの4段1組
の動作の中のいずれかを選択できる。この場合でもチャ
ンネル4〜7は通常のA/D変換動作を実行できる。ま
た、バッファレジスタに変換結果が格納されレジスタが
飽和(あらかじめ指定されたレジスタの全てにA/D変
換済のデータが書き込まれたとき)したとき、ADFフ
ラグが“1”にセットされる。このとき、ADIEビッ
トが“1”にセットされていると、割り込み信号ADI
による割り込みが発生する。ADFフクグは、制御レジ
スタADCSRをリードした後、“0”をライトすると
クリアされる。また、上記同様にビットクリア(BCL
R)命令によりクリアすることもできる。
FIG. 13 is a timing diagram for explaining the buffer operation. In the figure, select
The case of the scan mode (GRP = 0, SCAN = 1) is shown as an example. In the buffer operation, when the conversion of the channel is completed, the conversion result is stored in the data register A.
At the same time as storing in DDRA, the conversion result stored before is transferred to another data register. For the buffer operation, bits 0, 1 (BUF) of the control register ADCR are used.
According to the data stored in E0, BUFE1),
AIN0 → ADDRA → ADDRB two-stage operation, and
IN0 → ADDRA → ADDRC, AIN1 → ADDR
B → ADDRD two-stage / two-set operation and AIN0 → ADD
It is possible to select any one of the operations of four stages of RA → ADDRB → ADDRC → ADDRD. Even in this case, the channels 4 to 7 can execute the normal A / D conversion operation. Further, when the conversion result is stored in the buffer register and the registers are saturated (when the A / D converted data is written in all the previously designated registers), the ADF flag is set to "1". At this time, if the ADIE bit is set to "1", the interrupt signal ADI
Causes an interrupt. The ADF Fukugu is cleared by reading "0" after reading the control register ADCSR. In addition, bit clear (BCL
It can also be cleared by the R) command.

【0081】図13は、AIN0→ADDRA→ADD
RBの2段の動作の場合が示されている。前記セレクト
・スキャンモード(GRP=0,SCAN=1)により
変換結果1がラッチ信号Aに従ってデータレジスタAD
DRAに格納され、変換結果2が形成されると上記変換
結果1がラッチ信号Bに従ってデータレジスタADDR
Bに転送され、データレジスタADDRAには上記変換
結果2がラッチ信号Aに従って格納される。このように
バッファレジスタに変換結果が格納されレジスタが飽和
したとき、ADFフラグが“1”にセットされる。3回
目のA/D変換3の動作が終了した後にソフトウェアに
よりADSTが“0”にクリアされると変換動作が停止
され、データレジスタADDRAには変換結果3が、A
DDRBには変換結果2が格納されることになる。
FIG. 13 shows AIN0 → ADDRA → ADD.
The case of a two-stage RB operation is shown. According to the select / scan mode (GRP = 0, SCAN = 1), the conversion result 1 is the data register AD according to the latch signal A.
When the conversion result 2 is stored in the DRA and the conversion result 2 is formed, the conversion result 1 is stored in the data register ADDR according to the latch signal B.
The data is transferred to B and the conversion result 2 is stored in the data register ADDRA according to the latch signal A. Thus, when the conversion result is stored in the buffer register and the register is saturated, the ADF flag is set to "1". When ADST is cleared to "0" by software after the third A / D conversion 3 operation is completed, the conversion operation is stopped and the conversion result 3 is stored in the data register ADDRA as A
The conversion result 2 is stored in DDRB.

【0082】図14は、AIN0→ADDRA→ADD
RC、AIN1→ADDRB→ADDRDの2段2組の
動作場合が示されている。前記グループ・スキャンモー
ド(GRP=1,SCAN=1)により変換結果1がラ
ッチ信号Aに従ってデータレジスタADDRAに格納さ
れ、変換結果2がラッチ信号Bに従ってデータレジスタ
ADDRBに格納される。そして、変換結果3が形成さ
れると上記変換結果1がラッチ信号Cに従ってデータレ
ジスタADDRCに転送され、データレジスタADDR
Aにはラッチ信号Aに従って上記変換結果3が格納され
る。同様に、変換結果4が形成されると上記変換結果2
がラッチ信号Dに従ってデータレジスタADDRDに転
送され、データレジスタADDRBには上記変換結果4
がラッチ信号Bに従って格納される。このようにバッフ
ァレジスタに変換結果が格納されレジスタが飽和したと
き、ADFフラグが“1”にセットされる。
FIG. 14 shows AIN0 → ADDRA → ADD.
The operation case of two sets of two stages of RC, AIN1 → ADDRB → ADDRD is shown. The conversion result 1 is stored in the data register ADDRA according to the latch signal A and the conversion result 2 is stored in the data register ADDRB according to the latch signal B in the group scan mode (GRP = 1, SCAN = 1). When the conversion result 3 is formed, the conversion result 1 is transferred to the data register ADDRC according to the latch signal C, and the data register ADDR is transferred.
The conversion result 3 is stored in A according to the latch signal A. Similarly, when the conversion result 4 is formed, the conversion result 2 is obtained.
Is transferred to the data register ADDRD according to the latch signal D, and the conversion result 4 is stored in the data register ADDRB.
Are stored according to the latch signal B. Thus, when the conversion result is stored in the buffer register and the register is saturated, the ADF flag is set to "1".

【0083】同時サンプリング動作では、2チャンネル
の入力電圧を同時にサンプリングし、連続変換を行う。
同時サンプリング動作(DSMP=1)を指定すると、
制御レジスタADCSRのCH2とCH1ビットの指定
により、2チャンネルずつの変換を行う。同時サンプリ
ング動作におけるチャンネルの選択方法を次の表3に示
す。CH0ビットは無効である。
In the simultaneous sampling operation, the input voltages of the two channels are simultaneously sampled and continuous conversion is performed.
If the simultaneous sampling operation (DSMP = 1) is specified,
Conversion is performed for every two channels by specifying the CH2 and CH1 bits of the control register ADCSR. Table 3 below shows how to select channels in the simultaneous sampling operation. The CH0 bit is invalid.

【0084】[0084]

【表3】 [Table 3]

【0085】図15には、同時サンプリング動作を説明
するためのタイミング図が示されている。同図には、グ
ループ・シングルモードの場合が例として示されてい
る。同図において、DSMPが“1”、ADSTが
“1”にセットされると、コントロールロジックから出
力される選択信号AとBによりチャンネル0と1(AI
N0とAIN1)が選択され、サンプリング信号AとB
が発生されてその取り込みが同時に行われ、その最後に
チャンネル0側で上位2ビットの変換動作が行われる。
この変換結果により前記のようにレベルシフト信号Aが
発生され、次にチャンネル0のコントロールロジックか
ら下位変換信号Aが発生されて2ビットずつ4回に分け
たA/D変換1の動作が行われる。変換動作の終了時に
コントロールロジックからラッチ信号Aが発生されて、
変換結果1がデータレジスタADDRAに取り込まれ
る。上記A/D変換1の動作の終了の次に、上記チャン
ネル1のA/D変換動作が行われ、その変換結果2がデ
ータレジスタADDRBに取り込まれる。このA/D変
換2の動作の終了により、ADFフラグが“1”にセッ
トされる。
FIG. 15 is a timing diagram for explaining the simultaneous sampling operation. In the figure, the case of the group / single mode is shown as an example. In the figure, when DSMP is set to "1" and ADST is set to "1", channels 0 and 1 (AI) are selected by the selection signals A and B output from the control logic.
N0 and AIN1) are selected and sampling signals A and B are selected.
Is generated and the acquisition is performed at the same time, and finally, the conversion operation of the upper 2 bits is performed on the channel 0 side.
As a result of this conversion, the level shift signal A is generated as described above, then the lower conversion signal A is generated from the control logic of the channel 0, and the operation of the A / D conversion 1 divided into four by 2 bits is performed. . At the end of the conversion operation, the latch signal A is generated from the control logic,
The conversion result 1 is taken into the data register ADDRA. After the end of the operation of the A / D conversion 1, the A / D conversion operation of the channel 1 is performed, and the conversion result 2 is taken into the data register ADDRB. When the operation of the A / D conversion 2 is completed, the ADF flag is set to "1".

【0086】図16には、同時サンプリング動作を説明
するためのタイミング図が示されている。同図には、グ
ループ・スキャンモード場合が例として示されている。
同図において(DSMP=1,GRP=1,SCAN=
1)、ADSTが“1”にセットされると、選択信号1
Aと1Bによりチャンネル0と1(AIN0とAIN
1)が選択され、サンプリング信号1Aと1Bが発生さ
れてその取り込みが同時に行われ、その最後にチャンネ
ル0側で上位2ビットの変換動作が行われる。この変換
結果により前記のようにコントロールロジックからレベ
ルシフト信号Aが発生され、次にチャンネル0の下位変
換信号Aが発生されて2ビットずつ4回に分けたA/D
変換1の動作が行われる。変換動作の終了時にコントロ
ールロジックからラッチ信号Aが発生されて変換結果1
がデータレジスタADDRAに取り込まれる。上記A/
D変換1の動作の終了の次に上記チャンネル1のA/D
変換動作が行われ、その変換結果2がデータレジスタA
DDRBに取り込まれる。この最初のA/D変換2の動
作の終了により、ADFフラグが“1”にセットされ
る。
FIG. 16 shows a timing diagram for explaining the simultaneous sampling operation. In the figure, the case of the group scan mode is shown as an example.
In the figure, (DSMP = 1, GRP = 1, SCAN =
1) When ADST is set to "1", the selection signal 1
Channels 0 and 1 (AIN0 and AIN by A and 1B)
1) is selected, sampling signals 1A and 1B are generated and taken in at the same time, and finally the conversion operation of the upper 2 bits is performed on the channel 0 side. As a result of this conversion, the level shift signal A is generated from the control logic as described above, then the lower conversion signal A of channel 0 is generated, and the A / D divided into 4 times by 2 bits.
The operation of conversion 1 is performed. At the end of the conversion operation, the control logic generates the latch signal A and the conversion result 1
Are taken into the data register ADDRA. A /
After the end of the D conversion 1 operation, the channel 1 A / D
The conversion operation is performed, and the conversion result 2 is the data register A.
It is taken into DDRB. Upon completion of the operation of the first A / D conversion 2, the ADF flag is set to "1".

【0087】上記のA/D変換2の動作が終了すると、
引き続き選択信号1Aと1Bが発生されてチャンネル0
と1(AIN0とAIN1)が再び選択され、サンプリ
ング信号1Aと1Bが発生されてその取り込みが同時に
行われる。その後に、ソフトウェアによりADSTが
“0”にクリアされると、変化動作が停止されて変換待
機状態となる。
When the operation of the above A / D conversion 2 is completed,
Then, the selection signals 1A and 1B are generated and the channel 0
And 1 (AIN0 and AIN1) are selected again, sampling signals 1A and 1B are generated, and the sampling signals are simultaneously captured. After that, when ADST is cleared to "0" by the software, the changing operation is stopped and the conversion standby state is set.

【0088】図17には、インターバル動作を説明する
ためのタイミング図が示されている。制御レジスタAD
CRのINTビットを“1”にセットすると、次のよう
なインターバル動作が行われる。例えば、グループ・ス
キャンモードが設定され、制御レジスタADCSRのC
H2〜CH0により010を設定して、入力信号AIN
0〜AIN2を選択した場合を例にして説明する。
FIG. 17 shows a timing chart for explaining the interval operation. Control register AD
When the INT bit of CR is set to "1", the following interval operation is performed. For example, the group scan mode is set, and C of the control register ADCSR is set.
Input signal AIN by setting 010 by H2-CH0
A case where 0 to AIN2 is selected will be described as an example.

【0089】1回目のAIN0〜AIN2のサンプリン
グ・変換を前記のようなパイプライン方式により順次に
行う。AIN2のサンプリングのときに、BUSY信号
が活性状態になる。以後、新規の変換は開始しない。A
IN2の変換が終了して、ADFフクグが“1”にセッ
トされ、割り込み信号ADIによって割り込みが要求さ
れる。中央処理装置CPUないしデータ転送装置DTC
が、かかる割り込みに応答して、変換結果を読み出して
上記ADFフラグを“0”にクリアする。
The first sampling / conversion of AIN0 to AIN2 is sequentially performed by the pipeline method as described above. The BUSY signal becomes active when AIN2 is sampled. After that, no new conversion is started. A
After the conversion of IN2 is completed, the ADF Fuku is set to "1", and the interrupt is requested by the interrupt signal ADI. Central processing unit CPU or data transfer unit DTC
However, in response to the interrupt, the conversion result is read and the ADF flag is cleared to "0".

【0090】特に、データ転送装置DTCによるADF
フラグのクリアは、指定された全てのデータ転送終了後
に行われる。中央処理装置CPUがADFフラグを
“0”にクリアする場合には、ビットクリア(BCL
R)命令により行うようにされる。この動作は、制御レ
ジスタADCSRをバイト単位でリードして、ビット7
のみを“0”にクリアして、ほかのビットは保持してバ
イト単位でライトされる。上記のような命令は、前記
「H8/3003 ハードウェアマニュアル」のCPU
と同様である。上記ADFフラグが“0”にクリアされ
ると、BUSY信号が非活性状態になる。ADSTビッ
トは“1”に保持されていので、新しい変換が開始され
る。
In particular, the ADF by the data transfer device DTC
The flag is cleared after all the designated data transfers are completed. When the central processing unit CPU clears the ADF flag to "0", bit clear (BCL
R) It is done by an instruction. This operation reads bit 7 in the control register ADCSR
Only the bits are cleared to "0", other bits are retained and written in byte units. The above-mentioned instruction is executed by the CPU in the "H8 / 3003 Hardware Manual".
Is the same as When the ADF flag is cleared to "0", the BUSY signal becomes inactive. Since the ADST bit is held at "1", a new conversion is started.

【0091】図18には、この発明に係るA/D変換器
の動作を説明するための概略フローチャート図が示され
ている。以上のようなA/D変換器の概略動作をまとめ
て説明すると次のようになる。
FIG. 18 is a schematic flow chart diagram for explaining the operation of the A / D converter according to the present invention. The general operation of the above A / D converter will be summarized and described below.

【0092】ADSTが“1”にセットされるまで待機
状態になる。INFが“1”にされたインターバル動作
のときには、ADFフラグが“0”にクリアされるまで
待機状態になる。制御レジスタADCSR、ADCRに
よって、変換するデータの数nを選択する。例えば、セ
レクトモードでバッファ動作、同時サンプリング以外で
はn=1となる。セレクトモードで、4段バッファ動作
であれば、n=4となる。
The system waits until ADST is set to "1". In the interval operation in which INF is set to "1", the standby state is set until the ADF flag is cleared to "0". The number n of data to be converted is selected by the control registers ADCSR and ADCR. For example, the buffer operation is performed in the select mode, and n = 1 except for simultaneous sampling. In the 4-stage buffer operation in the select mode, n = 4.

【0093】第1チャンネルのサンプリングを行う。n
>1であれば、サンプリングしたデータを変換するとと
もに次のサンプリング動作を行う。nをデクリメントす
る。n=1であれば、すなわち、最後のデータの変換で
あれば、BUSYを“1”にセットする。シングルモー
ドであれば、変換を行い、ADFフラグを“1”にセッ
ト、ADSTビットを“0”にクリアして待機状態に戻
る。
The sampling of the first channel is performed. n
If> 1, the sampled data is converted and the next sampling operation is performed. Decrement n. If n = 1, that is, if the last data conversion, BUSY is set to "1". In the single mode, conversion is performed, the ADF flag is set to "1", the ADST bit is cleared to "0", and the operation returns to the standby state.

【0094】スキャンモードでインターバル動作でなけ
れば、サンプリングしたデータを変換するとともに次の
サンプリングを行う。nを再設定(初期値を回復)す
る。ADFフラグを“1”にセットし、動作を継続す
る。スキャンモードでインターバル動作であれば、サン
プリングしたデータを変換する。nを再設定(初期値を
回復)する。ADFフラグを“1”にセットし、ADF
フラグが“0”にクリアされるまで待機状態になる。同
時サンプリング動作の場合も、CHS0ビットを“1”
とみなすこと、及び2チャンネルの変換に1回2チャン
ネルのサンプリングを同時に行うことのほかは概略同様
である。
If the scan mode is not the interval operation, the sampled data is converted and the next sampling is performed. Reset n (recover the initial value). The ADF flag is set to "1" and the operation is continued. If it is an interval operation in scan mode, the sampled data is converted. Reset n (recover the initial value). Set the ADF flag to "1" and set ADF
It is in a standby state until the flag is cleared to "0". In case of simultaneous sampling operation, CHS0 bit is "1"
Except that it is regarded as, and sampling of 2 channels is performed once for conversion of 2 channels at the same time.

【0095】PWRビットは、A/D変換器の変換開始
モードを選択する。PWRビットを“0”にクリアする
と、アナログ回路(A/D変換器、さらに詳しくは、ア
ナログマルチプレクサ、サンプルホールド・レベルシフ
ト回路A・B、コンパレータアレイA・B、2ビット分
圧、6ビット分圧)は変換動作以外、非アクティブ状態
となる。また、PWRビットを“1”にセットすると高
速スタートモードに設定され、アナログ回路は常にアク
ティブ状態に設定される。
The PWR bit selects the conversion start mode of the A / D converter. When the PWR bit is cleared to "0", the analog circuit (A / D converter, more specifically, analog multiplexer, sample hold / level shift circuit A / B, comparator array A / B, 2-bit voltage division, 6-bit voltage division Pressure) becomes inactive except for the conversion operation. When the PWR bit is set to "1", the fast start mode is set, and the analog circuit is always set to the active state.

【0096】PWRビットを“0”の低消費電力モード
では、ADSTを“1”にセットすると同時にアナログ
回路の電源がオン状態となり、制御レジスタADCSR
のCKSビットで選択した基準クロックの200サイク
ルが経過すると、アナログ回路は変換可能な状態に移行
し、1回目のA/D変換を開始する。連続して変換を行
う場合、2回目以降のA/D変換動作は10サイクルで
行われる。指定されたA/D変換動作が終了すると、自
動的にアナログ回路の電源がオフ状態になり、低消費電
力となる。
In the low power consumption mode in which the PWR bit is "0", ADST is set to "1" and the analog circuit is turned on at the same time, and the control register ADCSR is turned on.
When 200 cycles of the reference clock selected by the CKS bit of 1 have passed, the analog circuit shifts to a convertible state and starts the first A / D conversion. When the conversion is continuously performed, the second and subsequent A / D conversion operations are performed in 10 cycles. When the designated A / D conversion operation is completed, the analog circuit is automatically turned off and the power consumption is reduced.

【0097】バスインターフェイスは、データレジスタ
ADDRA〜ADDRDとバスマスタ(内部データバ
ス)との間のインターフェイスであり、内部データバス
は16ビット幅である。このバスインターフェイスを介
したバスマスタからのデータレジスタADDRA〜AD
DRDのリードは、ワード単位またはバイト単位のいず
れも可能である。データレジスタADDRのワード単位
のリードは、データレジスタADDRの内容が16ビッ
ト一括してバスマスタへ転送される。また、バイト単位
でのリードでは、変換されたデータ(AD9〜AD0)
の上位ビット(AD9〜AD2)の内容がバスマスタへ
転送される。下位の8ビットをバイト単位でリードする
ことはできない。
The bus interface is an interface between the data registers ADDRA to ADDRD and the bus master (internal data bus), and the internal data bus has a 16-bit width. Data registers ADDRA to AD from the bus master via this bus interface
The DRD can be read in word units or byte units. When reading the data register ADDR in word units, the contents of the data register ADDR are transferred to the bus master in a batch of 16 bits. In addition, when reading in byte units, converted data (AD9 to AD0)
The contents of the upper bits (AD9 to AD2) of the are transferred to the bus master. The lower 8 bits cannot be read in byte units.

【0098】図19には、上記バスインターフェイスを
含む読み出し制御回路の主要部のブロック図が示されて
いる。データレジスタADDR、モジュール内データバ
スMDB、バスインターフェイスBIFは10ビット構
成とされる。同図では、10ビットのデータは、ビット
9−8、ビット7−2、ビット1−0に3分割されてい
る。A/D変換結果は、データレジスタADDRの最上
位ビットがビット9に対応するように格納される。
FIG. 19 is a block diagram of the main part of the read control circuit including the bus interface. The data register ADDR, the in-module data bus MDB, and the bus interface BIF have a 10-bit configuration. In the figure, the 10-bit data is divided into three, that is, bit 9-8, bit 7-2, and bit 1-0. The A / D conversion result is stored so that the most significant bit of the data register ADDR corresponds to bit 9.

【0099】中央処理装置CPU又はデータ転送装置D
TCからの読み出しは、内部データバスを介してアドレ
ス信号のデコード結果(デコード信号)、リード信号R
D、ワード信号(WORD)に基づいて制御されてデー
タが読み出される。リード時には、デコード信号とリー
ド信号RDとがアンドゲートを介して出力され、データ
レジスタADDRA〜ADDRH又は制御信号ADC
R,ADCSRのいずれかが選択される。つまり、各レ
ジスタに対応された出力バッファのいずれかが上記デコ
ード信号により活性化されて、選択されたもののデータ
がモジュール内バスMD9−0に出力され、かかるモジ
ュール内バスMD9−0を介してバスインターフェイス
BIF9−0に転送される。
Central processing unit CPU or data transfer unit D
For reading from TC, the decode result (decode signal) of the address signal and the read signal R are read through the internal data bus.
The data is read out under the control of the D and word signals (WORD). At the time of reading, the decode signal and the read signal RD are output via the AND gate, and the data registers ADDRA to ADDRH or the control signal ADC are output.
Either R or ADCSR is selected. That is, one of the output buffers corresponding to each register is activated by the decode signal, the data of the selected one is output to the intra-module bus MD9-0, and the bus is transmitted via the intra-module bus MD9-0. It is transferred to the interface BIF9-0.

【0100】上記バスインターフェイスBIF9−0に
取り込まれたデータは、2系統の出力バッフッァを介し
て出力される。一方は、上記3分割に分けられた10ビ
ットのデータがそのまま内部データバスDB9−DB0
に対応して出力される。他方は、上位ビットBIF9−
2の8ビットが内部データバスDB7−0に対応して出
力される。上記10ビットの読み出しは、リード信号R
Dとワード信号WORDとが活性化状態のときにアンド
ゲート回路を通して上記のような10ビットのデータを
出力させるバッファ回路を活性化させる。このとき、1
6ビット幅の内部バスのうち、DB15−10には
“0”が出力される。1バイトの読み出しは、リード信
号RDとワード信号WORDが非活性状態のときにアン
ドゲート回路を通して上記8ビットに対応したバッファ
回路が活性化される。このようなバイトサイズリードの
ときには、10ビット分解能のA/D変換結果のうち、
上位8ビットが有効とされ、いいかえるならば、2ビッ
ト分下方向にシフトされて内部データバスに出力され
る。
The data taken into the bus interface BIF9-0 is output via the output buffers of two systems. On the other hand, 10-bit data divided into the above three divisions is directly used as the internal data buses DB9-DB0.
Is output in correspondence with. The other is the upper bit BIF9-
8 bits of 2 are output corresponding to the internal data bus DB7-0. The above 10-bit read is performed by the read signal R
When D and the word signal WORD are in the activated state, the buffer circuit for outputting the above 10-bit data through the AND gate circuit is activated. At this time, 1
Of the 6-bit wide internal bus, "0" is output to DB15-10. For reading 1 byte, the buffer circuit corresponding to the above 8 bits is activated through the AND gate circuit when the read signal RD and the word signal WORD are inactive. In such a byte size read, of the A / D conversion results with 10-bit resolution,
The upper 8 bits are valid, in other words, shifted downward by 2 bits and output to the internal data bus.

【0101】この構成では、中央処理装置CPU又はデ
ータ転送装置DTCが随時ワード信号WORDを指定す
ることによって、A/D変換器の分解能を指定できる。
例えば、中央処理装置CPUが10ビット分解能の変換
結果を得たいときには、上記ワード信号WORDを活性
化してリードすればよい。例えば、転送命令MOV,W
@ADDR,R0などを使用する。一方、中央処理装
置CPUが8ビット分解能の変換結果を得たいときに
は、ワード信号WORDを非活性化してリードすればよ
い。例えば、転送命令MOV,W @ADDR,R0H
などを使用する。このようにバスインターフェイスでの
データアライメントを行うようにすることにより、アラ
イメント回路を共通にして論理規模の増加を抑制するこ
とができるとともに、ソフトウェアにより行う場合に比
べて、シフト処理などを不要としたりして、中央処理装
置CPUの負担が大幅に軽減できる。
With this configuration, the resolution of the A / D converter can be designated by the central processing unit CPU or the data transfer unit DTC designating the word signal WORD at any time.
For example, when the central processing unit CPU desires to obtain a conversion result with 10-bit resolution, the word signal WORD may be activated and read. For example, transfer instructions MOV, W
Use @ADDR, R0, etc. On the other hand, when the central processing unit CPU desires to obtain a conversion result with 8-bit resolution, the word signal WORD may be inactivated and read. For example, transfer instructions MOV, W @ADDR, R0H
And so on. By performing the data alignment in the bus interface in this way, it is possible to suppress the increase in the logic scale by making the alignment circuit common, and to eliminate the need for shift processing as compared with the case of using software. Then, the load on the central processing unit CPU can be significantly reduced.

【0102】上記のようなバスサイズによる指定の他、
アドレスが相異なるように配置してもよい。例えば、図
20のアドレスマップ図に示すように、10ビットの分
解能の変換結果がリードできるアドレスと、8ビット分
解能の変換結果がリードできるアドレスとを独立して設
けるものであってもよい。10ビット分解能の変換結果
がリードできるデータレジスタADDRA〜ADDRH
のアドレスを、ワード(16ビット)単位で連続配置
し、8ビット分解能の変換結果がリードできるデータレ
ジスタADDRA〜ADDRHのアドレスを、バイト
(8ビット)単位で連続配置するようにすると都合がよ
い。特に、データ転送装置DTCによって、8ビット分
解能の変換結果を読み出す場合に無駄なリードサイクル
が発生しなくてすむ。
In addition to designation by bus size as described above,
You may arrange | position so that an address may differ. For example, as shown in the address map diagram of FIG. 20, an address from which a conversion result with 10-bit resolution can be read and an address from which a conversion result with 8-bit resolution can be read may be provided independently. Data registers ADDRA to ADDRH that can read conversion results with 10-bit resolution
It is convenient to sequentially arrange the addresses in units of words (16 bits) and the addresses of the data registers ADDRA to ADDRH that can read the conversion result of 8-bit resolution in units of bytes (8 bits). In particular, when the data transfer device DTC reads a conversion result with 8-bit resolution, a useless read cycle does not occur.

【0103】図20には、相対的なアドレスが表示され
ている。ADDRA〜Hは、16ビットレジスタとして
のアドレス(0−F)と8ビットレジスタとしてのアド
レス(10〜17)の両方を持つ。相対アドレス0から
始まるワードデータをリードすると、ADDRAに格納
された変換結果が10ビット分解能でリードされる。相
対アドレス10のバイトデータをリードすると、ADD
RAに格納された変換結果が8ビット分解能(2ビット
右シフトした下位側データ)でリードされる。
FIG. 20 shows relative addresses. ADDRA to H have both an address (0-F) as a 16-bit register and an address (10 to 17) as an 8-bit register. When word data starting from relative address 0 is read, the conversion result stored in ADDRA is read with 10-bit resolution. When byte data of relative address 10 is read, ADD
The conversion result stored in RA is read with 8-bit resolution (lower-order data shifted right by 2 bits).

【0104】図21には、上記アドレス方式に対応した
制御回路の例が示されている。データレジスタは、2つ
のアドレスに対するデコード信号の論理和信号を与えて
読み出す。例えば、ADDRAには、デコード信号Wと
してアドレス0の検出信号と、デコード信号Bとしてア
ドレス10の検出信号が供給される。バスインターフェ
イスBIFには、アドレス0〜Fのいずれかが与えられ
たことを検出した信号によりバスインターフェイスBI
F9−0を含む全部で16ビットに対応した上記バッフ
ァ回路を活性化させる信号が形成されて10ビット分解
能の変換結果がリードされる。アドレス10〜17のい
ずれかが与えられたことを検出した信号に従ってバスイ
ンターフェイスBIF9−2に対応され、内部データバ
スの下位バイトに対応したバッファ回路が活性化されて
8ビット分解能の変換結果がリードされる。
FIG. 21 shows an example of a control circuit corresponding to the above address system. The data register gives a logical sum signal of the decode signals to two addresses and reads it. For example, the ADDRA is supplied with the detection signal of the address 0 as the decode signal W and the detection signal of the address 10 as the decode signal B. The bus interface BIF receives a signal indicating that any one of the addresses 0 to F is applied to the bus interface BIF.
A signal for activating the buffer circuit corresponding to a total of 16 bits including F9-0 is formed and the conversion result of 10-bit resolution is read. According to a signal that detects that any of the addresses 10 to 17 is applied, the buffer circuit corresponding to the bus interface BIF9-2 is activated corresponding to the lower byte of the internal data bus and the conversion result of 8-bit resolution is read. To be done.

【0105】図22には、上記のようなワードデータと
バイトデータのリードを説明するためのビット配置図が
示されている。16ビットからなるデータレジスタAD
DRには、9−0に10ビットからなる変換結果が格納
され、15−10には“0”が格納されている。これを
ワードデータ(10ビット分解能)としてリードするき
には、データレジスタADDRのビット0〜15に格納
されているデータが内部16ビットデータバスに出力さ
れる。これに対して、バイトデータ(8ビット分解能)
としてリードするときには、データレジスタADDRの
ビット2〜9に格納されているデータが内部8ビットデ
ータバスに出力される。
FIG. 22 is a bit arrangement diagram for explaining the reading of word data and byte data as described above. 16-bit data register AD
In the DR, a conversion result of 10 bits is stored in 9-0, and "0" is stored in 15-10. When this is read as word data (10-bit resolution), the data stored in bits 0 to 15 of the data register ADDR is output to the internal 16-bit data bus. On the other hand, byte data (8-bit resolution)
When read as, the data stored in bits 2 to 9 of the data register ADDR is output to the internal 8-bit data bus.

【0106】図23には、データレジスタADDRA〜
ADDRDの相互の回路構成図が示されている。この回
路は、前記バッファ動作に対応されている。各レジスタ
ADDRA〜ADDRDには、バッファ回路を介して逐
次比較レジスタからのデータを入力することができる。
それぞれの選択信号aないしdが活性状態で、変換終了
時のラッチ信号が活性状態になると、選択信号a〜dの
うち上記活性状態に対応されたいずれかのデータレジス
タに逐次比較レジスタの内容が取り込まれる。各レジス
タADDRA〜Dは、いわゆるマスタースレーブ構成に
なっている。
FIG. 23 shows the data registers ADDRA.about.
A mutual circuit block diagram of ADDRD is shown. This circuit is compatible with the buffer operation. Data from the successive approximation register can be input to each of the registers ADDRA to ADDRD via a buffer circuit.
When each of the selection signals a to d is in the active state and the latch signal at the end of conversion is in the active state, the contents of the successive approximation register are stored in any one of the data signals corresponding to the active state among the selection signals a to d. It is captured. Each register ADDRA to D has a so-called master-slave configuration.

【0107】ハッファ動作において、BUFE1,0ビ
ットが01のとき、バッファ動作1信号が活性状態にな
る。BUFE1,0ビットが10のとき、バッファ動作
2信号が活性状態になる。BUFE1,0ビットが11
のとき、バッファ動作3信号が活性状態になる。バッフ
ァ動作2〜3信号のそれぞれは、制御レジスタADCR
のBOFE1,0にセットされたデータに基づいて、コ
ントロールロジックから出力される。
In the Huffer operation, when the BUFE1,0 bit is 01, the buffer operation 1 signal becomes active. When the BUFE1,0 bit is 10, the buffer operation 2 signal is activated. BUFE 1,0 bit is 11
At this time, the buffer operation 3 signal is activated. Each of the buffer operation 2-3 signals is controlled by the control register ADCR.
Is output from the control logic based on the data set in BOFE1,0 of the.

【0108】上記バッファ動作1信号が活性状態のと
き、選択信号aとラッチ信号が発生すると、データレジ
スタADDRAの古いデータがバッファ回路を介してデ
ータレジスタADDRBに転送され、逐次比較レジスタ
の出力がデータレジスタADDRAに取り込まれる。
When the select signal a and the latch signal are generated while the buffer operation 1 signal is active, the old data in the data register ADDRA is transferred to the data register ADDRB via the buffer circuit, and the output of the successive approximation register is changed to the data. It is taken into the register ADDRA.

【0109】上記バッファ動作2信号が活性状態のと
き、選択信号aとラッチ信号が発生すると、データレジ
スタADDRAの古いデータがバッファ回路を介してデ
ータレジスタADDRCに転送され、逐次比較レジスタ
の出力がデータレジスタADDRAに取り込まれる。選
択信号bとラッチ信号が発生すると、データレジスタA
DDRBの古いデータがバッファ回路を介してデータレ
ジスタADDRDに転送され、逐次比較レジスタの出力
がデータレジスタADDRBに取り込まれる。
When the selection signal a and the latch signal are generated while the buffer operation 2 signal is active, the old data in the data register ADDRA is transferred to the data register ADDRC via the buffer circuit, and the output of the successive approximation register is changed to the data. It is taken into the register ADDRA. When the selection signal b and the latch signal are generated, the data register A
The old data of DDRB is transferred to the data register ADDRD via the buffer circuit, and the output of the successive approximation register is captured in the data register ADDRB.

【0110】上記バッファ動作3信号が活性状態のと
き、これにより制御されるバッファ回路により、データ
レジスタADDRA→ADDRB→ADDRC→ADD
RDの順にA/D変換結果の取り込みに同期して転送さ
れる。
When the buffer operation 3 signal is active, the buffer circuit controlled by the buffer operation 3 signal causes the data register ADDRA.fwdarw.ADDRB.fwdarw.ADDRC.fwdarw.ADD.
The data is transferred in the order of RD in synchronization with the acquisition of the A / D conversion result.

【0111】図24には、アナログマルチプレクサの一
実施例のブロック図が示されている。アナログ入力AI
N0〜AIN7がNチャンネル型MOSFETとPチャ
ンネル型MOSFETからなる全部で16個のCMOS
スイッチ回路を介してサンプルホールド・レベルシフト
回路AとBに対応した第1入力、第2入力として取り込
まれる。スイッチの制御信号である選択信号0A、0B
〜7A、7Bは、コントロールロジックから与えられ
る。例えば、アナログ入力AIN4とAIN5をグルー
プモードでかつ同時サンプリングによりA/D変換する
場合には、第1に選択信号4A、5Bが活性状態になっ
て、アナログ入力AIN4からの入力レベルがサンプル
ホールド・レベルシフト回路Aにサンプリングされ、ア
ナログ入力AIN5からの入力レベルがサンプルホール
ド・レベルシフト回路Bにサンプリングされる。その
後、上記同時サンプリングした結果を順次にA/D変換
する。
FIG. 24 shows a block diagram of an embodiment of the analog multiplexer. Analog input AI
N0 to AIN7 consist of N channel type MOSFET and P channel type MOSFET in total 16 CMOS
It is taken in as first and second inputs corresponding to the sample and hold / level shift circuits A and B via the switch circuit. Select signals 0A and 0B that are switch control signals
7A and 7B are given from the control logic. For example, when the analog inputs AIN4 and AIN5 are A / D converted in the group mode by simultaneous sampling, first, the selection signals 4A and 5B are activated, and the input level from the analog input AIN4 is sampled and held. The level shift circuit A samples and the input level from the analog input AIN5 is sampled by the sample hold level shift circuit B. After that, the results of the simultaneous sampling are sequentially A / D converted.

【0112】図25には、アナログマルチプレクサの他
の一実施例の回路図が示されている。上記同様に入力ポ
ートとしての機能や保護回路などは省略されている。ア
ナログ入力AIN0〜AIN7がNチャンネル型MOS
FETとPチャンネル型MOSFETからなるCMOS
スイッチ回路を介して前記同様な第1入力と第2入力と
して取り込まれる。この実施例では、2段のスイッチ回
路により1つのアナログ入力が選ばれるようにされる。
A circuit diagram of another embodiment of the analog multiplexer is shown in FIG. Similar to the above, the function as an input port and the protection circuit are omitted. Analog inputs AIN0 to AIN7 are N-channel type MOS
CMOS consisting of FET and P-channel MOSFET
It is fetched as the first input and the second input similar to the above through the switch circuit. In this embodiment, one analog input is selected by the two-stage switch circuit.

【0113】選択信号01、23、45、67及び選択
信号EA、OA、EB、OBはコントロールロジックか
ら与えられる。選択信号01、23、45、67は、そ
れぞれ隣り合ったアナログ入力を2チャンネルずつ選択
する。選択信号01、23、45、67は、セレクトモ
ードのときはCHS2、1ビットをデコードして生成さ
れる。グループモードのときは、コントロールロジック
内部の状態信号などに従って生成される。選択信号01
は、前記例の選択信号0A、0B、1A、1Bのオア信
号とされる。同様に選択信号23は、選択信号2A,2
B,3A,3Bのオア信号、選択信号45は選択信号4
A,4B,5A,5Bのオア信号、選択信号67は選択
信号6A,6B,7A,7Bのオア信号である。選択信
号OAは、選択信号1A,3A,5A,7Aのオア信号
とされる。選択信号EAは、前記選択信号0A、2A、
4A、6Aのオア信号とされる。選択信号EBは選択信
号0B,2B,4B,6Bのオア信号とされる。選択信
号OBは、前記選択信号1B、3B、5B、7Bのオア
信号とされる。同時サンプリングは、グループモードの
奇数番目のサンプリングを、直前の奇数番目のサンプリ
ングと同時に行うものとされる。この構成では、スイッ
チの数を12個と減らすことができる。
The selection signals 01, 23, 45, 67 and the selection signals EA, OA, EB, OB are given from the control logic. The selection signals 01, 23, 45 and 67 select two adjacent analog inputs for each two channels. The select signals 01, 23, 45 and 67 are generated by decoding 1 bit of CHS2 in the select mode. In the group mode, it is generated according to the status signal in the control logic. Selection signal 01
Is the OR signal of the selection signals 0A, 0B, 1A, 1B in the above example. Similarly, the selection signal 23 is the selection signals 2A, 2
OR signal of B, 3A, 3B, selection signal 45 is selection signal 4
The OR signals of A, 4B, 5A and 5B and the selection signal 67 are OR signals of the selection signals 6A, 6B, 7A and 7B. The selection signal OA is an OR signal of the selection signals 1A, 3A, 5A and 7A. The selection signal EA is the selection signals 0A, 2A,
It is an OR signal of 4A and 6A. The selection signal EB is an OR signal of the selection signals 0B, 2B, 4B, 6B. The selection signal OB is an OR signal of the selection signals 1B, 3B, 5B and 7B. Simultaneous sampling is performed by performing odd-numbered sampling in the group mode at the same time as immediately preceding odd-numbered sampling. With this configuration, the number of switches can be reduced to 12.

【0114】図26には、第8ポートIOP8に含まれ
るBUSY出力制御回路の一実施例の回路図が示されて
いる。BUSY出力は、データを入出力するポートと兼
用にされる。BUSY出力制御回路は、端子、出力バッ
ファ、データディレクションレジスタDDR、データレ
ジスタDR、入力バッファ、セレクタから構成される。
FIG. 26 shows a circuit diagram of an embodiment of the BUSY output control circuit included in the eighth port IOP8. The BUSY output is also used as a port for inputting / outputting data. The BUSY output control circuit includes a terminal, an output buffer, a data direction register DDR, a data register DR, an input buffer, and a selector.

【0115】データディレクションレジスタDDRは、
フリップフロップから構成される。図示されないライト
信号とアドレスデコード信号とによって、ライト制御信
号が与えられ、データバスの内容が書き込まれる。DD
Rを“1”にセットすると、端子は出力状態(出力バッ
ファがイネーブル状態)になり、出力バッファの出力が
端子に出力される。セレクタの制御信号は、A/D変換
器がTRGS1,0ビットでADTRGによる外部トリ
ガを選択したことを示す信号とされる。外部トリガを選
択するとA/D変換器のBUSY信号が選択される。外
部トリガが非選択の場合には、データレジスタDRの出
力が選択される。このデータレジスタDRは、フリップ
フロップから構成される。図示されないライト信号とア
ドレスデコード信号によってライト制御信号が与えら
れ、データバス上のデータがデータレジスタDRに書き
込まれる。また、図示されないリード信号とアドレスデ
コード信号によってリード制御信号が与えられ、端子に
供給されたデータがデータバスに読み出される。
The data direction register DDR is
It consists of flip-flops. A write control signal is given by a write signal and an address decode signal (not shown), and the contents of the data bus are written. DD
When R is set to "1", the terminal enters the output state (the output buffer is enabled), and the output of the output buffer is output to the terminal. The control signal of the selector is a signal indicating that the A / D converter has selected the external trigger by ADTRG with TRGS1 and 0 bits. When the external trigger is selected, the BUSY signal of the A / D converter is selected. When the external trigger is not selected, the output of the data register DR is selected. The data register DR is composed of a flip-flop. A write control signal is given by a write signal and an address decode signal (not shown), and the data on the data bus is written in the data register DR. Further, a read control signal is given by a read signal and an address decode signal (not shown), and the data supplied to the terminal is read out to the data bus.

【0116】BUSY信号を外部に出力する場合には、
ADTRGによる外部トリガを選択し、DDRを“1”
にセットする。ADTRG以外の変換開始を選択するよ
うな場合には、ADTRGを選択しない状態では、ポー
ト出力としてBUSY状態と同じレベルを出力しておく
ようにするとよい。
When outputting the BUSY signal to the outside,
Select external trigger by ADTRG and set DDR to "1"
Set to. When a conversion start other than ADTRG is selected, it is advisable to output the same level as the BUSY state as the port output in a state in which ADTRG is not selected.

【0117】BUSY信号は、ADTRGによってサン
プリングを開始したときデータバッファに空きが1回分
しかないときに活性状態にされる。ADFフラグが
“1”にセットされていると、BUSY信号は活性状態
とされる。この後、ADFフラグが“0”にクリアする
と、BUSY信号は非活性状態になる。例えば、ADF
フラグが“0”にクリアされた状態で、セレクトモード
で、ADTRG信号によって動作を開始すると、サンプ
リング開始時にBUSY信号が活性状態になる。変換が
終了すると、ADFフラグが“1”にセットされる。そ
の後、中央処理装置CPUまたはデータ転送装置DTC
によって、ADFフラグが“0”にクリアされると、B
USY信号は非活性状態になる。
The BUSY signal is activated when there is only one free space in the data buffer when sampling is started by ADTRG. When the ADF flag is set to "1", the BUSY signal is activated. After that, when the ADF flag is cleared to "0", the BUSY signal becomes inactive. For example, ADF
When the operation is started by the ADTRG signal in the select mode with the flag cleared to "0", the BUSY signal becomes active at the start of sampling. When the conversion is completed, the ADF flag is set to "1". After that, the central processing unit CPU or the data transfer unit DTC
When the ADF flag is cleared to "0" by
The USY signal becomes inactive.

【0118】ADFフラグが“0”にクリアされた状態
で、グループモードで、ADTRG信号によって動作を
開始すると、最後のチャンネルのサンプリング開始時に
BUSY信号が活性状態になる。1入力2レジスタのバ
ッファ動作を指定した場合には、2回目のサンプリング
時にBUSY信号が活性状態になる。1入力4レジスタ
のバッファ動作を指定した場合には、4回目のサンプリ
ング時にBUSY信号が活性状態になる。2入力4レジ
スタのバッファ動作を指定した場合には、2回目の第2
チャンネルのサンプリング時にBUSY信号が活性状態
になる。
When the operation is started by the ADTRG signal in the group mode with the ADF flag cleared to "0", the BUSY signal becomes active at the start of sampling the last channel. When the buffer operation of the 1-input 2-register is designated, the BUSY signal becomes active at the time of the second sampling. When the buffer operation of the 1-input 4-register is designated, the BUSY signal becomes active at the time of the fourth sampling. If the 2-input 4-register buffer operation is specified, the second second
The BUSY signal becomes active when the channel is sampled.

【0119】図27には、PWRビットによるA/D変
換器の動作を説明するためのタイミング図が示されてい
る。変換待機状態ではPWRビットは“0”にクリアさ
れている。アナログ回路は非活性状態で、消費電流を低
減させる。この状態で、ソフトウェア、外部トリガ又は
タイマトリガによってADSTビットを“1”にセット
すると、コントロールロジック内のフラグIPWRが
“1”にセットされる。アナログ回路は活性状態になる
が、アナログ回路が安定動作する(演算増幅器のMOS
FETの充電など)まで、200クロック期間、A/D
変換器は待機状態になる。その後、コントロールロジッ
クから出力されるPON信号が“1”になって、最初の
A/D変換動作を行う。以後の動作は前記同様である。
指定したA/D変換動作終了後、上記IPWRフラグが
“0”にクリアされ、アナログ回路は非活性状態にな
る。コントロールロジックに上記200クロックをカウ
ントするカウンタを持つ。
FIG. 27 is a timing chart for explaining the operation of the A / D converter based on the PWR bit. In the conversion standby state, the PWR bit is cleared to "0". The analog circuit is inactive and reduces current consumption. In this state, when the ADST bit is set to "1" by software, an external trigger or a timer trigger, the flag IPWR in the control logic is set to "1". Although the analog circuit is activated, the analog circuit operates stably (MOS of the operational amplifier).
200 clock period, A / D until FET charge etc.)
The transducer goes into standby. After that, the PON signal output from the control logic becomes "1", and the first A / D conversion operation is performed. Subsequent operations are the same as above.
After the designated A / D conversion operation is completed, the IPWR flag is cleared to "0", and the analog circuit becomes inactive. The control logic has a counter that counts the 200 clocks.

【0120】予めソフトウェアによりPWRビットを
“1”にセットすると、内部IPWRフラグが“1”に
セットされ、この時点でアナログ回路は活性状態にな
り、所定の時間(上記200クロック相当、例えば10
μs)を経過すると、A/D変換器は変換可能状態にな
る。その後、ソフトウェアまたは外部トリガまたはタイ
マトリガによって、ADSTビットを“1”にセットす
ると、内部PONが“1”になって、直ちにA/D変換
が開始される。内部IPWRビットは保持される。上記
200クロックをカウントするカウンタは無効になる。
If the PWR bit is set to "1" by software in advance, the internal IPWR flag is set to "1", and the analog circuit becomes active at this point, and the analog circuit is activated for a predetermined time (equivalent to 200 clocks, for example, 10 clocks).
After the elapse of μs), the A / D converter is ready for conversion. After that, when the ADST bit is set to "1" by software, an external trigger or a timer trigger, the internal PON becomes "1" and A / D conversion is immediately started. The internal IPWR bit is retained. The counter that counts 200 clocks is disabled.

【0121】定期的な外部入力のモニタなどに用いる場
合には、例えば200クロックよりも十分に遅い入力信
号を変換する場合には、PWRビットを“0”にクリア
しておき、A/D変換が可能な場合にADSTビットを
“1”にセットして、変換を開始させ、A/D変換終了
割り込みルーチンでPWRビットを“0”にクリアし、
変換結果を処理するようにすればよい。ソフトウェアが
200クロックを計測する必要がなく(割り込み待ちで
よい)、ソフトウェアの負担がない。また、アナログ回
路が活性状態の期間を最低限にすることができるから、
消費電流を低減することができる。
When used for periodical external input monitoring or the like, for example, when converting an input signal sufficiently slower than 200 clocks, the PWR bit is cleared to "0" and A / D converted. If possible, set the ADST bit to “1” to start conversion and clear the PWR bit to “0” in the A / D conversion end interrupt routine.
The conversion result may be processed. The software does not need to measure 200 clocks (waiting for an interrupt), and there is no load on the software. In addition, since the period when the analog circuit is active can be minimized,
It is possible to reduce current consumption.

【0122】所望のタイミングで直ちにA/D変換を開
始する必要がある場合には、予め、例えばリセット処理
ルーチンでソフトウェアによりPWRビットを“1”に
セットしておけばよい。200クロック相当以上の時間
が経過した後、所望の時点でソフトウェアによりADS
Tビットを“1”にセットし、A/D変換が開始され
る。上記PWRビット、ADSTビットの以外のビット
は任意に設定できる。
When it is necessary to immediately start A / D conversion at a desired timing, the PWR bit may be set to "1" by software in advance, for example, in a reset processing routine. After the time equivalent to 200 clocks or more has elapsed, ADS is set by software at the desired time.
The T bit is set to "1" and A / D conversion is started. Bits other than the PWR bit and ADST bit can be set arbitrarily.

【0123】システムないしシングルチップマイクロコ
ンピュータ自体の初期化処理に、200クロック以上必
要とする場合が多いから、実使用上には、常にA/D変
換が可能状態になる。その後は、ソフトウェア、外部ト
リガ又はタイマトリガによって、ADSTビットを
“1”にセットすることにより、A/D変換が直ちに開
始されるから、処理精度を向上したり、リアルタイム性
を向上したりすることができる。
Initialization processing of the system or the single-chip microcomputer itself often requires 200 clocks or more, so that in actual use, A / D conversion is always possible. After that, by setting the ADST bit to "1" by software, an external trigger or a timer trigger, the A / D conversion is immediately started, so that the processing accuracy and the real-time property can be improved. it can.

【0124】図28には、この発明に係るシングルチッ
プマイクロコンピュータを用いた制御システムの一実施
例のブロック図が示されている。同図のシングルチップ
マイクロコンピュータMCUは、図1に示されたシング
ルチップマイクロコンピュータが用いられる。同図の制
御システムは、上記シングルチップマイクロコンピュー
タを用いて、ACインダクションモータ或いはブラシレ
スDCモータなどのモータ制御に向けられている。
FIG. 28 is a block diagram showing an embodiment of a control system using the single chip microcomputer according to the present invention. The single chip microcomputer MCU shown in FIG. 1 uses the single chip microcomputer shown in FIG. The control system in the figure is directed to motor control of an AC induction motor, a brushless DC motor, or the like, using the single-chip microcomputer.

【0125】タイマBによる相補3相のPWM出力
(U,U#、V,V#、W,W#)を用いて、インバー
タ回路を介してインバータモータMを駆動する。かかる
相補3相のPWM出力は、例えば、前記「H8/300
3 ハードウェアマニュアル」pp.374〜381な
とに記載されている。前記の通り、正相/逆相の出力間
にノーオーバーラップを設定できれば、インバータ回路
を構成する直列接続されたトランジスタが同時にオン状
態となり、かかるトランジスタを通して大きな貫通電流
が発生することが防止できる。
The complementary three-phase PWM output (U, U #, V, V #, W, W #) from the timer B is used to drive the inverter motor M through the inverter circuit. Such complementary three-phase PWM output is, for example, the above-mentioned “H8 / 300”.
3 Hardware Manual ”pp. 374-381. As described above, if no overlap can be set between the positive-phase / negative-phase outputs, it is possible to prevent the transistors connected in series that form the inverter circuit from being turned on at the same time, and prevent a large through current from flowing through the transistors.

【0126】上記インバータ回路の出力が、モータを駆
動する。例えば、上記インバータ回路の出力がモータの
内部で、特に制限されないが、いわゆるY結線(又はス
ター結線)、あるいはΔ結線された固定子捲線に与えら
れる。PWM出力の周期(搬送波周期)は、例えば40
00ステート(20μs=5KHz)にされる。
The output of the inverter circuit drives the motor. For example, the output of the inverter circuit is applied to a so-called Y connection (or star connection) or a Δ-connected stator winding inside the motor, although not particularly limited thereto. The PWM output cycle (carrier wave cycle) is, for example, 40
00 state (20 μs = 5 KHz).

【0127】2相のインバータ駆動電流を検出して、A
/D変換器のアナログ入力AIN4,5に入力する。上
記の通り、インバータ回路の出力は、Y結線(又はスタ
ー結線)、あるいはΔ結線されているから、3相の電流
の合計値は0になる。2相の電流を検出することによ
り、3相目の電流を求めることができる。これらのA/
D変換は、上記タイマBのコンペアマッチA及びアンダ
ーフローによって起動され、グループ・シングルモード
で変換する。
A two-phase inverter drive current is detected, and A
Input to analog inputs AIN4, 5 of the / D converter. As described above, since the output of the inverter circuit is Y-connected (or star-connected) or Δ-connected, the total value of the three-phase currents becomes zero. The current of the third phase can be obtained by detecting the current of the second phase. These A /
The D conversion is activated by the compare match A and underflow of the timer B, and performs conversion in the group / single mode.

【0128】すなわち、制御レジスタは、タイマ出力に
同期した、モータ電流の計測ができる。ハードウェアに
よってA/D変換器の起動ができるので、タイマの所定
のタイミングから、モータの駆動電流を計測するまでの
時間を短縮し、検出精度を向上できる。20ステート
(1μs)で、サンプリングを行い、80ステート(4
μs)で変換結果を得ることができる。2相分の電流を
同時にサンプリングすることにより、電流の検出精度を
向上し、タイマ出力に反映でき、制御精度を向上するこ
とができる。
That is, the control register can measure the motor current in synchronization with the timer output. Since the A / D converter can be activated by hardware, the time from the predetermined timing of the timer until the motor drive current is measured can be shortened, and the detection accuracy can be improved. Sampling is performed in 20 states (1 μs), and 80 states (4
The conversion result can be obtained in μs). By sampling the currents of two phases at the same time, the current detection accuracy can be improved and reflected in the timer output, and the control accuracy can be improved.

【0129】これらは精度が必要であり、ワードサイズ
で中央処理装置CPUがリードを行い、10ビット分解
能を得る。データは下位詰めになっているので、他のパ
ラメータと直接演算ができる。中央処理装置CPUの処
理の高速化を図ることができる。例えば、かかる電流の
計測結果が意図した電流値と合致するように、PWMデ
ューティの変更を行う。この発明に係るA/D変換器を
用いることにより、測定精度が向上し、ソフトウェアの
負担が軽減され、システム全体の処理性能を向上するこ
とができる。
These require precision, and the central processing unit CPU reads in word size to obtain 10-bit resolution. Since the data is left-justified, it can be directly calculated with other parameters. The processing speed of the central processing unit CPU can be increased. For example, the PWM duty is changed so that the measurement result of the current matches the intended current value. By using the A / D converter according to the present invention, it is possible to improve the measurement accuracy, reduce the load on software, and improve the processing performance of the entire system.

【0130】また、雰囲気温度や電圧検出などのセンサ
回路の出力を、A/D変換器のアナログ入力AIN0、
1、4〜7に入力する。例えば、タイマAのコンペアマ
ッチまたはオーバーフロー割り込みを、約100ms毎
に発生するようにする。かかる割り込み処理によって、
中央処理装置CPUが制御レジスタを設定して、アナロ
グ入力AIN0、1、4〜7 は、例えばグループ・シン
グルモードにより一定時間間隔でセンサ情報のサンプリ
ングを行う。
Further, the output of the sensor circuit for detecting the ambient temperature and the voltage is compared with the analog input AIN0 of the A / D converter,
Input in 1, 4-7. For example, a timer A compare match or overflow interrupt is generated about every 100 ms. By such interrupt processing,
The central processing unit CPU sets a control register so that the analog inputs AIN0, 1, 4 to 7 sample sensor information at a constant time interval, for example, in the group / single mode.

【0131】これらの雰囲気温度や電源電圧等の分解能
はさほど必要なく、バイトサイズで中央処理装置CPU
がリードすることによって、8ビット分解能のデータを
得ることができる。中央処理装置CPUは、これらの内
容を判定して、各種のパラメータを変更したり、そのほ
かの入出力処理をする。例えば、タイマBのPWMデュ
ーティを変更する。タイマA及びタイマBのそのほかの
出力は、別のドライバ回路を介して別のDCモータ或い
はステッピングモータを駆動する。入出力ポートIOP
1〜3は、各種スイッチやリレーなどの制御を行う。
The resolution of the ambient temperature and the power supply voltage is not required so much, and the central processing unit CPU
Can be read to obtain 8-bit resolution data. The central processing unit CPU determines these contents, changes various parameters, and performs other input / output processing. For example, the PWM duty of the timer B is changed. The other outputs of the timer A and the timer B drive another DC motor or a stepping motor through another driver circuit. I / O port IOP
1-3 control various switches and relays.

【0132】図29には、上記タイマBとA/D変換器
の動作の一例を説明するためのタイミング図が示されて
いる。タイマBは、2本のアップダウンカウンタTCN
T3とTCNT4が0と周期設定レジスタとの間をアッ
プ/ダウンの計数動作を行う。これらのカウンタTCN
T3,4とコンペアレジスタUとのコンペアマッチによ
って、タイマ出力U、U#を出力する。U,U#は、互
いに相補ノーオーバーラップの関係にあるPWM出力と
なる。同様に、図示されないコンペアレジスタV,Wと
のコンペアマッチによってタイマ出力V,V#とW,W
#を出力する。
FIG. 29 shows a timing chart for explaining an example of the operation of the timer B and the A / D converter. Timer B has two up / down counters TCN
Up / down counting operation is performed between T3 and TCNT4 between 0 and the cycle setting register. These counters TCN
The timer outputs U and U # are output by a compare match between T3 and T4 and the compare register U. U and U # are PWM outputs having a complementary no-overlap relationship with each other. Similarly, timer outputs V, V # and W, W are generated by a compare match with a compare register V, W (not shown).
Output #.

【0133】中央処理装置CPUは、タイマBのチャン
ネル3の周期設定レジスタとのコンペアマッチ及びチャ
ンネル4のアンダーフローの両方でA/D変換器を起動
するようにする。中央処理装置CPUは、制御レジスタ
を入力チャンネルAIN2,3に設定し、タイマBによ
る起動を選択した状態にしておく。上記の起動要因が発
生しない状態ではA/D変換器は待機状態となってい
る。
The central processing unit CPU activates the A / D converter at both the compare match with the cycle setting register of the channel 3 of the timer B and the underflow of the channel 4. The central processing unit CPU sets the control register for the input channels AIN2, 3 and keeps the activation by the timer B selected. The A / D converter is in a standby state when the above-mentioned activation factor does not occur.

【0134】チャンネル3のコンペアマッチA3及びチ
ャンネル4のアンダーフローの論理和信号が、A/D変
換器の起動信号としてタイマからA/D変換器に与えら
れる。上記の選択した起動信号が発生すると、アナログ
マルチプレクサ制御信号4Aと5Bが同時に活性状態に
なり、AIN2とAIN3の入力信号がそれぞれ同時に
サンプルホールド・レベルシフト回路AとBに蓄積され
る。その後に、順次にA/D変換動作AとBが行われ、
上記入力信号AIN2とAIN3のA/D変換結果がデ
ータレジスタに格納される。これによって、モータの駆
動電流を計測することができる。これらを同時にサンプ
リングしているので、相対的な電流値を正確に計測する
ことができる。また、これによって、3相目の電流値の
計算結果も正確になる。
A logical sum signal of compare match A3 of channel 3 and underflow of channel 4 is given from the timer to the A / D converter as a start signal of the A / D converter. When the selected start signal is generated, the analog multiplexer control signals 4A and 5B are activated at the same time, and the input signals of AIN2 and AIN3 are simultaneously stored in the sample hold level shift circuits A and B, respectively. After that, A / D conversion operations A and B are sequentially performed,
The A / D conversion result of the input signals AIN2 and AIN3 is stored in the data register. Thereby, the drive current of the motor can be measured. Since these are sampled at the same time, the relative current value can be accurately measured. Further, this also makes the calculation result of the current value of the third phase accurate.

【0135】図30には、上記タイマBとA/D変換器
の他の動作の一例を説明するためのタイミング図が示さ
れている。タイマBは、上記同様に2本のアップダウン
カウンタTCNT3とTCNT4が0、タイマB内の周
期設定レジスタGRAとの間をアップ/ダウンの計数動
作を行う。上記同様に、これらのカウンタTCNT3,
4とコンペアレジスタUとのコンペアマッチによって、
タイマ出力U、U#を出力する。U,U#は、互いに相
補ノーオーバーラップの関係にあるPWM出力となる。
同様に、図示されないコンペアレジスタV,Wとのコン
ペアマッチによってタイマ出力V,V#とW,W#を出
力する。
FIG. 30 shows a timing chart for explaining another example of the operation of the timer B and the A / D converter. Similarly to the above, the timer B performs the up / down counting operation between the two up / down counters TCNT3 and TCNT4 being 0 and the period setting register GRA in the timer B. Similar to the above, these counters TCNT3,
By a compare match between 4 and the compare register U,
The timer outputs U and U # are output. U and U # are PWM outputs having a complementary no-overlap relationship with each other.
Similarly, timer outputs V, V # and W, W # are output by a compare match with a compare register V, W (not shown).

【0136】A/D変換器は、上記同様にタイマBのチ
ャンネル3の周期設定レジスタとのコンペアマッチ及び
チャンネル4のアンダーフローの両方でA/D変換器を
起動するようにする。A/D変換器は、制御レジスタを
入力チャンネルAIN2,3に設定し、タイマBによる
起動を選択した状態にしておく。上記の起動要因が発生
しない状態ではA/D変換器は待機状態となっている。
Similarly to the above, the A / D converter activates the A / D converter by both the compare match with the cycle setting register of the channel 3 of the timer B and the underflow of the channel 4. The A / D converter sets the control register to the input channels AIN2 and AIN3 and keeps the activation by the timer B selected. The A / D converter is in a standby state when the above-mentioned activation factor does not occur.

【0137】チャンネル3のコンペアマッチA3及びチ
ャンネル4のアンダーフローの論理和信号が、A/D変
換器の起動信号としてタイマからA/D変換器に与えら
れる。上記の選択した起動信号が発生すると、上記同様
にして上記入力信号AIN2とAIN3のA/D変換結
果がデータレジスタに格納される。これによって、モー
タの駆動電流を計測することができる。
A logical sum signal of compare match A3 of channel 3 and underflow of channel 4 is given from the timer to the A / D converter as a start signal of the A / D converter. When the selected start signal is generated, the A / D conversion result of the input signals AIN2 and AIN3 is stored in the data register in the same manner as described above. Thereby, the drive current of the motor can be measured.

【0138】そのほか、タイマAのコンペアマッチなど
によって、一定時間毎にA/D変換器のそのほかの入力
アナログ信号を変換したい場合には、前記タイマAのコ
ンペアマッチ割り込みで、中央処理装置CPUに割り込
み処理を行わせる。この割り込み処理によって、中央処
理装置CPUはA/D変換器の制御レジスタを再設定し
て、所望のアナログ入力を変換することにより、そのほ
かのセンサ情報などを入力することができる。この結果
を、例えば中央処理装置CPUはパラメータ情報とし
て、所望の処理を行い、以降のタイマ出力値の設定に反
映させる。かかるA/D変換処理の終了後は、制御レジ
スタをタイマBのチャンネル3の周期設定レジスタとの
コンペアマッチ及びチャンネル4のアンダーフローの両
方でA/D変換器を起動するようしておくことにより、
上記入力信号AIN2とAIN3からのモータ駆動電流
に対応したA/D変換結果を得ることができる。このよ
うにして、1つのA/D変換器で、PWM出力に同期し
たモータ電流の計測と、そのほかのアナログ入力の変換
を行うことができる。
In addition, when it is desired to convert other input analog signals of the A / D converter at regular time intervals by a timer A compare match or the like, the central processing unit CPU is interrupted by the timer A compare match interrupt. Let the process take place. By this interrupt processing, the central processing unit CPU can reset the control register of the A / D converter and convert a desired analog input to input other sensor information and the like. The central processing unit CPU performs the desired processing as parameter information, for example, and reflects the result in the subsequent setting of the timer output value. After the completion of the A / D conversion process, the control register is activated by both the compare match with the cycle setting register of the channel 3 of the timer B and the underflow of the channel 4. ,
It is possible to obtain an A / D conversion result corresponding to the motor drive current from the input signals AIN2 and AIN3. In this way, one A / D converter can perform measurement of the motor current synchronized with the PWM output and conversion of other analog inputs.

【0139】図31には、上記シングルチップマイクロ
コンピュータの動作を説明するためのフローチャート図
が示されている。(A)において、リセットを解除する
と、マイクロコンピュータの初期化が行われる。この初
期化は、前記タイマITU、A/D変換器、データ転送
装置DTC、I/Oポートなどの初期化を含むものであ
る。A/D変換器は、タイマITUのトリガに従って入
力チャンネルをAIN2,AIN3を変換するように設
定される。タイマAは、インターバルタイマとして動作
を開始させる。
FIG. 31 is a flow chart for explaining the operation of the above single chip microcomputer. When the reset is released in (A), the microcomputer is initialized. This initialization includes initialization of the timer ITU, A / D converter, data transfer device DTC, I / O port and the like. The A / D converter is set to convert the input channels AIN2 and AIN3 according to the trigger of the timer ITU. The timer A starts operating as an interval timer.

【0140】上記初期化が終了すると、モータの起動要
求待ち状態になる。モータの起動要求は、例えば上位の
中央処理装置CPUから入出力ポートを介したりして与
えられる。起動要求が発生すると、所望の処理に従っ
て、コンペア値を算出し、これをRAM上の第1の領域
に配置する。
When the above initialization is completed, a motor start request waiting state is entered. The request for starting the motor is given from, for example, the host CPU CPU via the input / output port. When a start request is generated, a compare value is calculated according to a desired process, and the compare value is arranged in the first area on the RAM.

【0141】タイマITUを起動する。タイマ出力が行
われ、割り込み待ち状態になる。図29のコンペアマッ
チ信号に対応したIMIA3割り込み(山;周期T0,
T2)あるいはアンダーフロー信号に対応したUVI4
割り込み(谷;周期T1)が発生すると、A/D変換器
に起動信号が与えられて、自動的またはハードウェア的
に初期設定に従って入力チャンネル2と3のA/D変換
が行われる。また、上記IMIA3割り込み(山)ある
いは上記UVI4割り込み(谷)によって、データ転送
装置DTCが起動され、前記RAM上の所定のアドレス
からタイマITUのバッファレジスタ(TGB、DRG
C、TRGD)にコンペア値が転送され、PWMのデュ
ーティが変更される。
Start the timer ITU. Timer output is performed, and the state is waiting for an interrupt. The IMIA3 interrupt corresponding to the compare match signal of FIG. 29 (mountain; cycle T0,
T2) or UVI4 corresponding to underflow signal
When an interrupt (valley; cycle T1) occurs, a start signal is given to the A / D converter, and A / D conversion of the input channels 2 and 3 is performed automatically or according to the initial setting by hardware. Further, the data transfer device DTC is activated by the IMIA3 interrupt (peak) or the UVI4 interrupt (valley), and the buffer register (TGB, DRG) of the timer ITU is started from a predetermined address on the RAM.
The compare value is transferred to (C, TRGD) and the PWM duty is changed.

【0142】中央処理装置CPUの割り込み処理ルーチ
ンによって、A/D変換器の変換結果をリードして、2
相分のモータ駆動電流を得る。また、これに基づいて3
相目のモータ駆動電流が計算される。そのほか、予めR
AM上の第2の領域に保持していたセンサ回路の入力値
をリードする。上記及び図示されていないものの、速度
指令やモータの位置・速度、モータ駆動電流、そのほか
センサの入力値を参照して、所望の処理を行って新しい
コンペア値を計算する。これをRAM上の第1の領域に
配置する。
By the interrupt processing routine of the central processing unit CPU, the conversion result of the A / D converter is read and 2
Obtain the motor drive current for each phase. Also, based on this, 3
The motor drive current of the phase is calculated. In addition, R in advance
The input value of the sensor circuit held in the second area on the AM is read. Although not shown in the above and not shown, a new compare value is calculated by performing desired processing with reference to the speed command, the position / speed of the motor, the motor drive current, and other input values of the sensor. This is arranged in the first area on the RAM.

【0143】(B)のように、タイマAのインターバル
割り込みが発生すると、A/D変換器の設定値変更を行
い、ソフトウェアの起動によって、モータ駆動電流以外
の、センサの入力値をA/D変換する。変換された結果
は、RAM上の第2領域に保持させる。A/D変換器の
設定をもとの状態に戻してリターンする。
As shown in (B), when the interval interrupt of the timer A occurs, the setting value of the A / D converter is changed and the input value of the sensor other than the motor drive current is changed to A / D by starting the software. Convert. The converted result is held in the second area on the RAM. The setting of the A / D converter is returned to the original state and the process returns.

【0144】図33には、この発明に係るシングルチッ
プマイクロコンピュータを用いた他の制御システムの一
実施例のブロック図が示されている。同図のシングルチ
ップマイクロコンピュータMCUは、図1に示されたシ
ングルチップマイクロコンピュータが用いられる。同図
の制御システムは、上記シングルチップマイクロコンピ
ュータを用いて、カメラのレンズ部の自動焦点制御に向
けられている。
FIG. 33 is a block diagram showing another embodiment of the control system using the single chip microcomputer according to the present invention. The single chip microcomputer MCU shown in FIG. 1 uses the single chip microcomputer shown in FIG. The control system in the figure is directed to automatic focus control of the lens portion of the camera by using the single chip microcomputer.

【0145】レンズ及びハーフミラーなどを通して得ら
れた入力光は、CCD(電荷移送素子)あるいはBAS
ISなどの光電変換素子で電気信号に変換される。かか
る光電変換素子の出力は、増幅器やバッファなど等を含
むインターフェイス回路を通してアナログ入力としてA
IN0に入力される。また、上記インターフェイス回路
が出力するトリガ信号ADTRGを外部トリガ端子を介
して入力する。マイクロコンピュータからのBUSY信
号をインターフェイス回路内の論理ゲート回路に与え
て、A/D変換結果が処理されていない状態では、光電
変換されたデータ(AIN0)がシングルチップマイク
ロコンピュータMCUに供給されることを中断するよう
に指示する。インターフェイス回路は、光電変換素子の
変換や読み出しの制御を行う。例えば、2次位相差検出
方式で焦点の一致、不一致を検出する。
The input light obtained through the lens and the half mirror is CCD (charge transfer device) or BAS.
It is converted into an electric signal by a photoelectric conversion element such as IS. The output of the photoelectric conversion element is an analog input through an interface circuit including an amplifier, a buffer, etc.
Input to IN0. Further, the trigger signal ADTRG output from the interface circuit is input through the external trigger terminal. The BUSY signal from the microcomputer is given to the logic gate circuit in the interface circuit, and the photoelectrically converted data (AIN0) is supplied to the single-chip microcomputer MCU when the A / D conversion result is not processed. Instruct to suspend. The interface circuit controls conversion and reading of the photoelectric conversion element. For example, the secondary phase difference detection method is used to detect whether or not the focal points match.

【0146】この実施例のマイクロコンピュータMCU
は、レンズマイクロコンピュータL−MCUに対して指
令を出力し、レンズのAFモータを駆動するようにさせ
る。上記のL−MCUに対する指令は、シリアルコミュ
ニケーションインターフェイスSCIにより行うように
してもよいし、2相エンコーダパルスのようなものであ
ってもよいし、あるいはその他のディジタル出力で行う
ようにしてもよい。また、AFモータのエンコーダ入力
をタイマBのクロック入力(TCLKA,TCLKB)
に入力して、AFモータの速度/位置を検出する。これ
らをモニタしつつ、AFモータを駆動する。
Microcomputer MCU of this embodiment
Outputs a command to the lens microcomputer L-MCU to drive the lens AF motor. The above-mentioned command to the L-MCU may be issued by the serial communication interface SCI, a two-phase encoder pulse, or any other digital output. Also, the encoder input of the AF motor is the clock input of the timer B (TCLKA, TCLKB)
To detect the speed / position of the AF motor. The AF motor is driven while monitoring these.

【0147】上記シリアルコミュニケーションインター
フェイスSCIや入出力ポートを介して、メインマイク
ロコンピュータM−MCUやレンズマイクロコンピュー
タL−MCU、さらにはEEPROM(エレクトリカリ
・イレーザブル&プログラマブル・リード・オンリー・
メモリ)との通信を行う。EEPROMは、各種の制御
情報を格納する。例えば、EEPROMには、光電変換
素子毎の受光感度を補正するためのデータを格納してお
く。かかる補正によりAF精度を向上させることができ
る。メインマイクロコンピュータM−MCUからは、動
作モードの指令や焦点検出の開始の指令を入力したり、
焦点検出の完了を通知したりする。そのほか、ポートの
出力によって、LED(発光ダイオード)を駆動した
り、焦点検出時の補助光などのランプを点灯したりその
ほか各種スイッチ類などの入力をおこなったりする。
Through the serial communication interface SCI and the input / output port, the main microcomputer M-MCU, the lens microcomputer L-MCU, and further the EEPROM (electrically erasable & programmable read only
Memory). The EEPROM stores various control information. For example, the EEPROM stores data for correcting the light receiving sensitivity of each photoelectric conversion element. AF accuracy can be improved by such correction. From the main microcomputer M-MCU, input operation mode command and focus detection start command,
Notifies the completion of focus detection. In addition, the output of the port drives an LED (light emitting diode), lights a lamp such as auxiliary light at the time of focus detection, and inputs various switches.

【0148】A/D変換器は、セレクト・シングルモー
ド、バッファ動作、かつ外部トリガによる変換開始を選
択する。変換終了割り込みによって、データ転送装置D
TCを起動し、変換結果をRAM上に退避させる。図3
2(A)に示すように、外部トリガADTRGに所定の
信号が発生すると、内部クロックφに同期化されてAD
STセット信号が発生され、その後半クロック遅れてA
DSTビットが“1”にセットされ、A/D変換動作が
開始する。
The A / D converter selects select / single mode, buffer operation, and conversion start by an external trigger. By the conversion end interrupt, the data transfer device D
The TC is activated and the conversion result is saved in the RAM. FIG.
As shown in FIG. 2 (A), when a predetermined signal is generated in the external trigger ADTRG, AD is synchronized with the internal clock φ.
The ST set signal is generated and delayed by the latter half clock A
The DST bit is set to "1" and the A / D conversion operation starts.

【0149】これに対して、前記のようなモータ駆動の
ような場合には、図32(B)に示すように、内部クロ
ックφに同期してコンペアマッチ信号又はアンダーフロ
ー信号が発生され、次のクロックによりADSTセット
信号が発生され、上記同様に半クロック遅れてADST
ビットが“1”にセットされ、A/D変換動作が開始さ
れる。
On the other hand, in the case of driving the motor as described above, a compare match signal or an underflow signal is generated in synchronization with the internal clock φ as shown in FIG. The ADST set signal is generated by the clock of the
The bit is set to "1" and the A / D conversion operation is started.

【0150】上記A/D変換動作が終了すると、変換結
果がデータレジスタADDRAに格納され、上記ADS
Tビットが“0”にクリアされて、変化待機状態にな
る。次の外部トリガ信号ADTRGが発生すると、上記
同様にADSTビットが“1”にセットされ、AIN0
の入力がA/D変換される。変換が終了すると、前記の
ようなバッファ動作によってデータレジスタADDRA
の内容がADDRBに転送され、上記変換結果がADD
RAに格納される。同様にして、4回の外部トリガ信号
ADTRGによって、4回のA/D変換動作が行われて
データレジスタADDRA〜ADDRDに変換結果が格
納されると、ADFビットが“1”にセットされて変換
終了割り込みが発生(コントロールロジックから割り込
み信号ADIが出力される)する。
When the A / D conversion operation is completed, the conversion result is stored in the data register ADDRA, and the ADS
The T bit is cleared to "0", and the change standby state is entered. When the next external trigger signal ADTRG is generated, the ADST bit is set to "1" and AIN0
Input is A / D converted. When the conversion is completed, the data register ADDRA is processed by the buffer operation as described above.
Is transferred to ADDRB and the conversion result is ADD
Stored in RA. Similarly, when the A / D conversion operation is performed four times by the external trigger signal ADTRG four times and the conversion result is stored in the data registers ADDRA to ADDRD, the ADF bit is set to “1” and the conversion is performed. An end interrupt is generated (an interrupt signal ADI is output from the control logic).

【0151】変換終了割り込みによって、データ転送装
置DTCを起動することにより、ブロック転送モードで
4回分の変換結果がRAM上に退避される。これを所望
の回数(DTCのカウンタに設定された回数)繰り返す
と、中央処理装置CPUはこれらの情報をまとめて処理
する。A/D変換結果のデータアライメントを読み出す
時にハードウェア的に行うようにすることにより、A/
D変換結果と、前記補正データを演算するような場合
に、ソフトウェアでアライメントを行う必要がなく、ソ
フトフェアの負担の軽減と、高速化を図ることができ
る。前記処理によって得られた、デフォーカス量を、レ
ンズのマイクロコンピュータL−MCUなどとの通信で
えられたレンズ情報により、AFモータの移動量(回連
量)に換算する。例えば、A/D変換器によって入力さ
れるデータの量が200個などとすれば、データ転送装
置DTCの転送回数は50回になる。
When the data transfer device DTC is activated by the conversion end interrupt, the conversion results for four times in the block transfer mode are saved in the RAM. When this is repeated a desired number of times (the number of times set in the DTC counter), the central processing unit CPU collectively processes these pieces of information. When the data alignment of the A / D conversion result is read out by hardware,
When calculating the D conversion result and the correction data, it is not necessary to perform alignment by software, and the burden on the software can be reduced and the speed can be increased. The defocus amount obtained by the above processing is converted into a moving amount (continuous amount) of the AF motor based on the lens information obtained by communication with the lens microcomputer L-MCU or the like. For example, if the amount of data input by the A / D converter is 200, the number of times of transfer by the data transfer device DTC will be 50 times.

【0152】データ転送装置DTCは、RAM上に転送
情報を格納するため、チャンネル数を多くとることがで
きるが、データ転送に先立ってRAM上から転送情報を
リードするなどの処理が必要である。バッファ動作とブ
ロック転送モードを用いることによって、かかるRAM
からの転送情報のリードなどのオーバーヘッドを低減す
ることができ、シングルチップマイクロコンピュータの
全体的な処理速度を向上することができる。例えば、焦
点の動体予測制御などを行う場合は、光電変換素子とA
/D変換器とデータ転送装置DTCによるフォーカスの
検出と、前回の検出結果に基づく、中央処理装置CPU
のフォーカスの演算をオーバーラップして行うような場
合に、上記DTCとCPUとがバス権を取り合って、互
いに制約しあう頻度を低減し、全体的な処理性能を向上
させることができる。
Since the data transfer device DTC stores the transfer information in the RAM, it is possible to increase the number of channels, but it is necessary to read the transfer information from the RAM prior to the data transfer. By using buffer operation and block transfer mode, such RAM
It is possible to reduce the overhead such as reading the transfer information from the device and improve the overall processing speed of the single-chip microcomputer. For example, in the case of performing a moving object predictive control of the focus, the photoelectric conversion element and A
Of the focus by the D / D converter and the data transfer device DTC, and the central processing unit CPU based on the previous detection result
When the calculation of the focus is performed in an overlapping manner, it is possible to reduce the frequency of the DTC and the CPU competing for the bus right, restricting each other, and improving the overall processing performance.

【0153】上記インターフェイス回路は、内部にタイ
ミング回路などを有し、光電変換素子に変換結果の転送
を指示する。BUSY信号が活性状態の場合は、かかる
転送指示を阻止するようにする。
The interface circuit has a timing circuit and the like inside and instructs the photoelectric conversion element to transfer the conversion result. When the BUSY signal is active, the transfer instruction is blocked.

【0154】図34には、上記データ転送装置のブロッ
ク転送モードによるA/D変換器の読み出しのアドレス
マップ図が示されている。データ転送装置DTCは、ソ
ースアドレスレジスタSARにデータレジスタADDR
Aのアドレスを、デスティネーションアドレスレジスタ
DARに変換結果を格納するRAMの先頭アドレスを設
定する。そして、ソース側をブロック領域としたブロッ
ク転送モードを指定する。アドレスカウンタはインクリ
メントを指定する。データサイズはワードサイズを指定
して、10ビット分解能を得る。ブロックカウンタは4
を設定する。転送カウンタは所定の数(N)、例えば前
記例では50を指定する。
FIG. 34 is an address map diagram for reading the A / D converter in the block transfer mode of the data transfer device. The data transfer device DTC includes a data register ADDR in the source address register SAR.
The address of A is set in the destination address register DAR as the start address of the RAM for storing the conversion result. Then, the block transfer mode in which the source side is the block area is designated. The address counter specifies increment. The word size is specified as the data size to obtain 10-bit resolution. Block counter is 4
Set. The transfer counter specifies a predetermined number (N), for example, 50 in the above example.

【0155】A/D変換割り込みを許可し、DTEビッ
トを“1”にセットして、データ転送装置DTCの起動
要求とする。A/D変換器は、AIN0入力をバッファ
動作を使用して変換するようにする。4回のA/D変換
動作が行われると、A/D変換動作終了割り込みによっ
て、データ転送装置DTCが起動され、データレジスタ
ADDRAからRAMの第1のアドレス、データレジス
タADDRBからRAMの第2のアドレスへ、データレ
ジスタADDRCからRAMの第3のアドレスへ、デー
タレジスタADDRDからRAMの第4のアドレスへそ
れぞれ連続してデータ転送する。この後、上記割り込み
要因フラグを自動的に“0”にクリアさせる。これを指
定回数(N)繰り返すと、最後は割り込み要因フクグを
“0”にクリアせず、DTEビットを“0”にクリアし
て、中央処理装置CPUにA/D変換終了割り込みを要
求する。中央処理装置CPUは、全ての変換結果をまと
めて処理することができる。
The A / D conversion interrupt is enabled, the DTE bit is set to "1", and the data transfer device DTC is activated. The A / D converter causes the AIN0 input to be converted using buffering. When the A / D conversion operation is performed four times, the data transfer device DTC is activated by the A / D conversion operation end interrupt, and the data register ADDRA to the first address of the RAM and the data register ADDRB to the second address of the RAM. Data is continuously transferred to the address, from the data register ADDRC to the third address of the RAM, and from the data register ADDRD to the fourth address of the RAM. After that, the interrupt factor flag is automatically cleared to "0". When this is repeated a specified number of times (N), the interrupt factor Fuku is not finally cleared to "0", the DTE bit is cleared to "0", and the central processing unit CPU is requested to issue an A / D conversion end interrupt. The central processing unit CPU can collectively process all the conversion results.

【0156】A/D変換終了割り込み間隔を、80ステ
ート(20ステート×4)以上にできる。データ転送装
置DTCの起動頻度と起動間隔を緩和してオーバーヘッ
ド(RAM上のレジスタ情報をリード/ライトする)を
無くし、また、そのほかのバスマスタとの競合時の制約
を緩和することができる。上記データ転送装置DTCを
使用せず、中央処理装置CPUが割り込み処理などで変
換結果を読み出す場合にも、例外処理やリターン命令な
どのオーバーヘッドを低減することができ、システム全
体のスループットを向上させることができる。
The A / D conversion end interrupt interval can be set to 80 states (20 states × 4) or more. It is possible to relax the activation frequency and the activation interval of the data transfer device DTC to eliminate overhead (read / write register information on the RAM), and to relax constraints during competition with other bus masters. Even when the central processing unit CPU reads the conversion result by interrupt processing or the like without using the data transfer device DTC, overhead such as exception processing and return instruction can be reduced, and the throughput of the entire system is improved. You can

【0157】図35には、上記データ転送装置のブロッ
ク転送モードによるA/D変換器の読み出しのタイミン
グ図が示されている。バッファがフル(データレジスタ
ADDRA−HすべてがA/D変換済データを格納して
いる)になるA/D変換のサンプリング動作を行うと、
BUSY信号を活性状態にするようにしている。データ
転送装置DTC又は中央処理装置CPUが変換結果を読
み出して、ADFフクグを“0”にクリアすると、BU
SY信号は非活性状態になる。
FIG. 35 shows a timing chart of reading of the A / D converter in the block transfer mode of the data transfer device. When the sampling operation of A / D conversion in which the buffer becomes full (all the data registers ADDRA-H store the A / D converted data),
The BUSY signal is activated. When the data transfer device DTC or the central processing unit CPU reads the conversion result and clears ADF Fukugu to “0”, BU
The SY signal becomes inactive.

【0158】外部の例えば、インターフェイス回路がこ
の信号をモニタして、BUSY信号が活性状態の場合
は、光電変換回路を停止したり、ADTRG信号による
トリガを抑止したりすることができる。これによって、
アナログ入力の変換を抜かされてしまったりすることが
ない。また、A/D変換器が動作可能状態にあるときに
は連続して、アナログ入力を与え、A/D変換器が動作
待機状態にあるときには、アナログ入力を与えないよう
にすることによって、アナログ入力を最適化できる。つ
まり、遅い方にチューニングする必要がない。
For example, an external interface circuit monitors this signal, and when the BUSY signal is active, the photoelectric conversion circuit can be stopped or the trigger by the ADTRG signal can be suppressed. by this,
Never lose the analog input conversion. Further, when the A / D converter is in the operable state, the analog input is continuously supplied, and when the A / D converter is in the operation standby state, the analog input is not supplied so that the analog input is not supplied. Can be optimized. In other words, there is no need to tune to the slower one.

【0159】以上の実施例から得られる作用効果は、下
記の通りである。 (1)2ビットずつのフラッシュ変換によって、A/D
変換の高速化を図ることができ、基準電圧生成回路を上
位、中間及び回路のD/A変換器(分圧回路)により分
圧することにより、抵抗の個数を削減して物理的規模の
縮小を図ることができるという効果が得られる。
The operational effects obtained from the above embodiments are as follows. (1) A / D conversion by 2-bit flash conversion
The conversion speed can be increased, and the reference voltage generation circuit is divided by the D / A converters (voltage divider circuits) of the upper, middle, and circuit to reduce the number of resistors and reduce the physical scale. The effect that it can be achieved is obtained.

【0160】(2)2ビットずつのフラッシュ変換を行
って、変換動作の高速化を図ってサンプリング時間と同
等にすることによって、パイプライン動作を有効に利用
することができるという効果が得られる。すなわち、サ
ンプリング精度を低下させないために、サンプリング時
間は一定時間より短縮できなく、変換時間はこれより高
速化してもパイプラインの効果が少ないからである。
(2) By performing flash conversion for every 2 bits to speed up the conversion operation and make it equivalent to the sampling time, the effect that the pipeline operation can be effectively utilized is obtained. That is, the sampling time cannot be shortened below a certain time in order not to lower the sampling accuracy, and the pipeline effect is less effective even if the conversion time is made faster than this.

【0161】(3)A/D変換器がサンプルホールド回
路とコンパレータを複数組有し、第1のステップでは第
1のサンプリングを行い、第2のステップでは上記第1
のサンプルホールド回路とコンパレータを用いた変換を
行い、かつ第2のサンプリングを行い、第3のステップ
では上記第2のサンプルホールド回路とコンパレータを
用いた変換を行い、かつ第3チャンネルの第1のサンプ
リングを行うようにすることによって、A/D変換動作
の開始から、指定した全てのチャンネルの変換を終了す
るまでの時間を短縮させることができるという効果が得
られる。これにより、信号変化の周波数の高い、複数の
アナログ入力の計測精度を向上させることができるとい
う効果が得られる。
(3) The A / D converter has a plurality of sets of sample and hold circuits and comparators, the first step performs the first sampling, and the second step performs the first sampling.
Conversion using the sample-and-hold circuit and the comparator and the second sampling are performed. In the third step, the conversion is performed using the second sample-and-hold circuit and the comparator, and the first sampling of the third channel is performed. By performing the sampling, it is possible to reduce the time from the start of the A / D conversion operation to the end of the conversion of all the designated channels. As a result, it is possible to improve the measurement accuracy of a plurality of analog inputs having a high frequency of signal change.

【0162】(4)変換結果を格納するデータレジスタ
の内容が読み出されていない状態で、BUSY信号を出
力することによって、外部でA/D変換器の動作が検出
できるので、A/D変換器が動作可能状態では順次アナ
ログ入力を行い、A/D変換器が動作不能状態(データ
レジスタがいっぱい)では、アナログ入力を待たせるこ
とができ、最適な動作を行うようにすることができると
いう効果が得られる。これにより、マージンをみて全体
的な処理性能を低下させることがない。
(4) Since the operation of the A / D converter can be detected externally by outputting the BUSY signal when the contents of the data register for storing the conversion result are not read out, the A / D conversion is performed. It is said that the analog input can be sequentially performed when the device is in the operable state, and the analog input can be made to wait when the A / D converter is in the inoperable state (the data register is full), and optimal operation can be performed. The effect is obtained. As a result, the overall processing performance is not deteriorated due to the margin.

【0163】(5)中央処理装置CPU及びデータ転送
装置DTCがデータレジスタを読み出すときのデータサ
イズ(バイト又はワード)を判別して、読み出し分解能
を自動的に選択し、読み出しデータをアライメント(読
み出し最下位ビットをデータバス又はCPUのレジスタ
の最下位ビットにする)することによって、ソフトウェ
アの負担を軽減することができるという効果が得られ
る。これにより、CPUにおいてシフト処理、あるいは
オーバーフローの検出などを行うことが必要無いから、
シングルチップマイクロコンピュータ全体の処理性能を
向上させることができる。
(5) The central processing unit CPU and the data transfer unit DTC determine the data size (byte or word) when reading the data register, automatically select the read resolution, and align the read data. By setting the lower bit to the least significant bit of the data bus or the register of the CPU), the effect of reducing the load on software can be obtained. This eliminates the need for the CPU to perform shift processing or overflow detection.
The processing performance of the entire single-chip microcomputer can be improved.

【0164】(6)PWR=“0”での変換開始(低速
スタート)時では、待機時間後に自動的に変換を開始す
るので、ソフトウェア負担をかけることなく、消費電流
を低減することができる。また、変換終了後に消費電力
の低い状態に戻ることによって更に低消費電力化を図る
ことができるという効果が得られる。
(6) At the time of starting conversion (low speed start) with PWR = "0", the conversion is automatically started after the waiting time, so that the current consumption can be reduced without burdening the software. Further, by returning to the state of low power consumption after the conversion is completed, it is possible to further reduce power consumption.

【0165】(7)PWR=“1”での変換開始(高速
スタート)時では、変換開始指示からサンプリング完了
までの時間を短縮して、測定精度を向上することができ
る。また、変換終了までの時間を短縮して処理性能の向
上を図り、リアルタイム性の向上を実現できる。待機時
間をソフトウェアで設定できるので、待機時間を絶対的
な時間に従って最適化できるという各効果が得られる。
(7) At the time of starting conversion (high speed start) when PWR = “1”, the time from the conversion start instruction to the completion of sampling can be shortened and the measurement accuracy can be improved. Further, it is possible to shorten the time until the end of conversion to improve the processing performance and improve the real-time property. Since the waiting time can be set by software, the waiting time can be optimized according to the absolute time.

【0166】(8)上記の高速スタートと低速スタート
を切り替え可能にすることによって、多様な使用方法に
も対応でき、使い勝手を良くすることができるという効
果が得られる。
(8) By making it possible to switch between the high-speed start and the low-speed start, it is possible to deal with various usages and improve the usability.

【0167】(9)A/D変換器を2個設けることによ
り、基準電圧生成回路やコントロールロジックを共通化
し、物理的規模を縮小することができ、これに伴って消
費電流も低減させることができるという効果が得られ
る。
(9) By providing two A / D converters, the reference voltage generation circuit and the control logic can be made common, the physical scale can be reduced, and the current consumption can be reduced accordingly. The effect of being able to be obtained is obtained.

【0168】(10)中央処理装置の命令実行ステート
数と同等の変換時間でA/D変換の実行を可能にし、変
換結果の読み出しや処理を容易にしてシステム全体の処
理性能を向上させることができるという効果が得られ
る。
(10) The A / D conversion can be executed in a conversion time equivalent to the number of instruction execution states of the central processing unit, the conversion result can be easily read and processed, and the processing performance of the entire system can be improved. The effect of being able to be obtained is obtained.

【0169】(11) シングルチップマイクロコンピ
ュータに内蔵したA/D変換器として、多様な応用に応
えることができ、また、入力チャンネル毎の多様な変換
や読み出しを行うことができるという効果が得られる。
(11) As an A / D converter built in a single-chip microcomputer, various effects can be obtained, and various conversions and readings can be performed for each input channel. .

【0170】以上本発明者よりなされた発明を実施例に
基づき具体的に説明したが、本願発明は前記実施例に限
定されるものではなく、その要旨を逸脱しない範囲で種
々変更可能であることはいうまでもない。例えば、アナ
ログ入力チャンネル数は8チャンネルに限らず、例えば
16チャンネルなどとしてもよい。データレジスタの数
も任意の数とすることができる。動作モードや制御レジ
スタの構成についても種々の変更が可能である。
Although the invention made by the present inventor has been specifically described based on the embodiments, the invention of the present application is not limited to the embodiments and various modifications can be made without departing from the scope of the invention. Needless to say. For example, the number of analog input channels is not limited to 8 and may be 16 or the like. The number of data registers can be arbitrary. Various changes can be made to the operation mode and the configuration of the control register.

【0171】例えば、複数のサンプルホールド回路を設
けなくてもよい。また、読み出しデータ幅は8/16ビ
ットに限定されるものではなく、任意のビット幅を設定
してもよい。ただし、任意のビット幅に対するデータの
出力形式及び出力条件は定めておく必要がある。コント
ロールロジックは、前記のように1回に1つのA/D変
換動作しか行わないから、図2においてコンパレータア
レイを複数のサンプルホールド・レベルシフト回路に共
通に設けるようにしてもよい。つまり、共通のコンパレ
ータアレイに対してスイッチを介してサンプルホールド
・レベルシフト回路の出力を時分割的に伝えるようにし
てもよい。
For example, it is not necessary to provide a plurality of sample hold circuits. The read data width is not limited to 8/16 bits, and any bit width may be set. However, it is necessary to determine the data output format and output conditions for an arbitrary bit width. Since the control logic performs only one A / D conversion operation at a time as described above, the comparator array in FIG. 2 may be commonly provided for a plurality of sample hold / level shift circuits. That is, the output of the sample hold / level shift circuit may be time-divisionally transmitted to the common comparator array via the switch.

【0172】A/D変換動作の高精度化のためには、上
記実施例のようにサンプルホールド・レベルシフト回路
に一対一に対応してコンパレータアレイを設けることが
望ましい。なぜなら、半導体集積回路に形成された比較
的小さな容量値を持つキャパシタに入力信号を保持させ
ているので、かかるキャパシタとコンパレータアレイと
の間の寄生容量の容量値が大きくなると、かかる寄生容
量との電荷分散によって比較される入力信号のレベルが
変化してしまうからである。上記キャパシタの容量値を
大きくすると、その分占有面積が増大するとともに、入
力信号の取り込みに時間がかかり高速サンプリング動作
が妨げられてしまう。また、A/D変換器は、前記のよ
うに2個以上のサンプルホールド回路を持ち、同時サン
プリングを行うことが条件とはされない。つまり、A/
D変換結果を順次に格納させるデータレジスタを備えた
ものであれば何であってもよい。
In order to improve the accuracy of the A / D conversion operation, it is desirable to provide a comparator array in a one-to-one correspondence with the sample hold / level shift circuit as in the above embodiment. Because the input signal is held in the capacitor having a relatively small capacitance value formed in the semiconductor integrated circuit, when the capacitance value of the parasitic capacitance between the capacitor and the comparator array becomes large, This is because the level of the input signal to be compared changes due to the charge dispersion. When the capacitance value of the capacitor is increased, the occupied area increases correspondingly, and it takes time to capture an input signal, which hinders high-speed sampling operation. Further, the A / D converter has two or more sample hold circuits as described above, and simultaneous sampling is not required. That is, A /
It may be anything as long as it has a data register for sequentially storing the D conversion result.

【0173】シングルチップマイクロコンピュータのそ
の他の機能ブロックについても何ら制約されない。タイ
マの構成やデータ転送装置の構成も応用システムに則し
て種々変更可能である。応用システムはモータ制御やカ
メラの自動焦点検出などに限定されないことはいうまで
もない。
There are no restrictions on other functional blocks of the single-chip microcomputer. The configuration of the timer and the configuration of the data transfer device can be variously changed according to the application system. It goes without saying that the application system is not limited to motor control or automatic focus detection of the camera.

【0174】以上の説明では主として本発明者によって
なされた発明をその背景となった利用分野であるシング
ルチップのマイクロコンピュータに適用した場合につい
て説明したが、それに限定されるものではなく、その他
の半導体集積回路装置又はデータ処理装置にも適用可能
であり、本発明は少なくともとCPU等のデータ処理装
置とA/D変換器を内蔵する半導体集積回路装置及びそ
れを用いた制御システムに広く利用できるものである。
In the above description, the case where the invention made by the present inventor is mainly applied to a single-chip microcomputer which is a field of application which is the background of the invention has been described, but the invention is not limited to this and other semiconductors are used. The present invention is also applicable to an integrated circuit device or a data processing device, and the present invention can be widely applied to a semiconductor integrated circuit device including at least a data processing device such as a CPU and an A / D converter and a control system using the same. Is.

【0175】[0175]

【発明の効果】本願において開示される発明のうち代表
的なものによって得られる効果を簡単に説明すれば、下
記の通りである。すなわち、A/D変換器を内蔵した半
導体集積回路装置において、A/D変換器に変換結果を
格納させる複数のデータレジスタを設け、かかる複数の
データレジスタには、A/D変換結果が第1のデータレ
ジスタに格納されるときに、かかる第1のデータレジス
タの保持データが第2のデータレジスタに転送された後
に上記A/D変換結果を取り込む動作モードを設ける。
あるいは、第1のA/D変換結果を第2のデータレジス
タに格納し、第2のA/D変換結果を第2のデータレジ
スタに格納するモードを設ける。上記動作モードにより
データレジスタがA/D変換結果により飽和したときに
はA/D変換器の動作を停止させる。そして、上記動作
ードにおいてデータレジスタの読み出しが終了したとき
に、上記A/D変換器の動作を再開させることにより、
連続して入力された変換結果を逐一中央処理装置やデー
タ転送装置が取り出すことがなく、これらを一括して処
理できるので実質的な処理能力の向上が可能となり、し
かもそれら相互の関係を保持させて処理できる。また、
これらのデータ処理に合わせてA/D変換動作を行わせ
るようにすることができる。
The effects obtained by the typical ones of the inventions disclosed in the present application will be briefly described as follows. That is, in a semiconductor integrated circuit device having a built-in A / D converter, a plurality of data registers for storing the conversion result in the A / D converter are provided, and the plurality of data registers store the A / D conversion result as the first data register. An operation mode for fetching the A / D conversion result after the data held in the first data register is transferred to the second data register when the data is stored in the first data register is provided.
Alternatively, a mode is provided in which the first A / D conversion result is stored in the second data register and the second A / D conversion result is stored in the second data register. When the data register is saturated by the A / D conversion result in the above operation mode, the operation of the A / D converter is stopped. Then, by restarting the operation of the A / D converter when the reading of the data register is completed in the operation mode,
The conversion results input continuously are not taken out by the central processing unit or data transfer unit one by one, but they can be processed in a batch, which makes it possible to substantially improve the processing capability and to maintain the relationship between them. Can be processed. Also,
The A / D conversion operation can be performed in accordance with these data processes.

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

【図1】この発明が適用されたシングルチップのマイク
ロコンピュータの一実施例を示すブロック図である。
FIG. 1 is a block diagram showing an embodiment of a single-chip microcomputer to which the present invention is applied.

【図2】この発明が適用されたシングルチップマイクロ
コンピュータに搭載されるA/D変換器の一実施例を示
すブロック図である。
FIG. 2 is a block diagram showing an embodiment of an A / D converter mounted on a single-chip microcomputer to which the present invention is applied.

【図3】上記A/D変換器の動作を説明するための基本
的タイミング図である。
FIG. 3 is a basic timing diagram for explaining the operation of the A / D converter.

【図4】上記A/D変換器のサブレンジの電圧変換方式
を説明するための電圧分布図である。
FIG. 4 is a voltage distribution diagram for explaining a subrange voltage conversion method of the A / D converter.

【図5】図2におけるコンパレータアレイの概略ブロッ
ク図である。
5 is a schematic block diagram of a comparator array in FIG.

【図6】図2におけるサンプルホールド・レベルシフト
回路の一実施例を示す回路図である。
FIG. 6 is a circuit diagram showing an embodiment of a sample hold / level shift circuit in FIG.

【図7】この発明に係る同時サンプリングによるA/D
変換動作の代表的な一例を説明するためのフローチャー
ト図である。
FIG. 7: A / D by simultaneous sampling according to the present invention
It is a flowchart figure for demonstrating a typical example of conversion operation.

【図8】この発明に係る通常サンプリングによるA/D
変換動作の代表的な一例を説明するためのフローチャー
ト図である。
FIG. 8: A / D by normal sampling according to the present invention
It is a flowchart figure for demonstrating a typical example of conversion operation.

【図9】この発明に係るセレクト・シングルモードを説
明するためのタイミング図である。
FIG. 9 is a timing chart for explaining a select / single mode according to the present invention.

【図10】この発明に係るセレクト・スキャンモードを
説明するためのタイミング図である。
FIG. 10 is a timing chart for explaining a select / scan mode according to the present invention.

【図11】この発明に係るグループ・シングルモードを
説明するためのタイミング図である。
FIG. 11 is a timing diagram for explaining a group / single mode according to the present invention.

【図12】この発明に係るグループ・スキャンモードを
説明するためのタイミング図である。
FIG. 12 is a timing diagram for explaining a group scan mode according to the present invention.

【図13】この発明に係るバッファ動作の一例を説明す
るためのタイミング図である。
FIG. 13 is a timing chart for explaining an example of a buffer operation according to the present invention.

【図14】上記バッファ動作の他の一例を説明するため
のタイミング図である。
FIG. 14 is a timing chart for explaining another example of the buffer operation.

【図15】この発明に係る同時サンプリング動作の一例
を説明するためのタイミング図である。
FIG. 15 is a timing chart for explaining an example of the simultaneous sampling operation according to the present invention.

【図16】この発明に係る同時サンプリング動作の他の
一例を説明するためのタイミング図である。
FIG. 16 is a timing chart for explaining another example of the simultaneous sampling operation according to the present invention.

【図17】この発明に係るインターバル動作を説明する
ためのタイミング図である。
FIG. 17 is a timing chart for explaining an interval operation according to the present invention.

【図18】この発明に係るA/D変換器の動作を説明す
るための概略フローチャート図である。
FIG. 18 is a schematic flowchart for explaining the operation of the A / D converter according to the present invention.

【図19】図2のバスインターフェイスを含む読み出し
制御回路の主要部のブロック図である。
19 is a block diagram of a main part of a read control circuit including the bus interface of FIG.

【図20】上記図2のデータレジスタの相対的なアドレ
スマップ図である。
20 is a relative address map diagram of the data register of FIG. 2;

【図21】図2のバスインターフェイスを含む読み出し
制御をアドレス方式にしたときの制御回路の回路図であ
る。
FIG. 21 is a circuit diagram of a control circuit when the read control including the bus interface of FIG. 2 is an address method.

【図22】この発明に係るワードデータとバイトデータ
のリードを説明するためのビット配置図である。
FIG. 22 is a bit arrangement diagram for explaining reading of word data and byte data according to the present invention.

【図23】図2のデータレジスタADDRA〜ADDR
Dの相互の関係を示す回路構成図である。
FIG. 23 is a diagram showing the data registers ADDRA to ADDR of FIG. 2;
It is a circuit block diagram which shows the mutual relationship of D.

【図24】図2のアナログマルチプレクサの一実施例を
示すブロック図である。
FIG. 24 is a block diagram showing an embodiment of the analog multiplexer of FIG.

【図25】図2のアナログマルチプレクサの他の一実施
例を示すブロック図である。
FIG. 25 is a block diagram showing another embodiment of the analog multiplexer of FIG.

【図26】この発明に係るBUSY出力制御回路の一実
施例を示す回路図である。
FIG. 26 is a circuit diagram showing one embodiment of a BUSY output control circuit according to the present invention.

【図27】この発明に係るA/D変換器の動作を説明す
るためのタイミング図である。
FIG. 27 is a timing chart for explaining the operation of the A / D converter according to the present invention.

【図28】この発明に係るシングルチップマイクロコン
ピュータを用いた制御システムの一実施例を示すブロッ
ク図である。
FIG. 28 is a block diagram showing an embodiment of a control system using the single-chip microcomputer according to the present invention.

【図29】この発明に係るタイマBとA/D変換器の動
作の一例を説明するためのタイミング図である。
FIG. 29 is a timing chart for explaining an example of operations of the timer B and the A / D converter according to the present invention.

【図30】この発明に係るタイマBとA/D変換器の動
作の他の一例を説明するためのタイミング図である。
FIG. 30 is a timing chart for explaining another example of the operations of the timer B and the A / D converter according to the present invention.

【図31】この発明に係るシングルチップマイクロコン
ピュータの動作を説明するためのフローチャート図であ
る。
FIG. 31 is a flow chart diagram for explaining the operation of the single-chip microcomputer according to the present invention.

【図32】この発明に係るA/D変換器の外部入力とタ
イマによる起動動作を説明するためのタイミング図であ
る。
FIG. 32 is a timing chart for explaining an external input of the A / D converter according to the present invention and a starting operation by a timer.

【図33】この発明に係るシングルチップマイクロコン
ピュータを用いた制御システムの他の一実施例を示すブ
ロック図である。
FIG. 33 is a block diagram showing another embodiment of the control system using the single-chip microcomputer according to the present invention.

【図34】この発明に係るデータ転送装置のブロック転
送モードによるA/D変換器の読み出しのアドレスマッ
プ図である。
FIG. 34 is a read address map diagram of the A / D converter in the block transfer mode of the data transfer device according to the present invention.

【図35】この発明に係るデータ転送装置のブロック転
送モードによるA/D変換器の読み出しのタイミング図
である。
FIG. 35 is a timing chart of reading of the A / D converter in the block transfer mode of the data transfer device according to the present invention.

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

CPU…中央処理装置、RAM…ランダム・アクセス・
メモリ、ROM…リード・オンリー・メモリ、SCI…
シリアルコミュニケーションインターフェイス、ITU
…タイマ、DTC…データ転送装置(データトランスフ
ァコントローラ)、CPG…クロック発生回路、IOP
1〜8…入出力ポート、ADDRA〜ADDRH…デー
タレジスタ、ADCR,ADCSR…制御レジスタ、B
IF…バッファ回路、MDB…モジュール内バス、DB
…内部データバス、DDR…データディレクションレジ
スタ、DR…データレジスタ、MCU…シングルチップ
マイクロコンピュータ、L−MCU…レンズマイクロコ
ンピュータ、M−MCU…メインマイクロコンピュー
タ。
CPU: Central processing unit, RAM: Random access
Memory, ROM ... Read-only memory, SCI ...
Serial communication interface, ITU
... Timer, DTC ... Data transfer device (data transfer controller), CPG ... Clock generation circuit, IOP
1-8 Input / output port, ADDRA-ADDRH ... Data register, ADCR, ADCSR ... Control register, B
IF ... Buffer circuit, MDB ... Module bus, DB
... internal data bus, DDR ... data direction register, DR ... data register, MCU ... single-chip microcomputer, L-MCU ... lens microcomputer, M-MCU ... main microcomputer.

───────────────────────────────────────────────────── フロントページの続き (72)発明者 小林 浩之 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 斉藤 博 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 佐藤 光正 東京都小平市上水本町5丁目20番1号 日 立超エル・エス・アイ・エンジニアリング 株式会社内 ─────────────────────────────────────────────────── ─── Continued front page (72) Inventor Hiroyuki Kobayashi 5-20-1, Josuihonmachi, Kodaira-shi, Tokyo Inside the Semiconductor Business Division, Hitachi, Ltd. (72) Hiroshi Saito 5 Sanmizumoto-cho, Kodaira-shi, Tokyo Hitachi Co., Ltd. Semiconductor Division, 20-201-1 (72) Inventor Mitsumasa Sato 5-201-1, Kamimizuhonmachi, Kodaira-shi, Tokyo Within Hiritsuru LSI Engineering Co., Ltd.

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 複数のアナログ入力端子から入力された
アナログ信号の一部又は全部からなる複数のアナログ入
力信号を取り込むサンプルホールド回路と、かかるサン
プルホールド回路に対してサンプリング動作の指示を行
うコントロールロジックと、上記サンプルホールド回路
に取り込まれたアナログ信号をディジタル信号に変換す
るA/D変換部と、上記A/D変換結果を保持する複数
のデータレジスタとを備えたA/D変換器と、 上記A/D変換回路と内部バスを介して接続された中央
処理装置とを備えてなり、 上記複数のデータレジスタは、A/D変換結果が第1の
データレジスタに格納されるときに、かかる第1のデー
タレジスタの保持データを第2のデータレジスタに転送
した後に上記A/D変換結果を取り込む動作モードを備
えてなることを特徴とする半導体集積回路装置。
1. A sample hold circuit for taking in a plurality of analog input signals consisting of a part or all of analog signals inputted from a plurality of analog input terminals, and a control logic for instructing the sample hold circuit to perform a sampling operation. An A / D converter having an A / D conversion unit for converting an analog signal taken into the sample hold circuit into a digital signal; and a plurality of data registers for holding the A / D conversion result, An A / D conversion circuit and a central processing unit connected via an internal bus are provided, and when the A / D conversion result is stored in the first data register, the plurality of data registers are connected to the first data register. An operation mode is provided in which the data held in the first data register is transferred to the second data register and then the A / D conversion result is fetched. The semiconductor integrated circuit device characterized by comprising Te.
【請求項2】 上記複数のデータレジスタは、所定の動
作モードの設定によりそれぞれが独立にA/D変換結果
を格納するような信号入力系もを合わせ持つものである
ことを特徴とする請求項1の半導体集積回路装置。
2. The plurality of data registers also have a signal input system for respectively storing the A / D conversion result independently by setting a predetermined operation mode. 1. A semiconductor integrated circuit device.
【請求項3】 上記サンプルホールド回路は少なくとも
2個設けられ、上記コントロールロジックにより第1動
作により第1のサンプルホールド回路に取り込まれた第
1の入力信号を上記A/D変換部でディジタル信号に変
換する動作と並行して第2の入力信号を第2のサンプリ
ングホールド回路がサンプリング動作を行う第2動作
と、 上記第2動作により第2のサンプルホールド回路に取り
込まれた第2の入力信号を上記A/D変換部でディジタ
ル信号に変換する動作と並行して第3の入力信号を第1
のサンプリングホールド回路がサンプリング動作を行う
第3動作と、 上記第3動作により第1のサンプルホールド回路に取り
込まれた第3の入力信号を上記A/D変換部でディジタ
ル信号に変換する第4動作とが行われ、 上記動作モードの設定により第1と第3の変換結果を一
方の第1のデータレジスタと第2のデータレジスタに格
納し、上記第2と第4の変換結果を他方の第1のデータ
レジスタと第2のデータレジスタに順次格納させること
を特徴とする請求項2の半導体集積回路装置。
3. At least two sample-hold circuits are provided, and the first input signal taken into the first sample-hold circuit by the first operation by the control logic is converted into a digital signal by the A / D converter. The second operation in which the second sampling and holding circuit performs sampling operation on the second input signal in parallel with the operation of converting, and the second input signal taken into the second sample and holding circuit by the second operation In parallel with the operation of converting into a digital signal in the A / D converter, the first input signal is applied to the third input signal.
Third operation in which the sampling and holding circuit performs a sampling operation, and a fourth operation in which the A / D conversion unit converts the third input signal taken into the first sample and hold circuit by the third operation into a digital signal. And the first and third conversion results are stored in one of the first data register and the second data register by the operation mode setting, and the second and fourth conversion results are stored in the other first data register. 3. The semiconductor integrated circuit device according to claim 2, wherein the data is sequentially stored in the first data register and the second data register.
【請求項4】 上記動作モードにおいて複数のデータレ
ジスタの全てにA/D変換結果が格納されたときに、上
記A/D変換器の動作を停止させることを特徴とする請
求項1、請求項2又は請求項3の半導体集積回路装置。
4. The operation of the A / D converter is stopped when the A / D conversion result is stored in all of the plurality of data registers in the operation mode. The semiconductor integrated circuit device according to claim 2 or claim 3.
【請求項5】 上記動作モードにおいて複数のデータレ
ジスタの全てにA/D変換結果が格納されたときに、上
記タレジスタに格納されたA/D変換結果の読み出しを
指示する割り込み信号を発生させ、かかる割り込み処理
によりデータレジスタの読み出しが終了すると、上記A
/D変換器の動作を再開させるようにしてなることを特
徴とする請求項4の半導体集積回路装置。
5. When an A / D conversion result is stored in all of the plurality of data registers in the operation mode, an interrupt signal for instructing reading of the A / D conversion result stored in the data register is generated, When the reading of the data register is completed by such interrupt processing, the above A
The semiconductor integrated circuit device according to claim 4, wherein the operation of the / D converter is restarted.
【請求項6】 複数のアナログ入力端子から入力された
アナログ信号を選択的に取り込むサンプルホールド回路
と、上記サンプルホールド回路に取り込まれたアナログ
信号をディジタル信号に変換するA/D変換部及び変換
されたディジタル信号を格納する複数のデータレジスタ
とを備えたA/D変換器と、中央処理装置と、データ転
送装置と、バッファメモリと、上記A/D変換器と中央
処理装置、データ転送装置及びバッファメモリを相互に
接続させる内部バスが設けられてなる半導体集積回路装
置と、 上記半導体集積回路装置からの制御信号により制御され
てアナログ信号を形成するセンサと、 上記半導体集積回路装置からの制御信号により制御され
て上記アナログ信号を上記A/D変換器に供給するイン
ターフェイス回路とを含み、 上記半導体集積回路装置は、1ないし複数からなるアナ
ログ信号のA/D変換結果をデータレジスタに格納し、
指定されたデータレジスタに変換結果が格納されると、
上記データ転送装置を起動して上記データレジスタに格
納された変換結果をバッファメモリに退避させ、指定さ
れた回数のデータ転送が起動されると中央処理装置に対
して割り込みを要求する処理が行われることを特徴とす
る制御システム。
6. A sample hold circuit for selectively capturing analog signals input from a plurality of analog input terminals, an A / D conversion unit for converting the analog signal captured by the sample hold circuit into a digital signal, and a converted signal. A / D converter having a plurality of data registers for storing digital signals, a central processing unit, a data transfer device, a buffer memory, the A / D converter and the central processing unit, a data transfer device, and A semiconductor integrated circuit device having an internal bus for connecting buffer memories to each other, a sensor controlled by a control signal from the semiconductor integrated circuit device to form an analog signal, and a control signal from the semiconductor integrated circuit device And an interface circuit controlled by the above-mentioned to supply the analog signal to the A / D converter, The semiconductor integrated circuit device stores the A / D conversion result of one or more analog signals in a data register,
When the conversion result is stored in the specified data register,
The data transfer device is activated to save the conversion result stored in the data register in the buffer memory, and when the designated number of times of data transfer is activated, a process of requesting an interrupt to the central processing unit is performed. A control system characterized by the above.
【請求項7】 上記半導体集積回路装置は、A/D変換
結果を格納するデータレジスタに空きの無いことを示す
信号を上記インターフェイス回路に供給し、かかる信号
に基づいて上記センサの動作を停止させることを特徴と
する請求項6の制御システム。
7. The semiconductor integrated circuit device supplies a signal indicating that there is no space in a data register for storing an A / D conversion result to the interface circuit, and stops the operation of the sensor based on the signal. 7. The control system according to claim 6, wherein:
JP7085929A 1995-03-20 1995-03-20 Semiconductor integrated circuit device and control system Withdrawn JPH08265156A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7085929A JPH08265156A (en) 1995-03-20 1995-03-20 Semiconductor integrated circuit device and control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7085929A JPH08265156A (en) 1995-03-20 1995-03-20 Semiconductor integrated circuit device and control system

Publications (1)

Publication Number Publication Date
JPH08265156A true JPH08265156A (en) 1996-10-11

Family

ID=13872456

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7085929A Withdrawn JPH08265156A (en) 1995-03-20 1995-03-20 Semiconductor integrated circuit device and control system

Country Status (1)

Country Link
JP (1) JPH08265156A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012134717A (en) * 2010-12-21 2012-07-12 Renesas Electronics Corp Semiconductor device
JP2013191976A (en) * 2012-03-13 2013-09-26 Renesas Electronics Corp Integrated circuit
JP2017077020A (en) * 2016-12-20 2017-04-20 ルネサスエレクトロニクス株式会社 Integrated circuit
CN110535468A (en) * 2018-05-23 2019-12-03 中车株洲电力机车研究所有限公司 A kind of management and running collecting method and data collection system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012134717A (en) * 2010-12-21 2012-07-12 Renesas Electronics Corp Semiconductor device
US9094037B2 (en) 2010-12-21 2015-07-28 Renesas Electronics Corporation Semiconductor device
US9286250B2 (en) 2010-12-21 2016-03-15 Renesas Electronics Corporation Semiconductor device
JP2013191976A (en) * 2012-03-13 2013-09-26 Renesas Electronics Corp Integrated circuit
JP2017077020A (en) * 2016-12-20 2017-04-20 ルネサスエレクトロニクス株式会社 Integrated circuit
CN110535468A (en) * 2018-05-23 2019-12-03 中车株洲电力机车研究所有限公司 A kind of management and running collecting method and data collection system
CN110535468B (en) * 2018-05-23 2023-05-12 中车株洲电力机车研究所有限公司 Scheduling management data acquisition method and data acquisition system

Similar Documents

Publication Publication Date Title
JP3565613B2 (en) Semiconductor integrated circuit device
US7660968B2 (en) Reconfigurable interface for coupling functional input/output blocks to limited number of I/O pins
JP3687861B2 (en) Control system and method for forming complementary non-overlapping PWM signals
US7830286B2 (en) AD converter and data processing unit
JP2003218687A5 (en)
JP2002043942A (en) Analog/digital converter
KR0185591B1 (en) Automatic a/d converter operation with selectable result format
JPH08265156A (en) Semiconductor integrated circuit device and control system
US8643523B1 (en) Sharing embedded ADC resources across hardware and software sample-conversion queues with improved availability of the resources
CN110045911B (en) Analog-to-digital conversion control circuit and singlechip analog-to-digital conversion circuit
US6831583B1 (en) Integrated circuit comprising a microprocessor and an analogue to digital converter which is selectively operable under the control of the microprocessor and independently of the microprocessor, and a method for operating the integrated circuit
CN109405993B (en) Temperature detection circuit
JPH08272765A (en) Semiconductor integrated circuit and motor driving control circuit
US5087915A (en) Semiconductor integrated circuit device with analog to digital converter
US9286250B2 (en) Semiconductor device
JP2002049443A (en) Inside voltage reduction control system
JPH08111641A (en) Comparator, a/d converter, pwm signal generator, power source device and power source controller
CN115328386B (en) ADC module control architecture based on time slot control
JP3967535B2 (en) Analog / digital converter
US20240088908A1 (en) Analog-to-digital converter (adc) auto-sequential canning with expansion multiplexer(s) and auxiliary circuit configuration control(s)
JP3298908B2 (en) Analog-to-digital converter
CN115865092A (en) Analog-digital conversion controller, control method and system
SU1012346A1 (en) Device for regenerating information in dynamic memory
JPH05252039A (en) Multi-channel d/a converter of 3-line serial data transfer system
JPH09321624A (en) Semiconductor integrated circuit

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20020604