Timer1 and capture function
Posted: Thu May 24, 2012 4:03 pm
Hello,
I have some problems to use capture function with timer1. Iwork with matix development board EB006-00-7 and pic 16F877A.
My goal is to mesure square signal of 10Hz ,given by a signal generator on every rising edge.
For this, I chose to use capture fonction to read timer1 values ,I mean ccp1l and ccp1h (2 bytes)
Before to read these two values Istop timer1 and put it on after the reading as it is said in the datasheet, and I reset timer1 for another count.
I use an user interrpt to configure registers.
I configure (internal clock/4) and prescaler=8, so clock count for timer1 =614400Hz or T=1.62µs
frequency=10 Hz -> T=100ms timer1 count=(100ms/1.62µs)=61728
I wait for this result: ccp1h=241 and ccp1l=16 ,but the result is very unstable on my LCD display.
I give you my simple code .
Would you help me to understand where I made an error.
Thank you very much
Stéphan
I have some problems to use capture function with timer1. Iwork with matix development board EB006-00-7 and pic 16F877A.
My goal is to mesure square signal of 10Hz ,given by a signal generator on every rising edge.
For this, I chose to use capture fonction to read timer1 values ,I mean ccp1l and ccp1h (2 bytes)
Before to read these two values Istop timer1 and put it on after the reading as it is said in the datasheet, and I reset timer1 for another count.
I use an user interrpt to configure registers.
I configure (internal clock/4) and prescaler=8, so clock count for timer1 =614400Hz or T=1.62µs
frequency=10 Hz -> T=100ms timer1 count=(100ms/1.62µs)=61728
I wait for this result: ccp1h=241 and ccp1l=16 ,but the result is very unstable on my LCD display.
I give you my simple code .
Would you help me to understand where I made an error.
Thank you very much
Stéphan