User manual

TMCM-1640 TMCL Firmware V2.00 Manual (Rev. 2.00 / 2012-JUL-31) 30
www.trinamic.com
4.6.16 JC (jump conditional)
The JC instruction enables a conditional jump to a fixed address in the TMCL program memory, if the
specified condition is met. The conditions refer to the result of a preceding comparison. This function is for
standalone operation only. The host address and the reply are required to take the instruction to the TMCL
program memory while the TMCL program downloads. It is not possible to use this command in direct
mode.
Internal function: The TMCL program counter is set to the passed value if the arithmetic status flags are in
the appropriate state(s).
Related commands: JA, COMP, WAIT
Mnemonic: JC <condition>, <label>
where <condition>=ZE|NZ|EQ|NE|GT|GE|LT|LE|ETO|EAL
Binary representation:
COMMAND
TYPE
MOT/BANK
VALUE
21
0 ZE - zero
1 NZ - not zero
2 EQ - equal
3 NE - not equal
4 GT - greater
5 GE - greater/equal
6 LT - lower
7 LE - lower/equal
8 ETO - time out error
9 EAL - external alarm
don’t care
<jump address>
Example:
Jump to address given by the label when the position of the motor is greater than or equal to 1000.
GAP 1, 0, 0 //get axis parameter, type: no. 1 (actual position), motor: 0, value: 0 don’t care
COMP 1000 //compare actual value to 1000
JC GE, Label //jump, type: 5 greater/equal
...
...
Label: ROL 0, 1000
Binary format of JC GE, Label when Label is at address 10:
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
$15
$05
$00
$00
$00
$00
$0a