Sabertooth 2X5
bomac06
Posts: 4
I have been trying to interface my propeller proto board for some time now.· I have tried using simple serial and the servo4 objects, but I only get random jittery movement.· Has anyone successfully interfaced with this motor control and would be will to share their code.
Thank You,
Bo
·
Thank You,
Bo
·
Comments
You have to use a resistor from your Prop pin to the signal pin on your servo.
Servo's can be a little different. In theory if you give it a 1.5 ms pulse... nothing should happen, that's the mid-point. a little less it moves one way, a little more it moves the other way. But I have some old servo's and the center point can be anything... often far less than 1.5 milliseconds. The entire cycle is supposed to be 20milliseconds... so, plus or minus a little... you have to subtract your "on" pulse from 20 milliseconds and then wait that long before you send another "on" pulse.
I have a servo hooked up to a bread board... and it works fine. But if I brush by one of my wires or move my board or wait long enough, it sometimes will hiccup.
I had some problems with the servo4 object. Just write your own.
Post your code... everybody will help.
Rich
Rich
This might help.· The top object is N64rjo.· You need two things to use it.· Your prop hooked up to a television and·a Nintendo64 controller... it takes one pin, no resistors.· hooked up to pin 4.· For more info on the controller see Oldbitcollector's Propeller Cookbook.· ucontroller.com
The display·will·give you feedback on your pulse width...··This is the beginning of a servo· calibrator... right now it allows you to set the start and end points of 2 servos...each using pins 23 and 24.
Don't· learn Spin programming from this example... I'm doing all kinds of things wrong... but it does· work.
the start point is adjusted with the A and B buttons... the endpoint is set using the left and right buttons.· Servo 1 is the left arrow ... servo 2 is selected with the right arrow.
hope it helps.
Rich
CON
· _clkmode = xtal1 + PLL16x
· _xinfreq = 5_000_000
OBJ
··· ext : "servo4"
PUB main
· ext.start(1500,0,1500,19,0,0,0,0)
·
· ext.move_to(0,2000,30)
· ext.move_to(1,2000,30)
· waitcnt(clkfreq + cnt)
· ext.move_to(0,1000,30)
· ext.move_to(1,1000,30)
· waitcnt(clkfreq + cnt)
· ext.move_to(0,1000,30)
· ext.move_to(1,2000,30)
· waitcnt((clkfreq) + cnt)
· ext.move_to(0,1000,20)
· ext.move_to(1,1000,20)
I also attempted to run the sabertooth 2X5 using the simple serial mode using the code below.
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
OBJ
· move : "simple_serial"
PUB main
·
··· move.start(-1,23,2400)
·
···
····· move.tx(85)
····· waitcnt(clkfreq + cnt)
····· move.tx(170)
····· waitcnt(clkfreq + cnt)
Both of these codes cause random behavior.· I connected the controller to a R/C radio and it worked fine.
Also, could any explain to me how this line of code works.· I know it is a little off topic, but it has been bugging me.
ctra := %00100_000 << 23 + 1 << 9 + 0
Thank You for all your help,
Bo
There is a very nice explanation of the general command in first section in the Counters Lab.
The first part (ctra := %00100_000 << 23) of the command is equivalent to ctra[noparse][[/noparse]30..26]:=%01000 ... sets ctrmode to POS detection. The second part of the command sets the bpin and apin.
To see what << does in this context look at page 14 of the Counters Lab.
Thank You,
Bo