JPH0573698A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0573698A
JPH0573698A JP3234243A JP23424391A JPH0573698A JP H0573698 A JPH0573698 A JP H0573698A JP 3234243 A JP3234243 A JP 3234243A JP 23424391 A JP23424391 A JP 23424391A JP H0573698 A JPH0573698 A JP H0573698A
Authority
JP
Japan
Prior art keywords
adder
data
counter
microcomputer
converter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP3234243A
Other languages
Japanese (ja)
Inventor
Kazuo Akeda
和夫 明田
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.)
NEC IC Microcomputer Systems Co Ltd
Original Assignee
NEC IC Microcomputer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC IC Microcomputer Systems Co Ltd filed Critical NEC IC Microcomputer Systems Co Ltd
Priority to JP3234243A priority Critical patent/JPH0573698A/en
Publication of JPH0573698A publication Critical patent/JPH0573698A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To shorten the calculating time of average value data by calculating average value data of an AD conversion data with an AD converter incorporated in a microcomputer with a hardware incorporated in the microcomputer. CONSTITUTION:The system is provided with the AD converter 1, an adder 2 adding AD conversion data, a counter 3 counting the number of adding times, a register 5 setting the N value of an N times average value, a comparator 4 comparating the value of the counter 3 with the register 5 to output an signal, a selector 6 selecting average data from the adder 2, a latching circuit 7 latching the output signal of the selector 6, and a control part 8 controlling the AD converter 1, the adder 2 and the counter 3.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はマイクロコンピュータに
関し、特に入力データの平均値算出機構を有するA/D
コンバータを内蔵したマイクロコンピュータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer, and more particularly to an A / D having an input data average value calculation mechanism.
The present invention relates to a microcomputer including a converter.

【0002】[0002]

【従来の技術】各種の電子機器に於いて、マイクロコン
ピュータは、各種のセンサ入力信号を演算し、出力する
機能を達成するために、A/Dコンバータを内蔵してい
る。しかし、機器の高性能化や小型化等の要求により、
高速化,入力信号の増大などが必要となっている。
2. Description of the Related Art In various electronic devices, a microcomputer has a built-in A / D converter in order to achieve the function of calculating and outputting various sensor input signals. However, due to the demand for high performance and miniaturization of equipment,
Higher speeds and increased input signals are needed.

【0003】従来のマイクロコンピュータに内蔵されて
いるA/Dコンバータは、A/D変換値から平均値の算
出をプログラムの命令でおこなうことにより実現してい
た。
An A / D converter built in a conventional microcomputer has been realized by calculating an average value from A / D converted values by a program instruction.

【0004】例えば、図3のフローに示したように、A
/D変換値を加算し、加算回数がN回になれば、加算値
をNで割算して平均値を格納する。
For example, as shown in the flow chart of FIG.
The / D converted value is added, and when the number of times of addition reaches N, the added value is divided by N and the average value is stored.

【0005】図3において、まずA/D変換データを1
回加算し(処理20)、次にN回加算したか否か判断し
(処理21)、加算した場合には処理22へ、加算して
いない場合は処理26に移行する。処理22では、加算
データをNで割る。処理23ではデータを格納して、終
了となる。
In FIG. 3, first, the A / D conversion data is set to 1
After addition (process 20), it is determined whether or not N times have been added (process 21). If the addition has been made, the process proceeds to process 22, and if not, the process proceeds to process 26. In process 22, the added data is divided by N. In process 23, the data is stored and the process ends.

【0006】ここで、標準的な8ビットのマイクロコン
ピュータの実行時間は、処理20,21が15μs,処
理22が4μs,処理23が5μsである。
Here, the execution time of a standard 8-bit microcomputer is 15 μs for processes 20 and 21, 4 μs for process 22, and 5 μs for process 23.

【0007】一例として、図3のフローをN−4とし
て、1命令実行時間0.8μsの8ビットマイクロコン
ピュータのプログラム命令でおきかえると、84μsも
処理時間がかかってしまう。
As an example, if the flow of FIG. 3 is set to N-4 and it is replaced by a program instruction of an 8-bit microcomputer having an instruction execution time of 0.8 μs, it takes 84 μs.

