Table of Contents - TG Drives
Table of Contents - TG Drives Table of Contents - TG Drives
28 Mnemonic Operators PL2 NATIVE POSITION LANGUAGE > TRUE if shortest way from Argument1 to Argument2 is clockwise. < TRUE if shortest way from Argument1 to Argument2 is counterclockwise. >= TRUE if Argument1 equals Argument2 or if shortest way from Argument1 to Argument2 is clockwise. Shift binary Argument1 to the right by Argument2 steps. AND Bit wise AND of arguments. For IF or WAIT mnemonics: TRUE if result is non-zero. EXOR Bit-wise EXCLUSIVE OR of ARGUMENTS. NOTE: EXOR can be used to perform a NOT function using: Let R10 = Argument1 EXOR -1. MOD Take Argument1 modulo Argument2.Remainder of the division Argument1/Argument2. Example: R0 = 107 mod 10; R0 will be assigned the value 7. OR Bit wise OR of arguments. For IF or WAIT mnemonics, TRUE if result is non-zero. MNEMONIC OPERATORS Op Operator; each statement has its own supported operators (see following). IFcOp One of: = < > = IfOp One of: OR AND = = < > THEN PosOp One of: ABORT ABS INC REL ’MOD ON CLR’’MOD OFF CLR’ ’MOD ON’ ’MOD OFF’ ProfOp One of: ACC THEN Either THEN or , (comma) WcOp One of: = < > = WOp One of: OR AND = = < > (none) LetOp One of: EXOR OR AND > |< |> MOD / * - + MULDIV DIVMUL User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001
PL2 NATIVE POSITION LANGUAGE SCALING MNEMONIC OPERATORS Compiler Extensions The operation uses full 64-bit precision in the multiplication and division. In the case of an overflow in the result will be ±MAXINT. (2147483647) DIVMUL LET = DIVMUL Arg1= 65536*Arg2 Arg3 MULDIV LET = MULDIV Arg1= Arg2*Arg3 65536 Internal calculations are made with 64 bit arithmetic. The user must handle overflow. Example usage of the MULDIV and DIVMUL operators: ; Assume a 4 pole motor ; If we want to convert one motor revolution into a ; position of 1000 ; calculate the conversion factor r100 = 1000 DIVMUL Motor.PPR r200 = rd1.pos MULDIV r100 disp r200 COMPILER EXTENSIONS [ ] Angle brackets are meta symbols implying that text is optional. addr_of @ An address of operator can be used to obtain the line number for the start of a profile or Program. The ’@’ symbol designates the address of an operator. Example: [Let] R10 = @Profile ;Ex 1. Profile Acc @Profile ;Ex 2 Vector.CycInt = @MyTimProg ;Ex 3. Ex1. Load R10 with the line number where the profile ”Profile” is defined. Ex2. Start the profile ”Profile”. Ex3. Load the vector for cyclic interrupts to point to the interrupt routine ”MyTimProg”. cond_expr A conditional expression used with conditional compilation directives using the form: .if const_expr cond_operator const_expr. const A constant value of type LConst or Sconst const_expr Any expression which result in a constant value. Constant expressions consist of VSymbols, Operator[s] and const. Parentheses can be used to alter the normal operator precedence and associatively rules. .define FOO = 10 / 2 + 1 ; Evaluates to 6 .define BAR = 10 / (2 + 1) ; Evaluates to 3 dyn_expr A dynamic expression which is evaluated during run time. The DMC 2 has the capability of embedding dynamic expressions in its instruction set. Dynamic expression consists of const_expr, User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001 29
- Page 1 and 2: HEAD OFFICE INMOTION TECHNOLOGIES A
- Page 3 and 4: Table of Contents Table of Contents
- Page 5 and 6: Related items .....................
- Page 7 and 8: Related items .....................
- Page 9: Creating/Editing Source Code ......
- Page 12 and 13: 12 System architecture register val
- Page 14 and 15: 14 B002 Timing and execution flow T
- Page 16 and 17: 16 Function Block Diagram SOFTWARE
- Page 18 and 19: 18 Function Block Diagram Figure 5.
- Page 20 and 21: 20 Function Block Diagram Function
- Page 22 and 23: 22 Load a new firmware release SOFT
- Page 24 and 25: 24 User's Manual 5.1 Inmotion Techn
- Page 26 and 27: 26 Argument types executing results
- Page 30 and 31: 30 Compiler Symbols PL2 NATIVE POSI
- Page 32 and 33: 32 Compiler directives PL2 NATIVE P
- Page 34 and 35: 34 Compiler directives Warnings: No
- Page 36 and 37: 36 Spline function compilation dire
- Page 38 and 39: 38 Multiline Macro MACRO DEFINITION
- Page 41 and 42: PL2 Mnemonics GENERAL The general f
- Page 43 and 44: PL2 MNEMONICS Standard set Mnemonic
- Page 45 and 46: PL2 MNEMONICS TRACE RELATED MNEMONI
- Page 47 and 48: PL2 MNEMONICS Indexed Addressing Mn
- Page 49 and 50: PL2 MNEMONICS If r_length < r_Membe
- Page 51 and 52: PL2 MNEMONICS Text mode \000 Intern
- Page 53 and 54: Extended register groups INTRODUCTI
- Page 55 and 56: EXTENDED REGISTER GROUPS STACK HAND
- Page 57 and 58: EXTENDED REGISTER GROUPS RD1, Resol
- Page 59 and 60: EXTENDED REGISTER GROUPS RD1, Resol
- Page 61 and 62: EXTENDED REGISTER GROUPS RD1.FiltSp
- Page 63 and 64: EXTENDED REGISTER GROUPS RD2, Resol
- Page 65 and 66: EXTENDED REGISTER GROUPS RD2, Resol
- Page 67 and 68: EXTENDED REGISTER GROUPS RD2.ChkLow
- Page 69 and 70: EXTENDED REGISTER GROUPS Pos Inc Pr
- Page 71 and 72: EXTENDED REGISTER GROUPS Pg.ASpeed
- Page 73 and 74: EXTENDED REGISTER GROUPS MOTOR, MOT
- Page 75 and 76: EXTENDED REGISTER GROUPS 2-Pole: 81
- Page 77 and 78: EXTENDED REGISTER GROUPS Motor.Base
PL2 NATIVE POSITION LANGUAGE<br />
SCALING MNEMONIC OPERATORS<br />
Compiler Extensions<br />
The operation uses full 64-bit precision in the multiplication and division. In the<br />
case <strong>of</strong> an overflow in the result will be ±MAXINT. (2147483647)<br />
DIVMUL LET = DIVMUL <br />
Arg1= 65536*Arg2<br />
Arg3<br />
MULDIV LET = MULDIV <br />
Arg1= Arg2*Arg3<br />
65536<br />
Internal calculations are made with 64 bit arithmetic. The user must handle<br />
overflow.<br />
Example usage <strong>of</strong> the MULDIV and DIVMUL operators:<br />
; Assume a 4 pole motor<br />
; If we want to convert one motor revolution into a<br />
; position <strong>of</strong> 1000<br />
; calculate the conversion factor<br />
r100 = 1000 DIVMUL Motor.PPR<br />
<br />
r200 = rd1.pos MULDIV r100<br />
disp r200<br />
COMPILER EXTENSIONS<br />
[ ] Angle brackets are meta symbols implying that text is optional.<br />
addr_<strong>of</strong> @ An address <strong>of</strong> operator can be used to obtain the line number<br />
for the start <strong>of</strong> a pr<strong>of</strong>ile or Program. The ’@’ symbol<br />
designates the address <strong>of</strong> an operator. Example:<br />
[Let] R10 = @Pr<strong>of</strong>ile ;Ex 1.<br />
Pr<strong>of</strong>ile Acc @Pr<strong>of</strong>ile ;Ex 2<br />
Vector.CycInt = @MyTimProg ;Ex 3.<br />
Ex1. Load R10 with the line number where the pr<strong>of</strong>ile ”Pr<strong>of</strong>ile”<br />
is defined.<br />
Ex2. Start the pr<strong>of</strong>ile ”Pr<strong>of</strong>ile”.<br />
Ex3. Load the vector for cyclic interrupts to point to the<br />
interrupt routine ”MyTimProg”.<br />
cond_expr A conditional expression used with conditional compilation<br />
directives using the form:<br />
.if const_expr cond_operator const_expr.<br />
const A constant value <strong>of</strong> type LConst or Sconst<br />
const_expr Any expression which result in a constant value. Constant<br />
expressions consist <strong>of</strong> VSymbols, Operator[s] and const.<br />
Parentheses can be used to alter the normal operator<br />
precedence and associatively rules.<br />
.define FOO = 10 / 2 + 1 ; Evaluates to 6<br />
.define BAR = 10 / (2 + 1) ; Evaluates to 3<br />
dyn_expr A dynamic expression which is evaluated during run time. The<br />
DMC 2 has the capability <strong>of</strong> embedding dynamic expressions in<br />
its instruction set. Dynamic expression consists <strong>of</strong> const_expr,<br />
User's Manual 5.1 Inmotion Technologies AB<br />
Doc. No.9032 0027 01 (B), Rev. 11.07.2001<br />
29