PIC16F877A之定時(shí)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è)置請(qǐng)查找16F877C中的INTCON、OPTION_REG 、TMR0等相關(guān)特殊工作寄存器的功能說明。推薦李學(xué)海老師編寫的PIC單片機(jī)實(shí)用教程。
51單片機(jī)相關(guān)文章:51單片機(jī)教程
評(píng)論