|
程序功能:讓RC口的八個(gè)燈亮65MS滅65MS采用定時(shí)器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 以上程序已經(jīng)運(yùn)行通過 |