Rev. 1.40
178
De�e��e� 1�� �01�
Rev. 1.40
179
De�e��e� 1�� �01�
BS67F340/BS67F350/BS67F360/BS67F370
Enhanced Touch A/D Flash MCU with LCD Driver
BS67F340/BS67F350/BS67F360/BS67F370
Enhanced Touch A/D Flash MCU with LCD 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 configure 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 flag
set
ADE
;
enable
ADC
interrupt
set EMI ; enable global interrupt
:
:
ADC_ISR: ; ADC interrupt service routine
mov acc_stack,a ; save ACC to user defined memory
mov a,STATUS
mov status_stack,a ; save STATUS to user defined memory
:
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
:
EXIT_INT_ISR:
mov a,status_stack
mov STATUS,a ; restore STATUS from user defined memory
mov a,acc_stack ; restore ACC from user defined memory
reti