1. I have to measure time between two pulse signal coming on two pins.
As soon as rising edge comes on pin 1, I start the timer until second signal on other pin.
So basically time measurement is done between signal on two pins.
2. Code is
while(1)
{
rest all paras;
configure timer;
wait for pulse on pin 1;
start timer;
wait for pulse on second pin; /* when pulse comes on second pin, EXTI ISR read the timer value */
}
3. When I give 1us pulse diff on two pins, on first iteration of loop, I read 1.383us & for subsequent loops I read 1.35us.
(i.e when loop runs for first time)
Similarly for 11us, on first iteration of loop, I read 11.383us & for subsequent loops I read 11.35us.
Similarly for 111us, on first iteration of loop, I read 111.383us & for subsequent loops I read 111.35us.
Similarly for 500us, on first iteration of loop, I read 500.383us & for subsequent loops I read 500.35us or 500.717us.
4. I don't understand why error on first pulse.
5. Is there any method for calibration for measured time also or best way is to do the subtract the offset.
6. External pusles are generated at same pulse via another MCU.
As soon as rising edge comes on pin 1, I start the timer until second signal on other pin.
So basically time measurement is done between signal on two pins.
2. Code is
while(1)
{
rest all paras;
configure timer;
wait for pulse on pin 1;
start timer;
wait for pulse on second pin; /* when pulse comes on second pin, EXTI ISR read the timer value */
}
3. When I give 1us pulse diff on two pins, on first iteration of loop, I read 1.383us & for subsequent loops I read 1.35us.
(i.e when loop runs for first time)
Similarly for 11us, on first iteration of loop, I read 11.383us & for subsequent loops I read 11.35us.
Similarly for 111us, on first iteration of loop, I read 111.383us & for subsequent loops I read 111.35us.
Similarly for 500us, on first iteration of loop, I read 500.383us & for subsequent loops I read 500.35us or 500.717us.
4. I don't understand why error on first pulse.
5. Is there any method for calibration for measured time also or best way is to do the subtract the offset.
6. External pusles are generated at same pulse via another MCU.