timing an input pulse
Posted: Sun Oct 29, 2006 2:04 pm
Hi
I am new to PICs and my main interest is in RC models.
I need to time an input pulse from the reciever. These are typically 1 to 2 milliseconds long and occur every 20 milliseconds.
I was trying to setup a basic timing loop with a 10us resolution but cannot set a delay in the loop below 1ms using flowcode.
The loop was something like this;
Is input high
if yes wait for 10us
is the input still high
if yes continue loop
if no store vale and move on
Anyone any ideas on how to do this?
The second part im trying to achieve is ;
Is this time <= 1.4 ms
if yes set an output high
if no is time>=1.6ms
if yes set output high
if no set output low
go back and wait for next pulse
Any help appreciated
Iain
I am new to PICs and my main interest is in RC models.
I need to time an input pulse from the reciever. These are typically 1 to 2 milliseconds long and occur every 20 milliseconds.
I was trying to setup a basic timing loop with a 10us resolution but cannot set a delay in the loop below 1ms using flowcode.
The loop was something like this;
Is input high
if yes wait for 10us
is the input still high
if yes continue loop
if no store vale and move on
Anyone any ideas on how to do this?
The second part im trying to achieve is ;
Is this time <= 1.4 ms
if yes set an output high
if no is time>=1.6ms
if yes set output high
if no set output low
go back and wait for next pulse
Any help appreciated
Iain