PDA

View Full Version : Using the Pololu Motor Controller with the BS2px24



kingspud
01-28-2007, 05:03 AM
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

Franklin
01-28-2007, 05:14 AM
www.pololu.com/products/pololu/0101/smc01a_user_guide.pdf (http://www.pololu.com/products/pololu/0101/smc01a_user_guide.pdf) Have you tried the program on page 10?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

kingspud
01-28-2007, 05:20 AM
Yes and I get nothing... no response from the motors... nothing.

Chris Savage
01-28-2007, 06:07 AM
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

kingspud
01-28-2007, 06:09 AM
**** 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,[$80, 0, 0, speed]
PAUSE 20
NEXT


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


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


DEBUG CLS, "4"
FOR speed = 127 TO 0
SEROUT 14,84,[$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

kingspud
01-28-2007, 06:12 AM
Hi Chris,

What do you make of this?

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

Thanks

Joe

Chris Savage
01-28-2007, 06:48 AM
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

kingspud
01-28-2007, 11:14 AM
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, [$80,0,0,speed]
PAUSE 20
NEXT
FOR speed = 127 TO 0
SEROUT 10,32, [$80,0,0,speed]
PAUSE 20
NEXT
FOR speed = 0 TO 127
SEROUT 10,32, [$80,0,1,speed]
PAUSE 20
NEXT
FOR speed = 127 TO 0
SEROUT 10,32, [$80,0,1,speed]
PAUSE 20
NEXT
FOR speed = 0 TO 127
SEROUT 10,32, [$80,0,2,speed]
PAUSE 20
NEXT
FOR speed = 127 TO 0
SEROUT 10,32, [$80,0,2,speed]
PAUSE 20
NEXT
FOR speed = 0 TO 127
SEROUT 10,32, [$80,0,3,speed]
PAUSE 20
NEXT
FOR speed = 127 TO 0
SEROUT 10,32, [$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, [$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 Bates
01-28-2007, 11:25 AM
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 -->