EasyManua.ls Logo

Holtek BS66F340 - Page 155

Default Icon
242 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.60 154 August 20, 2019 Rev. 1.60 155 August 20, 2019
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
BS66F340/BS66F350/BS66F360/BS66F370
Touch A/D Flash MCU with LED Driver
Example: using the interrupt method to detect the end of conversion
clr ADE ; disable ADC interrupt
set VREFP_EXT ; deselect the temperature sensor reference voltage
mov a,03H ; select f
SYS
/8 as A/D clock and A/D internal power supply
mov ADCR1,a ; as reference voltage
set ADCEN
mov a,03h ; setup PBS0 to congure pin AN0
mov PBS0,a
mov a,20H
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
clr ADF ; clear ADC interrupt request ag
set ADE ; enable ADC interrupt
set EMI ; enable global interrupt
:
:
ADC_ISR: ; ADC interrupt service routine
mov acc_stack,a ; save ACC to user dened memory
mov a,STATUS
mov status_stack,a ; save STATUS to user dened memory
:
mov a, ADRL ; read low byte conversion result value
mov ADRL_buffer,a ; save result to user dened register
mov a, ADRH ; read high byte conversion result value
mov ADRH_buffer,a ; save result to user dened register
:
EXIT_INT_ISR:
mov a,status_stack
mov STATUS,a ; restore STATUS from user dened memory
mov a,acc_stack ; restore ACC from user dened memory
reti

Table of Contents

Related product manuals