Reference Guide

PMAC Quick Reference Guide
34 Programming PMAC
The set of Q-Variables working within a command depends on the type of command. When accessing a
Q-Variable from an on-line (immediate) command from the host, it is the Q-variable for the currently
host-addressed coordinate system (with the &n command). When accessing a Q-Variable from a motion
program statement, it is the Q-Variable belonging to the coordinate system running the program. If a
different coordinate system runs the same motion program, it will use different Q-variables.
When accessing a Q-Variable from a PLC program statement, it is the Q-Variable for the coordinate
system that has been addressed by that PLC program with the ADDRESS command. Each PLC program
can address a particular coordinate system independent of other PLC programs and independent of the
host addressing. If no ADDRESS command is used in the PLC program, the program uses the Q-
Variables for Coordinate System 1.
M-Variables
To permit easy access to PMAC’s memory and I/O space, M-Variables are provided. Generally, a
definition must be made only once with an on-line command. On PMACs with battery backup, the
definition is held automatically. On PMACs with flash backup, the SAVE command must be used to
retain the definition through a power-down or reset. The user defines an M-variable by assigning it to a
location and defining the size and format of the value in this location. An M-variable can be a bit, a
nibble (4 bits), a byte (8 bits), 1-1/2 bytes (12 bits), a double-byte (16 bits), 2-1/2 bytes (20 bits), a 24-bit
word, a 48-bit fixed-point double word, a 48-bit floating-point double word, or special formats for dual-
ported RAM and for the thumbwheel multiplexer port.
There are 1,024 M-Variables (M0 to M1023), and as with other variable types, the number of the M-
variable may be specified with either a constant or an expression: M576 or M(P1+20) when read from;
the number must be specified by a constant when written to.
The definition of an M-Variable is done using the defines arrow (->) composed of the minus sign and
greater than symbols. An M-Variable may take one of the following types, as specified by the address
prefix in the definition:
X: 1 to 24 bits fixed-point in X-memory
Y: 1 to 24 bits fixed-point in Y-memory
D: 48 bits fixed-point across both X- and Y-memory
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, the starting bit to use, the number of bits, and the format
(decoding method) must be defined also.
Typical M-Variable definition statements are:
M1->Y:$FFC2,8,1
M102->Y:49155,8,16,S
M103->X:$C003,0,24,S
M161->D:$002B
M191->L:$0822
M50->DP:$D201
M51->F:$D7FF
M100->TWD:4,0.8.3,U