I am using PIC 16F877a
Just trying the adc isn't working with me
I wrote a code in ASM to read the channel 0 input, convert it, and display the result as >>
ADRESH on PORTB
ADRESL on PORTD
Here is my code
Is there something wrong with the code ??
Just trying the adc isn't working with me
I wrote a code in ASM to read the channel 0 input, convert it, and display the result as >>
ADRESH on PORTB
ADRESL on PORTD
Here is my code
Code:
CBLOCK 0x20
COUNT
ENDC
BANKSEL TRISD
MOVLW B'00000000'
MOVWF TRISD
MOVWF TRISB
MOVLW B'11111111'
MOVWF TRISA
START
BANKSEL ADCON0
MOVLW B'00000001'
MOVWF ADCON0
BANKSEL ADCON1
MOVLW B'00000000'
MOVWF ADCON1
MOVLW 255
MOVWF COUNT
CALL DELAY
BANKSEL ADCON0
BSF ADCON0,2
L BTFSC ADCON0,2
GOTO L
BANKSEL ADRESH
MOVF ADRESH,W
BANKSEL PORTB
MOVWF PORTB
BANKSEL ADRESL
MOVF ADRESL,W
BANKSEL PORTD
MOVWF PORTD
GOTO START
DELAY
DECFSZ COUNT
GOTO DELAY
RETURN
Is there something wrong with the code ??