【0008】従って、マイクロコンピュータの命令実行
時間の高速化が、アーキテクチャの改善や半導体プロセ
スの進展によって進んでいるが、応用機器のニーズは、
より高速性を望んでいる。例えばインバータ制御等がそ
の代表である。
Therefore, although the instruction execution time of the microcomputer is being accelerated by the improvement of the architecture and the progress of the semiconductor process, the needs of the applied equipment are
I want higher speed. For example, inverter control is a typical example.

【0009】[0009]

【発明が解決しようとする課題】このような従来のマイ
クロコンピュータでは、A/D変換データのN回平均値
を得るために、プログラムの命令により加算と割算を行
うことで実現していた。
In such a conventional microcomputer, in order to obtain the average value of the A / D converted data N times, the addition and division are performed by the instruction of the program.

【0010】そのため、8ビットマイクロコンピュータ
で約80μsの処理時間がかかり、多チャンネルのA/
D変換を行う場合はさらに多くの処理がかかるという問
題点があった。
Therefore, a processing time of about 80 μs is required for an 8-bit microcomputer, and multi-channel A /
There is a problem that more processing is required when performing D conversion.

【0011】本発明の目的は、前記問題点を解決し、短
時間でA/D変換が行えるようにしたマイクロコンピュ
ータを提供することにある。
An object of the present invention is to solve the above problems and to provide a microcomputer capable of performing A / D conversion in a short time.

【0012】[0012]

【課題を解決するための手段】本発明のマイクロコンピ
ュータの構成は、アナログ信号を入力してA/D変換デ
ータに変換するA/Dコンバータと、前記A/D変換デ
ータを加算する加算器と、前記加算器の加算回数をカウ
ントするカウンタと、あらかじめソフトにより前記加算
器の加算回数の設定を行うレジスタと、前記カウンタと
前記レジスタの値を比較して一致信号を出力する比較器
と、前記加算器から平均値を選択するセレクタと、前記
セレクタの出力信号をラッチするラッチ回路と、前記A
/Dコンバータ,加算器,カウンタを制御する制御部と
を備えていることを特徴とする。
A microcomputer of the present invention has an A / D converter for inputting an analog signal and converting it into A / D converted data, and an adder for adding the A / D converted data. A counter for counting the number of additions of the adder, a register for setting the number of additions of the adder in advance by software, a comparator for comparing the values of the counter and the register and outputting a coincidence signal, A selector for selecting an average value from an adder; a latch circuit for latching the output signal of the selector;
And a control unit for controlling the / D converter, the adder, and the counter.

【0013】[0013]

【実施例】図1は本発明の一実施例のマイクロコンピュ
ータを示すブロック図である。
1 is a block diagram showing a microcomputer according to an embodiment of the present invention.

【0014】図1において、本実施例のマイクロコンピ
ュータの構成は、アナログ信号を入力してA/D変換デ
ータに変換するA/Dコンバータ1と、前記A/D変換
データを加算する加算器2と、前記加算器2の加算回数
をカウントするカウンタ3と、あらかじめソフトにより
前記加算器2の加算回数の設定を行うレジスタ5と、前
記カウンタ3の前記レジスタ5の値を比較して一致信号
を出力する比較器4と、前記加算器2から平均値を選択
するセレクタ6と、前記セレクタ6の出力信号をラッチ
するラッチ回路7と、前記A/Dコンバータ1,加算器
2,カウンタ3を制御する制御部8とを備えている。
In FIG. 1, the configuration of the microcomputer of this embodiment includes an A / D converter 1 for inputting an analog signal and converting it into A / D converted data, and an adder 2 for adding the A / D converted data. A counter 3 for counting the number of times of addition of the adder 2, a register 5 for setting the number of times of addition of the adder 2 by software beforehand, and a value of the register 5 of the counter 3 are compared to generate a coincidence signal. Controls the comparator 4 that outputs, the selector 6 that selects the average value from the adder 2, the latch circuit 7 that latches the output signal of the selector 6, the A / D converter 1, the adder 2, and the counter 3. And a control unit 8 for controlling.

【0015】図1において、A/Dコンバータ1により
変換されたデータを、加算器2により加算し、加算器2
の加算回数をカウンタ3によりカウントする。
In FIG. 1, the data converted by the A / D converter 1 is added by an adder 2 to obtain an adder 2
The counter 3 counts the number of additions.

