anhquangngai
01-10-2006, 06:17 PM
em viết chương trình xoay trái led ở PORTB nhưng mà sao nó ko chạy!
Em ko tìm ra lỗi ở đâu, các anh giúp em với
Chương trình của em
title "leddichtutraiquaphai_Port_B.asm"
processor p16f877a
include <P16f877a.inc>
__CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC & _XT_OSC
;================================================= ========================
; Chuong trinh chinh
;================================================= ========================
count1 equ 0x20
counta equ 0x22
countb equ 0x23
org 0x000
;-------------------------------------------------------------
;khoi tao Port B
;------------------------------------------------------------
banksel TRISB
clrf TRISB
banksel PORTB
movlw b'00000001'
movwf PORTB
loop call delay100ms;
rlf PORTB,1
goto loop
;-----------------------------------------------------------------
;chuong trinh delay
;-----------------------------------------------------------------
delay100ms ; chuong trình con delay 100 ms
MOVLW d'100'
MOVWF count1
d1
MOVLW 0xC7
MOVWF counta
MOVLW 0x01
MOVWF countb
delay_0
DECFSZ counta,1
GOTO $+2
DECFSZ countb,1
GOTO delay_0
DECFSZ count1,1
GOTO d1
RETURN
;----------------------------------------------------------------
end
Em ko tìm ra lỗi ở đâu, các anh giúp em với
Chương trình của em
title "leddichtutraiquaphai_Port_B.asm"
processor p16f877a
include <P16f877a.inc>
__CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC & _XT_OSC
;================================================= ========================
; Chuong trinh chinh
;================================================= ========================
count1 equ 0x20
counta equ 0x22
countb equ 0x23
org 0x000
;-------------------------------------------------------------
;khoi tao Port B
;------------------------------------------------------------
banksel TRISB
clrf TRISB
banksel PORTB
movlw b'00000001'
movwf PORTB
loop call delay100ms;
rlf PORTB,1
goto loop
;-----------------------------------------------------------------
;chuong trinh delay
;-----------------------------------------------------------------
delay100ms ; chuong trình con delay 100 ms
MOVLW d'100'
MOVWF count1
d1
MOVLW 0xC7
MOVWF counta
MOVLW 0x01
MOVWF countb
delay_0
DECFSZ counta,1
GOTO $+2
DECFSZ countb,1
GOTO delay_0
DECFSZ count1,1
GOTO d1
RETURN
;----------------------------------------------------------------
end