User manual

TMCM-1161 TMCL Firmware V1.19 Manual (Rev. 1.04 / 2012-NOV-19) 43
www.trinamic.com
3.5.22 WAIT (wait for an event to occur)
This instruction interrupts the execution of the TMCL program until the specified condition is met. This
command is intended for standalone operation only.
The host address and the reply are only used to take the instruction to the TMCL program memory
while the program loads down. This command cannot be used in direct mode.
There are five different wait conditions that can be used:
TICKS: Wait until the number of timer ticks specified by the <ticks> parameter has been
reached.
POS: Wait until the target position of the motor specified by the <motor> parameter has been
reached. An optional timeout value (0 for no timeout) must be specified by the <ticks>
parameter.
REFSW: Wait until the reference switch of the motor specified by the <motor> parameter has
been triggered. An optional timeout value (0 for no timeout) must be specified by the <ticks>
parameter.
LIMSW: Wait until a limit switch of the motor specified by the <motor> parameter has been
triggered. An optional timeout value (0 for no timeout) must be specified by the <ticks>
parameter.
RFS: Wait until the reference search of the motor specified by the <motor> field has been
reached. An optional timeout value (0 for no timeout) must be specified by the <ticks>
parameter.
The timeout flag (ETO) will be set after a timeout limit has been reached. You can then use a JC ETO
command to check for such errors or clear the error using the CLE command.
Internal function: The TMCL program counter is held until the specified condition is met.
Related commands: JC, CLE
Mnemonic: WAIT <condition>, 0, <ticks>
where <condition> is TICKS|POS|REFSW|LIMSW|RFS
Binary representation:
INSTRUCTION NO.
TYPE
MOT/BANK
VALUE
27
0 TICKS - timer ticks*
1
don’t care
<no. of ticks*
1
>
1 POS - target position reached
<motor>*
2
<no. of ticks*
1
for timeout>,
0 for no timeout
2 REFSW reference switch
<motor>*
2
<no. of ticks*
1
for timeout>,
0 for no timeout
3 LIMSW limit switch
<motor>*
2
<no. of ticks*
1
for timeout>,
0 for no timeout
4 RFS reference search
completed
<motor>*
2
<no. of ticks*
1
for timeout>,
0 for no timeout
*
1
one tick is 10 milliseconds (in standard firmware)
*
2
motor number is always O as only one motor is involved
Example:
Wait for motor to reach its target position, without timeout
Mnemonic: WAIT POS, 0, 0
Binary:
Byte Index
0
2
3
4
5
6
7
Function
Target-
address
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Value (hex)
$01
$01
$00
$00
$00
$00
$00