【0016】次に比較回路4により、レジスタ5にあら
かじめ設定しておく加算回数(平均回数)の値のカウン
タ3の値が一致したら、ラッチ回路7に信号を送り、そ
の信号により加算器2の加算データからレジスタ5の値
に従って平均値を選択しているセレクタ6のデータをラ
ッチ回路7でラッチし、内部バス9にデータを送る。
Next, when the value of the counter 3 of the value of the number of additions (average number) preset in the register 5 is matched by the comparison circuit 4, a signal is sent to the latch circuit 7, and the signal of the adder 2 The latch circuit 7 latches the data of the selector 6 which selects the average value according to the value of the register 5 from the added data, and sends the data to the internal bus 9.

【0017】また、制御部8から出力された信号によ
り、A/Dコンバータ1がA/D変換をスタートし、加
算器2とカウンタ3のデータをクリアする。
Further, the A / D converter 1 starts A / D conversion in response to the signal output from the control unit 8 and clears the data in the adder 2 and the counter 3.

【0018】図2は図1の実施例における加算器2とセ
レクタ6の動作を示す図である。
FIG. 2 is a diagram showing the operation of the adder 2 and the selector 6 in the embodiment of FIG.

【0019】図2において、A/Dコンバータ1から出
力されるデータを8ビットA/D変換データ10とし、
これを加算器11に加算する。
In FIG. 2, the data output from the A / D converter 1 is 8-bit A / D converted data 10,
This is added to the adder 11.

【0020】次に、この加算器11の加算データから平
均データを求める方法を示す。2回平均データ12は、
加算器11にRビットA/D変換データ10を2回加算
した9ビットの上位8ビットとなる。4回平均データ1
3は、加算器11に8ビットA/D変換データを4回加
算した10ビットデータの上位8ビットとなる。
Next, a method of obtaining average data from the added data of the adder 11 will be described. 2 times average data 12 is
The R-bit A / D conversion data 10 is added twice to the adder 11 to obtain the higher 8 bits of 9 bits. 4 times average data 1
3 is the higher 8 bits of the 10-bit data obtained by adding the 8-bit A / D conversion data to the adder 11 four times.

【0021】従って、図1のセレクタ6により、レジス
タ5の加算回数(平均回数)データによって、加算器2
の加算データから平均データを選択することができる。
Accordingly, the adder 2 is added by the selector 6 of FIG. 1 according to the number of additions (average number) data of the register 5.
Average data can be selected from the addition data of.

【0022】[0022]

【発明の効果】以上説明したように、本発明は、アナロ
グ信号を入力して、A/D変換データに変換するA/D
コンバータと、前記A/D変換データを加算する加算器
と、前記加算器の加算回数をカウントするカウンタと、
あらかじめ前記加算器の加算回数の設定を行うレジスタ
と、前記カウンタと前記レジスタの値を比較して一致し
たら一致信号を出力する比較器と、前記加算器から平均
値を選択するセレクタと、前記セレクタの出力信号をラ
ッチするラッチ回路と、前記A/Dコンバータ,加算
器,カウンタを制御する制御部とを含むことにより、従
来プログラムの命令により実現していたA/D変換デー
タの平均値をハードにより実現させることで、マイクロ
コンピュータの処理時間を従来1チャンネルあたり4ビ
ットマイクロコンピュータで約100μs,8ビットマ
イクロコンピュータで約80μsかかっていたものを約
1μs以下に短縮する効果を有する。
As described above, according to the present invention, an analog signal is inputted and converted into A / D converted data.
A converter, an adder for adding the A / D converted data, a counter for counting the number of additions of the adder,
A register that sets the number of times of addition of the adder in advance, a comparator that compares the values of the counter and the register and outputs a match signal if they match, a selector that selects an average value from the adder, and the selector By including a latch circuit for latching the output signal of the A / D converter and a control unit for controlling the A / D converter, the adder, and the counter, the average value of the A / D converted data realized by the instruction of the conventional program is hard-coded. With this, the processing time of the microcomputer can be reduced to about 1 μs or less from the conventional processing time of about 100 μs for a 4-bit microcomputer and about 80 μs for an 8-bit microcomputer per channel.

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

