Navigating the motor, Inquiring the actual position of a motor – RMS Technologies 4-AXIS CONTROLLER/DRIVER User Manual

Page 18

Advertising
background image

18

S I X P A C K / Q U A D P A C K

Trinamic Motion Control GmbH & Co KG

Sternstraße 67

D – 20357 Hamburg, Germany

Phone +49-40-51 48 06 - 0

FAX: +49-40-51 48 06 - 60

http://www.trinamic.com

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 PACKs

sendToPack($23);

// Command for starting a trapezoidal Ramp

sendToPack(motnr);

// 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

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 PACKs

sendToPack($20);

// Command for inquiring actual position and action of one motor

sendToPack(motnr);

// 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

motnr = 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

Advertising