Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Tic 834 , drive more than 127 stepper motor

Hello,
I would like use more than 127 stepper motor with a lot of Tic 834,
Would you have an examplefor arduino to use the pololu protocol to use the command
thank you
alain

Hello.

You can enable the 14-bit device number option on the Tic to use more than 127 of them on the same serial bus. Unfortunately, our Arduino library for the Tic controllers does not have support for 14-bit device numbers yet, so you would need to write your own function for sending those commands.

As described in the “Serial command encoding” section of the Tic user’s guide, when using a 14-bit device number, you will need to send 2 bytes to specify the device number instead of 1. Both of these bytes are between 0 and 127: the first byte holds the lower 7 bits of the device number and the second byte holds the upper 7 bits. The full byte sequence for a 7-bit write command using the Pololu protocol becomes:

0xAA, Device number low bits, Device number high bits, Command (with MSB cleared), Data

Arduino code for splitting the device number into two the lower 7 bits and upper 7 bits would look something like this:

int deviceNumber = 1023; //Can be anywhere from 0 to 16383

uint8_t deviceNumberLower = deviceNumber & 0x7F;
uint8_t deviceNumberUpper = (deviceNumber >> 7) & 0x7F;

Brandon

Thank you Brandon,
Could you show me a little bit of code to sent for exemple
for the tic no 1000, set targetposition at 200
thank you
alain

The format of the “Set target position” command is 32-bit write, so it will start with 0xAA then the device number bytes (like all Pololu Protocol commands), then the command byte with the MSB clear, and then the 5 data bytes, as described in the “Serial command encoding” section of the Tic user’s guide.

int deviceNumber = 1000; //Can be anywhere from 0 to 16383

uint8_t deviceNumberLower = deviceNumber & 0x7F;
uint8_t deviceNumberUpper = (deviceNumber >> 7) & 0x7F;

int32_t target = 200;

uint8_t msb = ((target >> 7) & 1) | ((target >> 14) & 2) | ((target >> 21) & 4) | ((target >> 28) & 8);
uint8_t data1 = (target >> 0) & 0x7F;
uint8_t data2 = (target >> 8) & 0x7F;
uint8_t data3 = (target >> 16) & 0x7F;
uint8_t data4 = (target >> 24) & 0x7F;

//start byte
Serial.write(0xAA);

//14-bit device number
Serial.write(deviceNumberLower); 
Serial.write(deviceNumberUpper);

//0xE0 command byte with MSB cleared
Serial.write(0x60); 

//data bytes for target position
Serial.write(msb); 
Serial.write(data1); 
Serial.write(data2);
Serial.write(data3);
Serial.write(data4);

Brandon