【図1】本発明の実施例のマイクロコンピュータを示す
ブロック図である。
FIG. 1 is a block diagram showing a microcomputer according to an embodiment of the present invention.

【図2】図1に示したセクタの動作を示す図である。FIG. 2 is a diagram showing an operation of a sector shown in FIG.

【図3】従来のプログラム命令のフロー図である。FIG. 3 is a flow diagram of conventional program instructions.

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

1 A/Dコンバータ 2 加算器 3 カウンタ 4 比較回路 5 レジスタ 6 セレクタ 7 ラッチ回路 8 制御部 9 内部バス 10 8ビットA/D変換データ 11 加算器 12 2回平均データ(8ビット) 13 4回平均データ(8ビット) 20〜23 処理 1 A / D converter 2 adder 3 counter 4 comparison circuit 5 register 6 selector 7 latch circuit 8 controller 9 internal bus 10 8-bit A / D conversion data 11 adder 12 2 times average data (8 bits) 13 4 times average Data (8 bits) 20-23 processing

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 アナログ信号を入力してA/D変換デー
タに変換するA/Dコンバータと、前記A/D変換デー
タを加算する加算器と、前記加算器の加算回数をカウン
トするカウンタと、あらかじめ前記加算器の加算回数の
設定を行うレジスタと、前記カウンタと前記レジスタと
の値を比較して一致した場合に一致信号を出力する比較
器と、前記加算器から平均値を選択するセレクタと、前
記セレクタの出力信号をラッチするラッチ回路と、前記
A/Dコンバータ,加算器,カウンタを制御する制御部
とを備えることを特徴とするマイクロコンピュータ。
1. An A / D converter that inputs an analog signal and converts it into A / D converted data, an adder that adds the A / D converted data, and a counter that counts the number of additions of the adder. A register for setting the number of times of addition of the adder in advance, a comparator for outputting a coincidence signal when the values of the counter and the register are compared and a match, and a selector for selecting an average value from the adder A microcomputer comprising: a latch circuit for latching the output signal of the selector; and a control unit for controlling the A / D converter, the adder, and the counter.
【請求項2】 制御部,レジスタ,ラッチ回路は、いず
れも内部バスに接続されたものである請求項1記載のマ
イクロコンピュータ。
2. The microcomputer according to claim 1, wherein the control unit, the register and the latch circuit are all connected to an internal bus.
JP3234243A 1991-09-13 1991-09-13 Microcomputer Pending JPH0573698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3234243A JPH0573698A (en) 1991-09-13 1991-09-13 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3234243A JPH0573698A (en) 1991-09-13 1991-09-13 Microcomputer

Publications (1)

Publication Number Publication Date
JPH0573698A true JPH0573698A (en) 1993-03-26

Family

ID=16967927

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3234243A Pending JPH0573698A (en) 1991-09-13 1991-09-13 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0573698A (en)

Similar Documents

Publication Publication Date Title
JPH0573698A (en) Microcomputer
US4129751A (en) PCM data throttle
JP3142033B2 (en) D / A conversion circuit
JPS6013488A (en) Digital phase servo circuit
JPH08139575A (en) Pulse output circuit
JP3374205B2 (en) Serial data interface device
JPH05225043A (en) Memory address controller
JPH0637642A (en) Pwm/binary conversion circuit
JPH0746856A (en) Digital pwm circuit
JP2834736B2 (en) Speech synthesizer
JPH02185131A (en) Counter device
JP2000269814A (en) Analog/digital conversion circuit
JP2002300037A (en) Analog/digital converter
JPH01311872A (en) Pwm signal arithmetic and logic device
KR960013427B1 (en) Motor rotation servo control apparatus
JPH05244003A (en) Cyclic multi-step system a/d converter
JPH07287798A (en) Distributing device for digital signal
JPH02259800A (en) Echo generating circuit
JPH0974354A (en) A/d converter and digital control equipment
JPH1175397A (en) Frequency variable equipment
JPH03156530A (en) Absolute value arithmetic circuit
JPS63109613A (en) Bit number converting circuit
JPS615628A (en) Data conversion processing circuit
JPH08167846A (en) A-d converter
JPH11143819A (en) Bus size circuit