; Simple Example Program PROCESSOR 16F873 __CONFIG 0x3FF6 INCLUDE INCLUDE cblock 0x20 i: 1 j: 1 endc org 0x0 goto main org 0x5 main: ; Set PCLATH to the library segment and leave it until we need to ; jump on this page MOVLW HIGH SerialSetup MOVWF PCLATH CALL SerialSetup BSF STATUS,RP0 ; BANK1 MOVLW 0x8E MOVWF ADCON1 ; set up AD0 only BCF STATUS,RP0 again: MOVLW 0x81 MOVWF ADCON0 ; select AD0 MOVLW .125 ; delay 125 cycles CALL Delay CLRF PCLATH BSF ADCON0,GO ; start conversion BTFSC ADCON0,GO ; wait for it.. GOTO $-1 MOVLW ADRESH MOVWF FSR MOVLW HIGH Hexout MOVWF PCLATH CALL Hexout MOVLW ADRESL MOVWF FSR CALL Hexout MOVLW .13 CALL SerialTransmit ; wait about 1 second (76*256*51uS=992mS) ; MOVLW .76 ; MOVWF i ;dloop0: ; movlw 0xFF ; movwf j ;dloop: ; MOVLW HIGH Delay ; MOVWF PCLATH ; MOVLW 0xFF ; CALL Delay ; CLRF PCLATH ; DECFSZ j,F ; GOTO dloop ; DECFSZ i,F ; GOTO dloop0 GOTO again ; go again IF 0 ;; DEBUG for use when simulating org 0x0F03 return org 0x0F14 return org 0x0F0E return org 0xF1A return org 0xF1D return org 0xF23 return org 0xFBF return org 0xFCA return org 0xFAD return ENDIF END