根据延时方法分析,中断置初值采用如下程序:load_initial_s
bcf T1CON,TMR1ON
CLRF TMR1H; Clear Low byte,Ensures no rolover into
TMR1H,Value to load into TMR1H
MOVLW 0X80 ;Value to load into TMR1H,Write High byte
MOVWF TMR1H ;
MOVLW 0X00 ;Value to load into TMR1L,Write Low byte
ADDWF TMR1L;one second intrupt one time run 262162 Tcy,i.e.0.262162s。soset tmr1
BSF T1CON,TMR1ON
load_initial_ms
bcf T1CON,TMR1ON
CLRF TMR1L;Clear Low byte,Ensures no rolover into
TMR1H,Value to load into TMR1H
MOVLW 0Xxx;the value is preparative worked out
MOVWF TMR1H;
MOVLW 0Xxx ;the value is preparative worked out
MOVWF TMR1L;
BSF T1CON,TMR1ON
|