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,具体如何设置请查找16F877C中的INTCON、OPTION_REG 、TMR0等相关特殊工作寄存器的功能说明。推荐李学海老师编写的PIC单片机实用教程。
51单片机相关文章:51单片机教程
评论