Table of Contents - TG Drives

Table of Contents - TG Drives Table of Contents - TG Drives

28.11.2012 Views

30 Compiler Symbols PL2 NATIVE POSITION LANGUAGE Reg, XReg, or instruction-dependent operators. Use parentheses to force the compiler to parse the expression if the expression is a const_expr.Format: [Let] Reg = Reg let_operator SConst [Let] XReg = XReg let_operator SConst Example: [Let] MyRegister = MyRegister * MyValue + 3 MyValue + 3 is a const_expr and is evaluated during compilation. indirect_reg Designates an internal 32-bit register and is accessed as R(Rnnn). COMPILER SYMBOLS A symbol can contain the letters “A” to “Z” and “a” to “z”, the underscore ’_’ character, and digits “0” to “9”. With the following restrictions: • The first character must be a letter or an underscore. • By default, the compiler recognizes only the first 64 characters as significant. VSymbol Alias for a value. A VSymbol can be used as an alias for const or const_expr. VSymbols are constant values and are defined using .DEFINE directives. Example: .DEFINE ENDPOS = 1000 .DEFINE STAPOS = ENDPOS + 2000 RSymbol Alias for a register. RSymbols that can be used as an alias for Reg. Rsymbols are constant values and are defined using .DEFINE directives. Example: .DEFINE REG12 = R12 .DEFINE MAXSPD = REG12 XSymbol Alias for an extended register. An XSymbol can be used as an alias for XReg. XSymbols are constant values and are defined using .DEFINE directives. Example: .DEFINE MPOLES = Motor.Poles .DEFINE MPOL = MPOLES ISymbol Alias for an indirect register address. An ISymbol can be used as an alias for an indirect_reg. ISymbols are constant values are defined using .DEFINE directives. Example: .DEFINE IDXREG = R(R40) .DEFINE IDX = IDXREG .DEFINE IDXFOO = R(REG12) ISymbol Alias for an indirect register address. An ISymbol can be used as an alias for an indirect_reg. ISymbols are constant values are defined using .DEFINE directives. Example: .DEFINE IDXREG = R(R40) .DEFINE IDX = IDXREG .DEFINE IDXFOO = R(REG12) User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001

PL2 NATIVE POSITION LANGUAGE Special Compiler Functions LSymbol Alias for line number. An LSymbol can be used as an alias for a line_number. Lsymbols are used when a line_number is referenced, such as: GOTO Start Vector.CycInt, @Cyclic Vector.PosErr, @Error line_number Line numbers can be specified in two forms: Absolute and Relative. The typical form is: label [:] program statement A label becomes an LSymbol if it starts with a character and ends with a colon symbol; this is the relative line_number form. Example: Start: Pg.Speed = 10000 The label can be a number, in which case the line number is absolute. 10 PG.Speed = 10000 The last definition has the side effect to define the location counter to 10, just as if it was preceded by the line: .ORG 10 The reason for this is that the PL compiler also should be able to compile programs uploaded from a motion controller. space_char The space character has significance in the DMC compiler. Example: L E T R 1 0 = 5 0 LETR10=50 The above statements are not equivalent, it must be typed as, LETR10=50 Or LETR10 = 50 PREDEFINED COMPILER SYMBOLS _DMC_ Is defined when the DMC compiler is used. _V0500_ Is defined if version 5 of the compiler is used SPECIAL COMPILER FUNCTIONS The Pl2 Language compiler has the following special mathematical functions: Sin (a ,b ,c) Cos (a ,b ,c) The Sine and Cosine can be used to calculate constant values for cam tables or similar applications. The functions are evaluated as: Sin (angle, period, amplitude) = amplitude * Sine(angle/period), angle/period is in radians Cos (angle ,period, amplitude) = amplitude * Cosine( angle/period ) User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001 31

PL2 NATIVE POSITION LANGUAGE<br />

Special Compiler Functions<br />

LSymbol Alias for line number. An LSymbol can be used as an alias for<br />

a line_number. Lsymbols are used when a line_number is<br />

referenced, such as:<br />

GOTO Start<br />

Vector.CycInt, @Cyclic<br />

Vector.PosErr, @Error<br />

line_number Line numbers can be specified in two forms: Absolute and<br />

Relative. The typical form is:<br />

label [:] program statement<br />

A label becomes an LSymbol if it starts with a character and<br />

ends with a colon symbol; this is the relative line_number<br />

form.<br />

Example:<br />

Start: Pg.Speed = 10000<br />

The label can be a number, in which case the line number is<br />

absolute.<br />

10 PG.Speed = 10000<br />

The last definition has the side effect to define the location<br />

counter to 10, just as if it was preceded by the line:<br />

.ORG 10<br />

The reason for this is that the PL compiler also should be able<br />

to compile programs uploaded from a motion controller.<br />

space_char The space character has significance in the DMC compiler.<br />

Example:<br />

L E T R 1 0 = 5 0 LETR10=50<br />

The above statements are not equivalent, it must be typed as,<br />

LETR10=50<br />

Or<br />

LETR10 = 50<br />

PREDEFINED COMPILER SYMBOLS<br />

_DMC_ Is defined when the DMC compiler is used.<br />

_V0500_ Is defined if version 5 <strong>of</strong> the compiler is used<br />

SPECIAL COMPILER FUNCTIONS<br />

The Pl2 Language compiler has the following special mathematical functions:<br />

Sin (a ,b ,c)<br />

Cos (a ,b ,c)<br />

The Sine and Cosine can be used to calculate constant values for cam tables or<br />

similar applications.<br />

The functions are evaluated as:<br />

Sin (angle, period, amplitude) = amplitude * Sine(angle/period), angle/period is in<br />

radians<br />

Cos (angle ,period, amplitude) = amplitude * Cosine( angle/period )<br />

User's Manual 5.1 Inmotion Technologies AB<br />

Doc. No.9032 0027 01 (B), Rev. 11.07.2001<br />

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!