TMCM-1310 TMCL Firmware V1.11 Manual (Rev. 1.16 / 2014-MAR-19)
47
www.trinamic.com
6.8.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.
T
HERE 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>
Binary representation:
INSTRUCTION NO.
TYPE <condition>
MOT/BANK
VALUE
27
0 TICKS - timer ticks*
1
don’t care
<no. of ticks*>
1 POS - target position reached
<motor>
0*
<no. of ticks* for timeout>,
0 for no timeout
2 REFSW – reference switch
<motor>
0*
<no. of ticks* for timeout>,
0 for no timeout
3 LIMSW – limit switch
<motor>
0*
<no. of ticks* for timeout>,
0 for no timeout
4 RFS – reference search completed
<motor>
0*
<no. of ticks* for timeout>,
0 for no timeout
* Motor number is always 0 as only one motor is involved.
*
1
One tick is 10 milliseconds.
Example:
Wait for motor 0 to reach its target position, without timeout
Mnemonic:
WAIT POS, 0, 0
Binary
:
Byte Index
0
1
2
3
4
5
6
7
Function
Target-
address
Instruction
Number
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Value (hex)
$01
$1b
$01
$00
$00
$00
$00
$00