Owner's manual

AN130
8 AN130REV2
MOVLW 0xFF ; Load W for new delay count
CALL delay ; Delay for Oscillator start-up 158ms
CALL delay ; Delay for Oscillator start-up 158ms
CALL delay ; Delay for Oscillator start-up 158ms
CALL delay ; Delay for Oscillator start-up 158ms
;*** ADC Serial Port Initialization ***
MOVLW 0x0F ; Load W with a value of 15
MOVWF TEMP ; Loop count variable = TEMP
BCF PORTA, CS ; Clear CS to enable ADC
loop: MOVLW 0xFF ; Load W with all 1’s
CALL send_byte ; send all 1’s to ADC
DECFSZ TEMP, 1 ; loop through to send 15 bytes of all 1’s
goto loop
MOVLW 0xFE ; Load W with last byte - ’11111110’
CALL send_byte ; send final initialize byte to ADC
BSF PORTA, CS ; Set CS to disable ADC
RETURN ; Exit to "main"
;*****************************************************************************
;* Routine - calibrate
;* Input - none
;* Output - none
;* This subroutine tells the ADC to perform self-offset calibration on Setup 1
;*****************************************************************************
calibrate MOVLW 0x81 ; Command for Self-Offset Calibration
BCF PORTA, CS ; Enable ADC
CALL send_byte ; Send Calibration Command to ADC
poll_sdo1: BTFSC PORTA, SDO ; Wait until SDO falls to indicate
goto poll_sdo1 ; calibration completion.
BSF PORTA, CS ; Disable ADC
RETURN ; Exit to "main"
;*****************************************************************************
;* Routine - modify_gain