HT46R068B/HT46R069B
Enhanced A/D Type 8-bit OTP MCU
Example: using an EOCB polling method to detect the end of conversion
clr
mov
movꢀ
mov
movꢀ
mov
movꢀ
mov
movꢀ
:
EADI
; disable ADC interrupt
a,00000001B
ACSR,aꢀ ꢀ
a,0Fh
ANCSR0,aꢀꢀ
a, 00h
ANCSR1,aꢀ
a,00000000B
ADCR,aꢀ ꢀ
ꢀ
ꢀ
ꢀ
ꢀ
;ꢀselectꢀfSYS/8 as A/D clock and ADONB=0
;
setupꢀANCSR0ꢀandꢀANCSR1ꢀtoꢀconfigureꢀpinsꢀAN0~AN3
;
;
;ꢀselect AN0 to be connected to the A/D converter
Start_conversion:
ꢀ
ꢀ
ꢀ
clrꢀ
setꢀ
clrꢀ
START
STARTꢀ
STARTꢀ
ꢀ
ꢀ
;ꢀresetꢀA/D
;ꢀstartꢀA/D
Polling_EOC:
ꢀ
szꢀꢀ
EOCBꢀ
ꢀ
;ꢀpollꢀtheꢀADCRꢀregisterꢀEOCBꢀbitꢀtoꢀdetectꢀend
; of A/D conversion
ꢀ
ꢀ
ꢀ
ꢀ
ꢀ
jmpꢀ
movꢀ
movꢀ
movꢀ
movꢀ
:
polling_EOCꢀ
a,ADRLꢀ ꢀꢀ
;ꢀcontinueꢀpolling
;ꢀreadꢀlowꢀbyteꢀconversionꢀresultꢀvalue
adrl_buffer,aꢀꢀ;ꢀsaveꢀresultꢀtoꢀuserꢀdefinedꢀregister
a,ADRHꢀ ꢀꢀ ;ꢀreadꢀhighꢀbyteꢀconversionꢀresultꢀvalue
adrh_buffer,aꢀꢀ;ꢀsaveꢀresultꢀtoꢀuserꢀdefinedꢀregister
ꢀ
jmpꢀ
start_conversion;ꢀstartꢀnextꢀA/Dꢀconversion
Note: To power off ADC module, it is necessary to set ADONB as "1".
Rev. 1.00
70
�anꢀaꢁꢂ ꢃꢄꢅ ꢃ011