cac anh oi, chuong trinh duoi day em viet neu nap cho pic 16f877a thi lieu no co chay khong, em đã viết nó để nạp cho pic 16f876a ,nhưng khi thử nghiệm với pic 16f876a thì ở portb em thấy các led đều tắt, cho em hỏi chương trình em viết để nạp cho pic16f876a có sai chỗ nào không?
#include<p16f876a.inc> ;chen thu vien lien ket cho chuong trinh
org 0x20
count1 res 1
count2 res 1
org 00h
goto START
START
clrf PORTB
bsf STATUS,RP0 ;chon bank1
movlw D'0'
movwf TRISB ; chon bortb xuat
bcf STATUS,RP0
movlw b'00000001'
movwf PORTB
call DELAY
QUAY1
rlf PORTB,1 ;co so 1la vi de dua vao portb
call DELAY
btfss PORTB,7
goto QUAY1
QUAY2
rrf PORTB,1
call DELAY
btfss PORTB,0 ;bit0
goto QUAY2
goto $
DELAY
movlw D'250'
movwf count1
movlw D'250'
movwf count2
LOOP1
decfsz count1,1 ;giam count xuong 1
goto LOOP1
LOOP2
decfsz count2,1
goto LOOP2
return
end
|