Shop OBEX P1 Docs P2 Docs Learn Events
Using the Pololu Motor Controller with the BS2px24 — Parallax Forums

Using the Pololu Motor Controller with the BS2px24

kingspudkingspud Posts: 128
edited 2007-01-28 04:25 in BASIC Stamp
Hello all,

I hope someone can help me with some code.

The document for the Pololu Dual Motor Controller card is rather bad.

Does anyone have code that I can test with the BS2px chip to use on one motor and code for two motors?

I have tried in vain to test the code in the doc and nothing happens!

Please help!!!!

Joe

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-01-27 22:14
    www.pololu.com/products/pololu/0101/smc01a_user_guide.pdf Have you tried the program on page 10?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • kingspudkingspud Posts: 128
    edited 2007-01-27 22:20
    Yes and I get nothing... no response from the motors... nothing.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-27 23:07
    Hello,

    Bear in mind that a BS2px has different timing and therefore uses different values for certain commands such as SEROUT and SERIN. Did you change these from the example code which is written for the BS2?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • kingspudkingspud Posts: 128
    edited 2007-01-27 23:09
    **** UPDATE ****

    I pulled out one of my BS2 stamps "the green one" and got it to work somewhat...

    Here is the code and here is what is happening!

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    speed VAR Byte

    HIGH 14

    LOW 15
    HIGH 15
    PAUSE 100

    DEBUG CLS, "1"
    FOR speed = 0 TO 127
    SEROUT 14,84,[noparse][[/noparse]$80, 0, 0, speed]
    PAUSE 20
    NEXT


    DEBUG CLS, "2"
    FOR speed = 127 TO 0
    SEROUT 14,84,[noparse][[/noparse]$80, 0, 0, speed]
    PAUSE 20
    NEXT


    DEBUG CLS, "3"
    FOR speed = 0 TO 127
    SEROUT 14,84,[noparse][[/noparse]$80, 0, 1, speed]
    PAUSE 20
    NEXT


    DEBUG CLS, "4"
    FOR speed = 127 TO 0
    SEROUT 14,84,[noparse][[/noparse]$80, 0, 1, speed]
    PAUSE 20
    NEXT




    When I run the program it does the following:

    You see a 1 in the debug window and
    Motor 0 starts to move and then immediately stops.

    When the window gets to number 2 it does nothing.

    When the window gets to number 3 it does nothing.

    When the window gets to number 4 it does nothing.

    I purchased two controller cards and the second one doesn't even move the motor!

    Do you think I have a bad controller cards?

    Joe
  • kingspudkingspud Posts: 128
    edited 2007-01-27 23:12
    Hi Chris,

    What do you make of this?

    Also, what are the SEROUT parameters for the BS2px24 chip?

    Thanks

    Joe
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-27 23:48
    Hello,

    There are some PBASIC Examples in the documentation. Have you tried these with the serial parameters for the BS2px? This information is included in the BASIC Stamp Manual as well as the Help File. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • kingspudkingspud Posts: 128
    edited 2007-01-28 04:14
    I think I may have found the problem, I figured out the correct program to run two motors

    ' This is the program to run two motor on the Pololu Dual motor controller
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    speed VAR Byte
    LOW 8
    HIGH 8
    PAUSE 100

    FOR speed = 0 TO 127
    SEROUT 10,32, [noparse][[/noparse]$80,0,0,speed]
    PAUSE 20
    NEXT
    FOR speed = 127 TO 0
    SEROUT 10,32, [noparse][[/noparse]$80,0,0,speed]
    PAUSE 20
    NEXT
    FOR speed = 0 TO 127
    SEROUT 10,32, [noparse][[/noparse]$80,0,1,speed]
    PAUSE 20
    NEXT
    FOR speed = 127 TO 0
    SEROUT 10,32, [noparse][[/noparse]$80,0,1,speed]
    PAUSE 20
    NEXT
    FOR speed = 0 TO 127
    SEROUT 10,32, [noparse][[/noparse]$80,0,2,speed]
    PAUSE 20
    NEXT
    FOR speed = 127 TO 0
    SEROUT 10,32, [noparse][[/noparse]$80,0,2,speed]
    PAUSE 20
    NEXT
    FOR speed = 0 TO 127
    SEROUT 10,32, [noparse][[/noparse]$80,0,3,speed]
    PAUSE 20
    NEXT
    FOR speed = 127 TO 0
    SEROUT 10,32, [noparse][[/noparse]$80,0,3,speed]
    PAUSE 20
    NEXT

    This worked for one of the controllers!

    but I need to know what the correct command is for configuring the motor controller
    for two motors?

    I tried to enter the configuration command:

    serout 8, 84, [noparse][[/noparse]$80,2,2] '2-motor mode, controlling motors 2 and 3

    Where stamp pin 8 goes to pin 4 on the controller

    but it doesn't work, the controller is still confirgured for one motor!

    Any help would be great!

    Thanks

    Joe
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-01-28 04:25
    kimgspud -

    It seems pretty obvious that you're not familiar with the SEROUT command, and specifically the BAUDMODE parameter, and it's significance. Do yourself a favor and read up on that topic either in the PBASIC Manual, or the PBASIC Help File and your problems will be all but over.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
Sign In or Register to comment.