timer1 in oic16f877
-
- Posts: 43
- Joined: Sat Sep 13, 2008 10:36 pm
- Contact:
timer1 in oic16f877
what registers are needed to be controlled else than t1con register to control timer1 in pic 16f877,do i need to control register intcon register or PIE ????to get time fro timer 1
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: timer1 in oic16f877
t1con contains all the control bits necessary to enable and configure the basic operation of timer 1 (select the clock source and prescaler). The count value is available in the tmr1h:tmr1l register pair.
The pie register is only used if timer interrupts are required.
The pie register is only used if timer interrupts are required.
-
- Posts: 43
- Joined: Sat Sep 13, 2008 10:36 pm
- Contact:
Re: timer1 in pic16f877
wow
thanks for the very fast reply...
i have posted this question before,,,so am sorry if this is not appropriate http://matrixmultimedia.com/mmforums/vi ... f=5&t=4101
still cant get anything from my SRF05 sensor

i did as mentioned in the linked post step by step but still nothing is working

this is what i did using pic16f877 and 8 mhz crystal
1. Turn Sensor Pwr Hi
Delay for 100ms
2.C-code Containing
tmr1h=FCV_CAPTUREH; load pic tmr1h,tmr1l in flowcode
tmr1l=FCV_CAPTUREL;
3. Output 1 to the INIT pin
delay_us(10);or 20 micro seconds
4. C Icon contain g,initialize timer1 to zero
tmr1h = 0x00;
tmr1l = 0x00;
5. Wait for ECHO pin to go high
6. t1con = 0x3B; Start timer counting with 1 : 8 prescalar
7.Keep counting while ECHO pin is high (LOOP)
8. ECHO pin becomes LOW>>>>>C Icon containg
t1con.0 = 0; //Stop Timer1 Counting
FCV_CAPTUREH = tmr1h;get tmr1h value
FCV_CAPTUREL = tmr1l;get tmr1l value
9.Distance = ( ( CaptureH << 8 ) + CaptureL )/58, calculate distance in cm >>(distance is an integer)
10. Output a 0 to the INIT pin
11.delay 100 Milli seconds
12.Repeat again
Timer period= 262140 micro seconds = almost 1/3 second so there is no need for tmr1 overflow because the sensor will lower its echo before timer1 overflows 30milli seconds after echo goes high
so am i missing something here



i have posted this question before,,,so am sorry if this is not appropriate http://matrixmultimedia.com/mmforums/vi ... f=5&t=4101
still cant get anything from my SRF05 sensor




i did as mentioned in the linked post step by step but still nothing is working


this is what i did using pic16f877 and 8 mhz crystal
1. Turn Sensor Pwr Hi
Delay for 100ms
2.C-code Containing
tmr1h=FCV_CAPTUREH; load pic tmr1h,tmr1l in flowcode
tmr1l=FCV_CAPTUREL;
3. Output 1 to the INIT pin
delay_us(10);or 20 micro seconds
4. C Icon contain g,initialize timer1 to zero
tmr1h = 0x00;
tmr1l = 0x00;
5. Wait for ECHO pin to go high
6. t1con = 0x3B; Start timer counting with 1 : 8 prescalar
7.Keep counting while ECHO pin is high (LOOP)
8. ECHO pin becomes LOW>>>>>C Icon containg
t1con.0 = 0; //Stop Timer1 Counting
FCV_CAPTUREH = tmr1h;get tmr1h value
FCV_CAPTUREL = tmr1l;get tmr1l value
9.Distance = ( ( CaptureH << 8 ) + CaptureL )/58, calculate distance in cm >>(distance is an integer)
10. Output a 0 to the INIT pin
11.delay 100 Milli seconds
12.Repeat again
Timer period= 262140 micro seconds = almost 1/3 second so there is no need for tmr1 overflow because the sensor will lower its echo before timer1 overflows 30milli seconds after echo goes high
so am i missing something here





- Attachments
-
- SRF05 sensor.fcf
- (4 KiB) Downloaded 319 times