babboy12345
New Member
I cant build this program,got error occur,but the problems is i dono how to corrected it....pls help
LIST P=16F877A
INCLUDE "P16F877a.inc"
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_O
CHK1 EQU 0X21
CNT1 EQU 0CH
CNT2 EQU 0DH
count EQU 020;
org 0x000
nop ;
banksel TRISA
movlw b'00000000';
movwf TRISB;
banksel ADCON1
movlw b'10000000
movwf ADCON1
banksel ADCON0
movlw b'10000001
movwf ADCON0
getAD movlw 007
movwf count
down decfsz count
goto down
bsf ADCON0,GO
wait btfsc adcon0,GO
goto wait
return
start call getAD ; get adc result store at adresh
movlw 0xC8 ;
error here subwf adresh,1 ; adc result in adresh will minus....
btfsc adresh,0 ;...C8 and the answer store at adresh again..
goto start ; if answer in adresh is not 0....then the program will jump to start again...
btfsc adresh,1
goto start
btfsc adresh,2
goto start
btfsc adresh,3
goto start
btfsc adresh,4
goto start
btfsc adresh,5
goto start
btfsc adresh,6
goto start
btfsc adresh,7
goto start
bsf portb
call delay
end
delay MOVLW D'5'
MOVWF CNT2
CON1 MOVLW H'FF'
MOVWF CNT1
DECFSZ CNT1,1
GOTO $-1
DECFSZ CNT2,1
GOTO CON1
RETURN
LIST P=16F877A
INCLUDE "P16F877a.inc"
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_O
CHK1 EQU 0X21
CNT1 EQU 0CH
CNT2 EQU 0DH
count EQU 020;
org 0x000
nop ;
banksel TRISA
movlw b'00000000';
movwf TRISB;
banksel ADCON1
movlw b'10000000
movwf ADCON1
banksel ADCON0
movlw b'10000001
movwf ADCON0
getAD movlw 007
movwf count
down decfsz count
goto down
bsf ADCON0,GO
wait btfsc adcon0,GO
goto wait
return
start call getAD ; get adc result store at adresh
movlw 0xC8 ;
error here subwf adresh,1 ; adc result in adresh will minus....
btfsc adresh,0 ;...C8 and the answer store at adresh again..
goto start ; if answer in adresh is not 0....then the program will jump to start again...
btfsc adresh,1
goto start
btfsc adresh,2
goto start
btfsc adresh,3
goto start
btfsc adresh,4
goto start
btfsc adresh,5
goto start
btfsc adresh,6
goto start
btfsc adresh,7
goto start
bsf portb
call delay
end
delay MOVLW D'5'
MOVWF CNT2
CON1 MOVLW H'FF'
MOVWF CNT1
DECFSZ CNT1,1
GOTO $-1
DECFSZ CNT2,1
GOTO CON1
RETURN