程序功能:让RC口的八个灯亮65MS灭65MS采用定时器0中断来完成
程序如下:
tmr0 equ 01h
pcl equ 02h
status equ 03h
option_reg equ 81h
intcon equ 0bh
portc equ 07h
trisc equ 87h
tmr0_b equ 0
w equ 0
f equ 1
rp0 equ 5
t0if equ 2
w_temp equ 7fh
portc_b equ 23h
flag equ 24h
org 0000h
nop
goto main
org 0004h
tmr0_serv
MOVwf w_temp
bcf intcon,t0if
MOVlw tmr0_b
MOVwf tmr0
btfss flag,0
goto loop0
bcf flag,0
goto loop1
loop0
bsf flag,0
MOVlw 0ffh
MOVwf portc
goto retfie_b
loop1
MOVlw 00h
MOVwf portc
retfie_b
MOVf w_temp,w
retfie
main
bsf status,rp0
MOVlw 0
MOVwf trisc
MOVlw 07h
MOVwf option_reg
bcf status,rp0
MOVlw 00h
MOVwf portc
MOVlw 0a0h
MOVwf intcon
bcf intcon,t0if
MOVlw tmr0_b
MOVwf tmr0
goto $
end
以上程序已经运行通过