An88 – Cirrus Logic AN88 User Manual
Page 7

AN88
AN88Rev2
7
;*************************************************************************************
;* Program Code
;*************************************************************************************
processor
16C84
; Set Processor Type
org
0x00
; Reset Vector
goto
Main
; Start at Main
;*************************************************************************************
;* Routine - Main
;* Input - none
;* Output - none
;* This is the entry point to the program.
;*************************************************************************************
org
0x05
Main
; Start from Reset Vector
;******** Initialize System and Perform SELF OFFSET Calibration
CALL
initialize
; Initialize the system
CALL
calibrate
; Calibrate the ADC Offset
;******** Write to the GAIN Register
MOVLW
0x82
; Prepare COMMANDBYTE
MOVWF
COMMANDBYTE
MOVLW
0x80
; Prepare HIGHBYTE
MOVWF
HIGHBYTE
CLRF
MIDBYTE
; Prepare MIDBYTE
CLRF
LOWBYTE
; Prepare LOWBYTE
CALL
write_register
; Write to Gain Register
;******** Read from the GAIN Register
MOVLW
0x92
; Prepare COMMANDBYTE
MOVWF
COMMANDBYTE
CALL
read_register
; Read the Gain Register
;******** Perform Single Conversions
LOOP
CALL
convert
; Convert Analog input
goto
LOOP
; Repeat Loop
;******** End MAIN