Program Loop Timing Jitter
Djim
Posts: 4
Hi, I was trying to make a repeating PWM loop on a BS2 through an output pin that is 50us ON and 9000us OFF.· Tried this using pulsout for the 50us and pause for the 9ms: these are put into a program loop.· I need the repetition rate to be very precise, i.e. I need something like 50us +-10us for on and the 9500us +-10us for off.·· Apparently pulsin is triggered by an interrupt and faces significant timing variation and the program loop execution cycles may also be adding to timing jitter.·
Any suggestions on how this might be accomplished?· I also looked at PWM, SEROUT; would those be better possibilities?
thanks
Any suggestions on how this might be accomplished?· I also looked at PWM, SEROUT; would those be better possibilities?
thanks
Comments
-Phil
Setup:
HIGH 0 ' make P0 low (LED off)
Main:
PULSOUT 0, 25 '50us pulse
PAUSE 9 ' Pause 9ms
GOTO main
END
-Phil
BTW, which is it for "off"? 9000µsec or 9500µsec. Your first post gives both figures. Once I have that, I can give you a way to nail the timing a lot closer.
Post Edited (Phil Pilgrim (PhiPi)) : 9/18/2008 6:20:42 AM GMT
Oh, and usually "jitter" means a back-and-forth inaccuracy in some timing signal. If the signal is rock-steady, just not quite correct, that's "inaccurate", not "jitter".
Thanks for the info.·· For the purposes of this discussion the off time can just be 9ms.· Buts thanks for the valuable suggestion on using pulsout on another pin if you need off time more or less than 1ms that will be valuable.
I am going back to the scope this am to make sure there is not a mistake.·· I was measuring the jitter with an NI card running 100mhz but maybe there is something funny going on there.··
How many command lines per sec can a BS2 run?
thanks
-Phil
thanks
Here's the program I used for the scope trace:
But your original program didn't jitter either.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 9/18/2008 5:23:53 PM GMT
PAUSE does not use a timing interrupt. You might be thinking of SLEEP and NAP.
-Phil