Discussion forum for the BasicX family of microcontroller chips.
So far in May, you have voted 0 times ou of a total of 20 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.
Is this thread worth a thumbs up?
Here are a few of the problems usually encountered|
in controlling servos, and a different approach.
1. The grounds for the servo power and the BX have to
be connected. Seems simple, but many of my students
forget to do this.
2. Servo manufacturers differ somewhat but in general
a servo wants a pulse width between 1 and 2 milliseconds
to control the position. This pulse should be applied every
20 milliseconds or so, the time is not critical. As in,
call pulseout(servo, 0.015)
3. The thing I don't lilke about the above approach is that
every time more code is added to the program the delay
has to be adjusted. The time is not critical, I don't know
what the limits are, but too short or long an interval doesn't
work. Another way is to use the BX internal timer on pins
26 or 27. Download the BX application on Dual PWM in
Background Using Timer1.
and Call InitializePWM with a value of 4. this gives a period of
about 17.7 ms. Then Call PutPinPWM with a duty cycle to give a
pulse with between 1 and 2 ms, ie a value between about 0.056
Each call to PutPinPWM will change the servo position
and hold it there independent of the rest of the BX code.
> listen - i know im sounding like a complete loser when i ask this
> - but I
>am really just beginning with the BASICX board and servos and am kinda lost.
>I have a servo set up with the 5V supply and I am sending a signal to the
>servo to move, however, no response is found. But, if i pull the connector
>to the servo off then back on then off again, the servo jerks - this leads
>me to believe that i have the timer off. here is my code now:
> Call PulseOut(12,1382,1)
> Call Sleep(30)
>its suppose to sleep for 30ms so i know that the last sleep call is wrong
>but how do i fix it? thanx in advance >
>The TRUE beginner - Matt