User's Manual

Turbo PMAC User Manual
Writing and Executing PLC Programs 377
For variables referencing fixed locations in Turbo PMAC’s memory and I/O space, the L-variables will
simply replace M-variables, and the L-variable definition will be made exactly like the M-variable
definitions. It is completely acceptable to retain the M-variable definition as well. You will probably
want to retain the M-variable definitions for debugging purposes, because Turbo PMAC will not accept a
query command for the value or definition of an L-variable. Often, you will use identical L-variable and
M-variable definitions.
For example, Machine Output 1 and Machine Input 1 on the JOPTO port typically are referenced by the
following definitions in uncompiled programs:
M1->Y:$078F02,8 ; Machine Output 1
M11->Y:$078F02,0 ; Machine Input 1
For the compiled PLC programs, you could create equivalent M-variable definitions:
L1->Y:$078F02,8 ; Machine Output 1
L11->Y:$078F02,0 ; Machine Input 1
A small routine in a compiled PLC to make Machine Output 1 follow Machine Input 1 would be:
IF (L11=1)
L1=1
ELSE
L1=0
ENDIF
You may access a register in one program statement with an L-variable, and then access the same register,
even the same part of the register, in another program statement with an integer M-variable or I-variable.
Mixing L-variable access and P- or Q-variable access to a P- or Q-variable register will yield nonsensical
results, because the P- and Q-variable access always treats the register as a floating-point number.
F-Variables: Long Floating-Point Pointers
F-variables are pointers to long (48-bit) registers. If the F-variable definition is an L format (e.g. F1-
>L:$10F0), the register is accessed as a 48-bit floating-point register. If the F-variable definition is a D
format variable (e.g. F2->D:$88), the register is accessed as a 48-bit signed integer, but conversion to
or from Turbo PMAC’s 48-bit floating-point format is automatically performed, so it can be used in
floating-point mathematics.
Note:
The use of F-variables requires the PRO series of PMAC Executive program
(PEWIN32PRO) and Turbo PMAC firmware revision 1.938 or newer.
Turbo PMAC itself cannot recognize L-variables or F-variables; these variables have meaning only to the
compiler on the host computer. Turbo PMAC will reject any uncompiled command containing an L-
variable that is sent to it.
Note:
Do not confuse L-variables, which are short-word compiler pointers, with L-format
F-variables and M-variables, which are long-word variables.
Comparison to Run-Time Linked Pointers
By contrast, when using Turbo PMAC’s M-variable pointers, the register assignment is made when the
line is executed, each time it is executed. This assignment requires about 600 nanoseconds additional
computation time (on a 100 MHz CPU) each time the variable is accessed. However, this does permit the
M-variable definition to be changed during execution, enabling techniques such as indirect addressing.