poojapatel2210
New Member
****************************************
;routine to set 5S time out, use Timer 1
****************************************
Tout5SOn:
movlw 0x67
movwf TMR1H
movlw 0x6A
movwf TMR1L
goto SetToutTMR
****************************************
;routine to set 3S time out, use Timer 1
****************************************
Tout3SOn:
movlw 0xA4 ;[1/(250000/4/8)]*23435=3S ( can you explain how 23435 is calculated & overflow takes place in simple )
movwf TMR1H
movlw 0x73
movwf TMR1L
SetToutTMR:
call SetBank1
bcf PIE1,TMR1IE ;disable TMR1 int
call SetBank0
movlw b'00110100'
movwf T1CON
bsf T1CON,TMR1ON ;turn on timer 1
ClrTMR1F:
bcf PIR1,TMR1IF ;clear TMR1 overflow flag
return
Tout3SOff:
bcf T1CON,TMR1ON ;turn off timer 1
goto ClrTMR1F
;routine to set 5S time out, use Timer 1
****************************************
Tout5SOn:
movlw 0x67
movwf TMR1H
movlw 0x6A
movwf TMR1L
goto SetToutTMR
****************************************
;routine to set 3S time out, use Timer 1
****************************************
Tout3SOn:
movlw 0xA4 ;[1/(250000/4/8)]*23435=3S ( can you explain how 23435 is calculated & overflow takes place in simple )
movwf TMR1H
movlw 0x73
movwf TMR1L
SetToutTMR:
call SetBank1
bcf PIE1,TMR1IE ;disable TMR1 int
call SetBank0
movlw b'00110100'
movwf T1CON
bsf T1CON,TMR1ON ;turn on timer 1
ClrTMR1F:
bcf PIR1,TMR1IF ;clear TMR1 overflow flag
return
Tout3SOff:
bcf T1CON,TMR1ON ;turn off timer 1
goto ClrTMR1F
Last edited: