peter002
Member level 3
- Joined
- Mar 18, 2013
- Messages
- 56
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Hindusthaan
- Activity points
- 1,765
Dear senior assemblers.. nned ur hlp regarding pic16f877a timers..
hello big brothers, i ve been trying to make a speedometer for my bike using the hall effect sensor connected on porta,0, sensor's output pin is pulled hingh using around 7k resistance,
i hav made a six digit counter that seems to be working fine when i try using it by taking a meganet near to the sensor so the meter gets incremented, but for measuring the speed i need refference time counter, so i tried to configure the timer so i can count for one second atleast but it isnt working..
can anyone plz post any timer1 tested routine here??? i ll change the prescalar value and tmr1h and tmr1l values acc. to my needs after calculations..
here is a code tht i tried but didnt seems to be working good, its made for delay around 29us
thanx in advance
wbr..
hello big brothers, i ve been trying to make a speedometer for my bike using the hall effect sensor connected on porta,0, sensor's output pin is pulled hingh using around 7k resistance,
i hav made a six digit counter that seems to be working fine when i try using it by taking a meganet near to the sensor so the meter gets incremented, but for measuring the speed i need refference time counter, so i tried to configure the timer so i can count for one second atleast but it isnt working..
can anyone plz post any timer1 tested routine here??? i ll change the prescalar value and tmr1h and tmr1l values acc. to my needs after calculations..
here is a code tht i tried but didnt seems to be working good, its made for delay around 29us
Code:
TIMR1 BCF PIR1,TMR1IF ;Reset the TMR1IF flag bit
MOVLW H'FF'
MOVWF TMR1H ; Set initial value for the Timer1
MOVLW H'ED'
MOVWF TMR1L
BSF T1CON,3
BCF T1CON,TMR1CS ; Timer1 counts pulses from internal oscillator
BSF T1CON,T1CKPS0 ; Assigned prescaler rate is 1:8
BSF T1CON,T1CKPS1
BSF PIE1,TMR1IE ; Enable interrupt on overflow
MOVLW H'C0'
MOVWF INTCON ; Enable interrupt (bits GIE and PEIE)
BSF T1CON,TMR1ON ; Turn the Timer1 on
BTFSS PIR1,TMR1IF
GOTO $-1
RETURN
wbr..
Attachments
Last edited: