
Rev. 1.00
50
��ne 1�� �01�
Rev. 1.00
51
��ne 1�� �01�
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
HT46R003B
Cost-Effective A/D 8-bit OTP MCU
Note that to reduce the quantisation error, a 0.5 LSB offset is added to the A/D Converter input.
Except for the digitised zero value, the subsequent digitised values will change at a point 0.5 LSB
below where they would change without the offset, and the last full scale digitized value will change
at a point 1.5 LSB below the V
DD
level.
Ideal A/D Transfer Function
A/D Programming Example
The following two programming examples illustrate how to set and implement an A/D conversion.
In the first example, the method of polling the EOCB bit in the ADCR register is used to detect
when the conversion cycle is complete, whereas in the second example, the A/D interrupt is used to
determine when the conversion is complete.
Example: using an EOCB polling method to detect the end of conversion
clr
ADE
;
disable
A/D
Converter
interrupt
mov a,00000001B
mov ACSR,a ; select f
SYS
/8 as A/D clock and ADONB=0
mov a,00011111B
mov ADPCR,a ; setup ADCR register to configure I/O Port as A/D inputs
mov a,00000000B
mov ADCR,a ; select AN0 to be connected to the A/D converter:
:
Start_conversion:
clr START
set START ; reset A/D
clr START ; start A/D
Polling_EOC:
sz EOCB ; poll the ADCR register EOCB bit to detect end
;
of
A/D
conversion
jmp polling_EOC ; continue polling
mov a,ADRL ; read low byte conversion result value
mov adrl_buffer,a ; save result to user defined register
mov a,ADRH ; read high byte conversion result value
mov adrh_buffer,a ; save result to user defined register
:
jmp start_conversion ; start next A/D conversion