English
Language : 

GMS87C4060 Datasheet, PDF (46/102 Pages) Hynix Semiconductor – 8-BIT SINGLE-CHIP MICROCONTROLLERS
GMS81C4040/87C4060
PRELIMINARY
12. A/D Converter
The A/D convertor circuit is shown in Figure 12-1 .
The A/D convertor circuit consists of the comparator and
control register AIPS(00EFH), ADCM(00F0H),
ADR(00F1H). The AIPS register select normal port or an-
alog input. The ADCM register control A/D converter’s
activity. The ADR register stores A/D converted 8bit re-
sult. The more details are shown Figure 12-2 .
ADCM [F0H]
ADEN ADS2 ADS1 ADS0 ADST ADSF
ADR [F1H]
port
select
AN0
AN1
AN2
AN3 MUX
AN4
AN5
Control circuit
Comparator
S/H
+
−
Vref
Register ladder
IFA
Succesive
Approximation
Circuit
Figure 12-1 Block Diagram of A/D convertor circuit
Control
The GMS81C4040/GMS87C4060 contains a A/D con-
verter module which has six analog inputs.
1. First of all, you have to select analog input pin by set the
ADCM and AIPS.
2. Set ADEN (A/D enable bit : ADCM bit5).
3. Set ADST (A/D start bit : ADCM bit1). We recommend
you do not set ADEN and ADST at once, it makes worse
A/D converted result.
4. ADST bit will be cleared automatically 1cycle after you
set this.
Example:
:
; Set AIPS, change ? to what you want
;
0 : digital port
;
1 : analog port
LDM AIPS,#00??????b
; Set ADEN, xxx is analog port number
LDM ADCM,#001xxx00b
; or “SET1 ADEN”
; Set ADST, xxx is analog port number
LDM ADCM,#001xxx10b
; or “SET1 ADST”
:
:
5. After A/D conversion is completed, ADSF bit and inter-
rupt flag IFA will be set. (A/D conversion takes 36 ma-
chine cycle : 9uS when fex=8MHz).
Note: Make sure AIPS bits, if you using a port which is set
digital input by AIPS, analog voltage will be flow into MCU
internal logic not A/D converter. Sometimes device or port
is damaged permanently.
42
PRELIMINARY
Nov. 1999 Ver 1.0