#include __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF) org 0 ; Begginning of code DISPLAY equ 0x22 PORTS: bsf STATUS,RP0 ; select Register Page 1 movlw 0x00 ; Move the hex value of 0 to multi purpose register W movwf TRISC ; make IO PortC all output movlw 0xff ;Make a all inputs movwf TRISA movlw 0x10 ;set A2d Clock movwf ADCON1 bcf STATUS,RP0 ;Exit bank 1 bsf STATUS,RP1 movlw 0xff movwf ANSEL ; Set A2D for RA0 bcf STATUS,RP1 movlw 0x01 movwf ADCON0 ; Configure ADCON and turn it on clrf DISPLAY MAIN: call A2D movf DISPLAY,w movwf PORTC ; Move looked up value to c goto MAIN ; Return to main A2D: nop nop nop nop nop ; wait 5 uS bsf ADCON0,GO ; Start the conversion btfss ADCON0,GO ; Bit will stay high untill conversion is complete goto $-1 ; Untill then keep going back movf ADRESH,w movwf DISPLAY return end