SIXpack 2 – Manual (V1.10 / January 29
th
, 2010)
26
6.2.2.2
Navigating the motor
CMD $23 prompts the concerned motor to drive to the position, which stands in P1 ... P4.
Pseudocode:
sendToPack(address);
// Address of the
SIXpack2
sendToPack($23);
// Command for starting a trapezoidal Ramp
sendToPack(motno);
// Number of the concerned motor (0...5)
sendToPack(destinationLSB);
// Least significant Byte of the target position
sendToPack(destination3rdSB);
sendToPack(destination2ndSB);
sendToPack(destinationMSB);
// Most significant Byte
sendToPack(0);
// fill 9 bytes
sendToPack(0);
// fill 9 bytes
6.2.2.3
Inquiring the actual position of a motor
CMD $20 returns the 4-byte value with the actual position and status of the concerned motor. In addition P6
specifies whether a stop-switch was active. This is e.g. when the motor has lost steps and if during driving back to
the real null-point the switch is found too early.
Pseudocode:
sendToPack(address);
// Address of the
SIXpack
sendToPack($20);
// Command for inquiring actual position and action of one motor
sendToPack(motno);
// Number of the concerned motor (0...5)
sendToPack(receiver);
// address of the receiver
sendToPack(0);
// fill 9 bytes
sendToPack(0);
// fill 9 bytes
sendToPack(0);
// fill 9 bytes
sendToPack(0);
// fill 9 bytes
sendToPack(0);
// fill 9 bytes
cmd = receiveFromPack();
// should be $20
motno = receiveFromPack();
// should be the same number as the sent
posakt_byte1 = receiveFromPack();
// LSB of the actual Position
posakt_byte2 = receiveFromPack();
posakt_byte3 = receiveFromPack();
posakt_byte4 = receiveFromPack();
// MSB of the actual Position
act_action = receiveFromPack();
// Information about the actual action of the motor
stop = receiveFromPack();
// is 1 when null-switch is active