Can someone please help me?
I don't know if this will help or not, but Bruce put together a nice little program here;
http://www.picbasic.co.uk/forum/showthread.php?p=23401
I'm not familiar with the PIC you're using, but if you have a CCP module I would give Bruce's program a shot, it looks like it should be very accurate.
Hope this helps.
Jerry.
If your oscilloscope costs more than your car...
"I need to time an incoming pulse that can be anywhere from 35 to 1000 mS long"...
My pulses are 600 or 1200 us long... There is a problem with PULSIN or with the hardware, I can't understanf why I have such fluctuation...
I think there's several sources of the variances.
But a large portion is probably because TMR2 is left running when you turn off the CCP module.
When you put it back in PWM mode again, TMR2 is at an unknown value, and if it's over 49 (PR2) then it could take up to 100us for it to roll-over to 0 again.
When you turn off the PWM, you should Stop TMR2 and reset it to 0.
added: Or maybe just zeroing TMR2 before starting the PWM will work.
<br>
Last edited by Darrel Taylor; - 29th April 2008 at 10:17. Reason: .
DT
Bookmarks