User`s guide
Rev. 1.10 90 November 14, 2014 Rev. 1.10 91 November 14, 2014
HT66FW2230
Wireless Charger A/D Flash 8-Bit MCU
A/D Programming Examples
ThefollowingtwoprogrammingexamplesillustratehowtosetupandimplementanA/Dconversion.
Intherstexample,themethodofpollingtheEOCBbitintheADCR0registerisusedtodetect
whentheconversioncycleiscomplete,whereasinthesecondexample,theA/Dinterruptisusedto
determinewhentheconversioniscomplete.
Example: using an EOCB polling method to detect the end of conversion
clr ADE ; disable ADC interrupt
mov a,03H
mov ADCR1,a ; select f
SYS
/8 as A/D clock and switch off 1.25V
clr ADOFF
mov a,0FFh ; setup PAS0 to congure pins AN0,AN2,AN3
mov PAS0,a
mov a,00h
mov ADCR0,a ; enable and connect AN0 channel to A/D converter
:
start_conversion:
clr START ; high pulse on start bit to initiate conversion
set START ; reset A/D
clr START ; start A/D
polling_EOC:
sz EOCB ; poll the ADCR0 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 dened register
mov a,ADRH ; read high byte conversion result value
mov ADRH_buffer,a ; save result to user dened register
:
:
jmp start_conversion ; start next a/d conversion