單片機(jī)閃爍燈設(shè)計(jì)
;*---------------
FMsel
movf MODESEL,w
movwf MODESELB
movf MODESEL,w
addwf PCL
retlw b'11111000'
retlw b'11110000'
retlw b'11100000'
retlw b'11000000'
retlw b'10000000'
movlw 00h
movwf MODESELB
bsf INTCON,GIE
retlw b'11111000'
return
;*-------------
ISR
btfss INTCON,INTF
goto $+3
bcf INTCON,INTF
incf MODESEL
retfie
end
1:程序開(kāi)始(START)
2:A=00000000B
3:PORT 0
4:延遲(DELAY)
5:A=11111111B
6:PORT 0
7:延遲(DELAY)
8:反回開(kāi)始
延遲子程序編制方法:
1:R6=0
2:DEL1
3:R7=0
4:$
5:R7-1
6:R7=0 不等于0,返回2
7:R6-1
8:R6=0 不等于0,返回4
回主程序
評(píng)論