PDA

View Full Version : Servo control-Basic Atom?



sam
09-10-2008, 07:59 PM
Hello to all.

I have been loooking around a lot and I can't seem to find how to control servos with a Basic atom 28. The pro has the Hservo command. I assumed I coudl control some servos with the Basic Atom. I only have 4-5 so it's not that bad.

I can always connect the SSC-32 to the bot board, but I find it useless to have two board to control less than 5 servos. I also wanted to control it with a Ps2 so the bot board was interesting for this matter.

Can anyone help me on this matte?

Thanks a lot :D

Sam

DresnerRobotics
09-10-2008, 08:47 PM
http://www.basicmicro.com/downloads/docs/atom3_2.pdf

Page 138 explains the syntax. You have to pull the I/O pins low first, syntax is:

pulsout (port #),(position 1000-2000, etc)

The below sample code would center servos on channel 0, 1, & 2. Remember to always have that 20 ms pause after a servo command.



low 0
low 1
low 2

loop:
pulsout 0,1500
pulsout 1,1500
pulsout 2,1500
pause 20
goto loop

sam
09-11-2008, 06:38 PM
Well, I can't make it work with the Basic ATom, it won't connect.

Anyway I tried with the BS2 and it won't work! I don't know what I'm doing wrong!

Thanks

DresnerRobotics
09-11-2008, 09:00 PM
Exactly what won't connect?

sam
09-11-2008, 09:05 PM
Well, I tried both on the mini-ABB just to have the same board. I put the power, the light lights up. Then I use the Basic micro compiler for the atom 28. It doesn't detect anything with my USB to serial or just serial. Then I put in the Basic stamp with it's compiler and it works great (exept that it doesn't seem to control the servos, but that's probably my code that isn't correct) and compiles the program.

Thanks

inube
09-29-2008, 01:41 AM
On a related note:

What does the code look like for getting a servo to sweep from left to right? basic atom code pls

elios
09-29-2008, 01:44 AM
and change of subject again, this code seems awfully similar to PICAXE programming? am i right?

inube
09-29-2008, 01:48 AM
Specs say basic atom 28 is built around the 16F876 PICmicro MCU.

elios
09-29-2008, 01:56 AM
ooooooooowwwwwwwww............. yum yum........... that might be some potential fun....

elios
09-29-2008, 01:57 AM
does it use the same three pin serial download cable...? gnd pos & serial comms?

inube
09-29-2008, 02:02 AM
http://www.basicmicro.com/downloads/docs/atom28.pdf

elios
09-29-2008, 02:03 AM
thanks

elios
09-29-2008, 02:30 AM
obviously not... this is the basic command manual for PICAXXE ICs, not sure on how much help it will be, but it might be something to look at.

http://acronum.com/nz-en/picaxe_manual2.pdf

just uploaded it to my website now.

inube
09-29-2008, 11:07 PM
Elios ty for all your help.

I ended up with this:
----------------------------------
'Basic Atom 28
range var word
range = 1500
low p0
pulsout p0,1500
pause 40
sweep:
pulsout p0,range
pause 40
range = range +10
if range < 2200 then sweep
sweepl:
pulsout p0,range
pause 40
range = range -10
if range > 600 then sweepl
goto sweep
-----------------------------------

That pause 40 made the motion of the servo way less twitchy...

It works, since I'm a complete noob.. I do not think it too elegant or efficient. Varying the +10 , -10 to diff numbers lets me control the speed of the sweep.

Maybe someone can rewrite it for me. The servo I am using is a hs-311 datasheet says max values for rotation are 600 and 2200.

I'm using a Bot Board II.

elios
09-30-2008, 12:08 AM
ok, great that i was a help.... lolz