Hi Dick,
94 seconds is about right. If you run this through MPLAB with a breakpoint
set on NEXT, you'll see it takes 9.4 seconds total just to reach NEXT.
Run through 10-times, and you end up with around 94 seconds to complete
your 10 pass loop.
You're forgetting to add-in the over-head for PBP commands.
Try it with these changes for around 40.0366 S.Code:for i = 1 to 10 counter = 0 while counter < time*500 '(40*500*10 = 200,000) GPIO.4 = 1 '(75% duty cyle) pauseus 150 '(pwm = 5000 hz (.000200 sec. period)) GPIO.4 = 0 pauseus 50 counter = counter+1 wend next ' <-- Takes 9.4 seconds to get here the first time
Time = 29
while counter < time*493




Bookmarks