hi, i am trying to read an adc input and output the result at PORTC using assembly language, but the simulation in proteus give me no output, please help me find where is my mistake, tq
Rich (BB code):
INCLUDE "P16F877A.INC"
ERRORLEVEL 0, -302 ;suppress bank selection messages
ADCON1 EQU 9FH
ADCON0 EQU 1FH
go EQU 2
ADRESL EQU 9EH
PORTC EQU 07H
TRISC EQU 87H
PORTA EQU 05H
TRISA EQU 85H
ORG 0x000
goto main
main
banksel ADCON1
movlw b'10000000' ; configure all channel as analog n vref = vdd n gnd
movwf ADCON1
banksel ADCON0
movlw b'10000001' ; ch0 as anolog input n fosc/32
movwf ADCON0
banksel TRISC
movlw b'00000000'
movwf TRISC
banksel PORTC
clrf PORTC
banksel PORTA
clrf PORTA
loop
banksel ADCON0
bsf ADCON0,go
back
CALL delay
banksel ADCON0
btfsc ADCON0,go
goto back
BANKSEL ADRESL
movf ADRESL,W
BANKSEL PORTC
movwf PORTC
goto loop
delay
movlw d'6'
movwf 20h
looping nop
nop
decfsz 20h
goto looping
return
end