User's Manual

Turbo PMAC User Manual
246 Turbo PMAC Computational Features
L: 48 bits floating-point across both X- and Y-memory
DP: 32 bits fixed-point (low 16 bits of X and Y) (for use in dual-ported RAM)
F: 32 bits floating-point (low 16 bits of X and Y) (for use in dual-ported RAM)
TWD: Multiplexed BCD decoding from Thumbwheel port
TWB: Multiplexed binary decoding from Thumbwheel port
TWS: Multiplexed serial I/O decoding from Thumbwheel port
TWR: Multiplexed serial resolver decoding from Thumbwheel port
*: No address definition; uses part of the definition word as general-
purpose variable
If an X or Y type of M-variable is defined, you must also define the starting bit to use, the number of bits,
and the format (decoding method).
Typical M-variable definition statements are:
M1->Y:$078C02,8,1
M102->Y:$78003,8,16,S
M103->X:$078003,0,24,S
M161->D:$8B
M5141->L:$2041
M50->DP:$060401
M51->F:$0607FF
M100->TWD:4,0.8.3,U
See the instructions for each type of M-variable definition in the On-Line Commands reference section of
the manual. This can be found in the Talking to Turbo PMAC section of this manual. Many suggested
M-variable definitions are given in the software reference manual as well.
It is a good idea to prepare a single file with all of your M-variable definitions and to put at the top of this
file the command M0..8191->*. This will remove all existing definitions, and help to prevent
mysterious problems caused by “stray” M-variable definitions.
The M-variable definitions are stored as 48-bit codes at Turbo PMAC memory addresses $004000 (for
M0) to $005FFF (for M8191). The Y-register contains the address of the register pointed to by the
definition; the X-register contains a code that determines what part of the register is used and how it is
interpreted.
If another M-variable points to the Y-register, it can be used to change the subject register. The main use
of this technique is to create arrays of registers, which can be used to walk through tables in memory.
Limited Range
Many M-variables have a more limited range than Turbo PMAC’s full computational range. If a value
outside of the range of an M-variable is placed to that M-variable, Turbo PMAC rolls over the value
automatically to within that range and does not report any errors.
For example, with a single bit M-variable, any odd number written to the variable ends up as 1, any even
number ends up as 0. If an attempt is made to place a non-integer value in an integer M-variable, Turbo
PMAC automatically rounds to the nearest integer.
Using M-Variables
Once defined, an M-variable may be used in programs just as any other variable – through expressions.
When the expression is evaluated, Turbo PMAC reads the defined memory location, calculates a value
based on the defined size and format, and utilizes it in the expression.
Care should be exercised in using M-variables in expressions. If an M-variable is something that can be
changed by a servo routine (such as instantaneous commanded position), which operates at a higher
priority than the background expression evaluation, there is no guarantee that the value will not change in
the middle of the evaluation. For instance, if in the expression
(M16-M17)*(M16+M17)