;路標(biāo)導(dǎo)向燈,TMR2學(xué)習(xí) ;07/09/05 ;*******定義寄存器*********** pcl equ 2h status equ 3h intcon equ 0bh tmr2 equ 11h pir1 equ 0ch pie1 equ 8Ch t2con equ 12h pr2 equ 92h portc equ 7h trisc equ 87h rp0 equ 5h z equ 2h pr2b equ d'250' count equ 20h w_back equ 22h ;*******主程序*************** org 0000h nop main bsf status,rp0 movlw 00h movwf trisc movlw pr2b movwf pr2 bcf status,rp0 movlw 7bh movwf t2con clrf count loop movf count,0 call read movwf portc incf count movlw .15 subwf count,0 btfsc status,z clrf count call delay call delay call delay call delay goto loop ;*****TMR2硬件延時程序********** delay bcf pir1,1 bsf t2con,2 loop1 btfss pir1,1 goto loop1 return ;*****讀取顯示信息的查表程序****** read addwf pcl retlw b'00000001' retlw b'00000011' retlw b'00000111' retlw b'00001111' retlw b'00011111' retlw b'00111111' retlw b'01111111' retlw b'11111111' retlw b'00000000' retlw b'11111111' retlw b'00000000' retlw b'11111111' retlw b'00000000' retlw b'11111111' retlw b'00000000' end TMR2定時器,硬件電路定時, |
|