SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 117
Version 1.7
Example: Regulator, PGIA and ADC setting (Fhosc = IHRC 8MHz)
@CPREG_Init:
B0BSET
FBGRENB
;Enable Band Gap Reference voltage
@AVDDR_Enable: B0BSET
FAVDDRENB
; Enable AVDDR Voltage=2.4V
@PGIA_Init:
MOV
A, #00000001B
B0MOV
CHS, A
; V (X+, X-) Output = V (AI1, AI2) x 128
MOV
A, #00011100B
; PGIA chopper Enable
B0MOV
AMPM, A
; PGIA chopper Freq. 31.25kHz.
B0BSET
FAMPENB
; Enable PGIA function
@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
; Output ADC conversion word
@ADC_Read:
B0BCLR
FDRDY
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
Note 1: Please set ADC relative registers first, than enable ADC function bit.
Note 2: Before enable ADC function, please set analog function (regulators, PGIA and ADC) and wait 300us
for all functions stable.