erratic pulsin returns if servo command running in background

afb

Member
Hi ya

I'm a newbie to PICAXE, though an old hand at BASIC. I'm writing a program for a radio control application that moves a servo through various sequences dependent on the transmitter stick position.

Running the finished program I found the thresholds at which sequences trigger seemed very jittery, so I wrote a short prog to monitor a nominal 1.5mSec input pulse from the servo tester I'm using during the development phase. I looped 100 times reading pulsin and stored the results from adjacent 20uSec slots in variables, then exited the loop and sent the results to the terminal window. Great, all 100 pulses fell in a single slot. Then I invoked the servo command (servo 4,150) once only at the start of the program before my 100x for-next loop. Disaster, I now find only about half of the 100 samples lie within the original slot, the remainder being spread over the 6 or 7 slots below the nominal 1.5mSec (ie measured too short)

Does some periodic internal housekeeping of the (issued) servo command interfere with the pulsin function? I can't find any warnings anywhere.

In the short term I have solved the problem by using pulsout, but it complicates my code having to continually loop to read pulsin to keep the servo refreshed at frame rate. I considered just slapping in a lot of hysteresis on the trigger points, but there's no guarantee quite what the measurement spread will be from the nominal input pulse width.

I invite your comments and suggestions

Thanks in advance

Alan
 

afb

Member
Thanks for the pointer to other's explanations, confirming my suspicions. My apologies for failing to find the apropriate thread myself - I'll look harder next time

Alan
 
Top