TMCM-6212 TMCL
™
Firmware Manual • Firmware Version V1.11 | Document Revision V1.07 • 2019-JAN-25
84 / 140
3.6.42
CALL (Conditional Subroutine Call)
The CALL command calls a subroutine in the TMCL program, but only if the specifed condition is met.
Otherwise the program execution will be continued with the next command following the CALL command.
The conditions refer to the result of a preceding comparison or assignment.
This command is intended for
standalone operation only.
Internal function:
When the condition is met the actual TMCL program counter value will be saved to
an internal stack. Afterwards the program counter will be overwritten with the address supplied to this
command. The number of entries in the internal stack is limited to 8. This also limits nesting of subroutine
calls to 8. The command will be ignored if there is no more stack space left.
Related commands:
RSUB, JC.
Mnemonic:
CALL <condition>, <label>
Binary Representation
Instruction
Type
Motor/Bank
Value
21
0 ZE - zero
0 (don’t care)
<jump address>
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
10 EDV - deviation error
11 EPO - position error
Example
Call a subroutine if a condition is met:
Loop :
2
GIO 0, 1
// read analog value
CALC SUB , 512
// subtract 512
4
COMP 0
// compare with zero
CALL LT , RunLeft
// Call routine " RunLeft " if accu <0
6
CALL ZE , MotorStop
// Call routine " MotosStop " if accu =0
CALL GT , RunRight
// Call routine " RunRight " if accu >0
8
JA Loop
10
RunLeft :
CALC MUL , -1
12
ROLA 0
RSUB
©2019 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at