EasyManua.ls Logo

Holtek HT66F002 - A;D Programming Examples

Default Icon
144 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rev. 1.71 106 April 11, 2017 Rev. 1.71 107 April 11, 2017
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
HT66F002/HT66F0025/HT66F003/HT66F004
Cost-Effective A/D Flash MCU with EEPROM
A/D Programming Examples
ThefollowingtwoprogrammingexamplesillustratehowtosetupandimplementanA/Dconversion.
Intherstexample,themethodofpollingtheADBZbitintheSADC0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 ADC interrupt
mov a,0BH
mov SADC1,a
; select f
SYS
/8 as A/D clock and switch off the bandgap reference voltage
set ENADC
mov a,03h ; setup PASR to congure pin AN0
mov PASR,a
mov a,20h
mov SADC0,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 ADBZ ; poll the SADC0 register ADBZ bit to detect end of A/D conversion
jmp polling_EOC ; continue polling
mov a,SADOL ; read low byte conversion result value
mov SADOL_buffer,a ; save result to user dened register
mov a,SADOH ; read high byte conversion result value
mov SADOH_buffer,a ; save result to user dened register
:
:
jmp start_conversion ; start next a/d conversion

Table of Contents

Related product manuals