SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 118
Version 1.7
Example: VDD Voltage Detection:
@CPREG_Init:
B0BSET
FBGRENB
;Enable Band Gap Reference voltage
@AVDDR_Enable: B0BSET
FAVDDRENB
; Enable AVDDR Voltage=2.4V
@VDD_Detection:
@PGIA_Init:
MOV
A, #01010101B
B0MOV
CHS, A
; PGIA differential channel (VDD+, VDD-) and Gain x 1
MOV
A, #00010000B
; Set VDD detection function
B0MOV
AMPM, A
; Set PGIA buffer off and PGIA chopper 31.25KHz
B0BCLR
FAMPENB
; Disable PGIA function
; V (X+, X-) Output = V (VDD+, VDD-) x 1
@ADC_Init:
MOV
A, #01101000B
; ADC chopper 31.25KHz
B0MOV
ADCM1, A
; ADC Reference voltage = internal 0.84V, ADC_Gain = 1x.
MOV
A, #01110110B
B0MOV
ADCM2, A
; Set ADC clock=250kHz, OSR=32768, offset=0V.
B0BSET
FADCENB
; Enable ADC function
@ADC_Wait:
B0BTS1
FDRDY
; Check ADC output new data or not
JMP
@ADC_Wait
; Wait for Bit DRDY = 1
@ADC_Read:
B0BCLR
FDRDY
; Output ADC conversion word
B0MOV
A, ADCDH
B0MOV
Data_H_Buf, A
; Move ADC conversion High byte to Data Buffer
B0MOV
A, ADCDM
B0MOV
Data_M_Buf, A
; Move ADC conversion Medium byte to Data Buffer
…
…
…