Shop OBEX P1 Docs P2 Docs Learn Events
Sabertooth 2X5 — Parallax Forums

Sabertooth 2X5

bomac06bomac06 Posts: 4
edited 2007-10-07 00:37 in Propeller 1
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
·

Comments

  • rjo_rjo_ Posts: 1,825
    edited 2007-10-04 03:25
    Bo,

    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
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-04 03:31
    By the way... Parallax servo-s work exactly the way they are supposed to. So... maybe it is your code... and maybe it is your servo.

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-04 23:45
    Bo,

    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
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-04 23:53
    and ... up and down on the joystick moves between the start and end points.
  • bomac06bomac06 Posts: 4
    edited 2007-10-05 02:06
    This is the code that I have tried so far.

    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



  • bomac06bomac06 Posts: 4
    edited 2007-10-05 02:09
    I know it is very simple, but I am just trying to establish communications.
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-05 22:43
    The counters are the best kept secret.

    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.
  • bomac06bomac06 Posts: 4
    edited 2007-10-07 00:37
    After completing the two shifts, what is the final 32-bit mask and how does it get there.· I am familiar with shifting for a motorola hc12, and this command seems a little confusing in that context.· In adding 1, are you adding 1 to the bitmask or 1 to the amount of the shift.· I am still learning and any help would be greatly appreciated.·

    Thank You,
    Bo
Sign In or Register to comment.