PIC单片机16F877A跑马灯程序,课设用
1个回答
2013-11-28
展开全部
唉,现在的年轻人啊。一个字:很懒!我发你一个吧。好久没写PIC了,不知对否。自己验证吧。谢谢采纳!;-------------------- 跑马灯 --------------------list p=16f877a,r=dec
include "p16f877a.inc"
;---------------------------------------------------
delay1 equ 0x20
delay2 equ 0x21
f equ 0x01
w equ 0x00
;-------------------------------------------
org 0x00
goto mainline
org 0x04
stophere
goto stophere
;------------------------------------------
mainline
call initial
mainloop
call delay
rlf PORTD,f
goto mainloop
;----------------------------------------
initial
bsf STATUS,RP0
clrf TRISA
clrf TRISB
clrf TRISC
clrf TRISD
clrf TRISE
bcf STATUS,RP0
movlw 0xff
movwf PORTA
movwf PORTB
movwf PORTC
movwf PORTE
movlw 0xaa
movwf PORTD
bcf STATUS,C
return
;--------------------------delay
movlw 0x20
movwf delay1
clrf delay2
delayloop
decfsz delay2,f
goto delayloop
decfsz delay1,f
goto delayloop
return;----------------------------------------------
end
include "p16f877a.inc"
;---------------------------------------------------
delay1 equ 0x20
delay2 equ 0x21
f equ 0x01
w equ 0x00
;-------------------------------------------
org 0x00
goto mainline
org 0x04
stophere
goto stophere
;------------------------------------------
mainline
call initial
mainloop
call delay
rlf PORTD,f
goto mainloop
;----------------------------------------
initial
bsf STATUS,RP0
clrf TRISA
clrf TRISB
clrf TRISC
clrf TRISD
clrf TRISE
bcf STATUS,RP0
movlw 0xff
movwf PORTA
movwf PORTB
movwf PORTC
movwf PORTE
movlw 0xaa
movwf PORTD
bcf STATUS,C
return
;--------------------------delay
movlw 0x20
movwf delay1
clrf delay2
delayloop
decfsz delay2,f
goto delayloop
decfsz delay1,f
goto delayloop
return;----------------------------------------------
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询