Any way to generate an edge with zero latency on trigger?
Posted: Thu Feb 07, 2008 4:50 pm
Hi all!
As far as I can see there is no way to generate a zero-latency rising or falling edge on a PIC's output pin when an external trigger edge arrives on another pin. Or am I wrong? If there is such a possibility e.g. on a dsPIC please let me know.
I am looking for something like the "zero-latency edge generation" from the CCP module when this is set to compare mode and the corresponding timer reaches a preset value.
If there is no such thing I will have to use an interrupt like int_ext but this means there will be some interrupt latency which can take some time on a PIC18. To measure this interrupt latency exactly I would trigger the CCP module in capture mode and catch the exact position of the timer when the trigger edge arrives. Then when I get into the CCP ISR I will compare the current timer value with the catched timer value. This way I can tell exactly how much time has passed since the external trigger edge arrived. Is this correct?
Best regards and thank you for any help,
Zer0flag
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
Posted: Thu Feb 07, 2008 7:58 pm
How about having a PIC pin run to an external AND gate that passes the input to the output when conditions merit? _________________ The search for better is endless. Instead simply find very good and get the job done.
Zer0flag Guest
Posted: Fri Feb 08, 2008 3:14 am
Thank you. Actually I was thinking of something like that. I wanted to make sure that there is no PIC-internal way to do it.
SherpaDoug wrote:
How about having a PIC pin run to an external AND gate that passes the input to the output when conditions merit?
kolio
Joined: 06 Feb 2008 Posts: 26
Posted: Fri Feb 08, 2008 4:48 am
What about using built-in comparator and its output?
Zer0flag Guest
Posted: Sat Feb 09, 2008 4:24 am
kolio wrote:
What about using built-in comparator and its output?
Thank you for the tip kolio! I will look at that possibility. On the other hand I think it is better to generate my rising edge outside of the PIC when my external trigger arrives and to use the capture module of the PIC to capture the timer value at this point in time. This way I will know exactly when the trigger has fired and will be able to use the compare module in order to generate the falling edge. So I should be able to generate a pulse with exact width.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum