PIC16F877A之定時TMR0
tmr0 equ 01hpcl equ 02hstatus equ 03hoption_reg equ 81hintcon equ 0bhportc equ 07htrisc equ 87htmr0data equ 15hcount equ 20hrp0 equ 5horg 0000hnopgoto mainorg 0005hmain nopbsf status,rp0movlw 00hmovwf triscmovlw 07hmovwf option_regbcf status,rp0clrf countloop1movf count,0call readmovwf portcincf count,1movlw 0fhandwf count,1call delaycall delaycall delaycall delaycall delaycall delaycall delaygoto loop1delaybcf intcon,2movlw tmr0datamovwf tmr0delay1btfss intcon,2goto delay1returnread addwf pcl,1retlw b'10000000'retlw b'11000000' retlw b'11100000'retlw b'11110000'retlw b'11111000'retlw b'11111100'retlw b'11111110'retlw b'11111111'retlw b'11111110'retlw b'11111100'retlw b'11111000'retlw b'11110000'retlw b'11100000'retlw b'11000000'retlw b'10000000'retlw b'00000000'end
本程序利用的 16F877A的TMR0,具體如何設(shè)置請查找16F877C中的INTCON、OPTION_REG 、TMR0等相關(guān)特殊工作寄存器的功能說明。推薦李學(xué)海老師編寫的PIC單片機實用教程。
51單片機相關(guān)文章:51單片機教程
評論