User`s manual

Page - 29
4.0 - Programming PMAC
Programming PMAC is very simple; the ease of use and power is based in the following features:
- A clever interrupt-driven scheme allows every task, each motion program and PLC, to run independently of each other.
- Pointer M-variables allow monitoring virtually any register in PMAC’s memory from different sources: motion
programs, PLCs or the host computer.
- Communications are continuously activated. At any moment, any variable or status command could be interrogated.
- Up to 8 Axes could be either synchronized together, controlled individually or in any combination in between.
- Data gathering and reporting functions allows saving data such as motion trajectories, velocity profiles or any set of
variables for later analysis and plot.
PMAC is fundamentally a command-driven device, you make PMAC do things by issuing it ASCII command text strings,
and PMAC generally provides information to the host in ASCII text strings.
When PMAC receives an alphanumeric text character over one of its ports, it does nothing but place the character in its
command queue. It requires a control character (ASCII value 1 to 31) to cause it to take some actual action. The most
common control character used is the "carriage return" (<CR>; ASCII value 13), which tells PMAC to interpret the
preceding set of alphanumeric characters as a command and to take the appropriate action.
4.1 - Online Commands
Many of the commands given to PMAC are on-line commands; that is, they are executed immediately by PMAC, either to
cause some action, change some variable, or report some information back to the host.
Some commands, such as P1=1, are executed immediately if there is no open program buffer, but are stored in the buffer if
one is open. Other commands, such as X1000 Y1000, cannot be on-line commands; there must be an open buffer -- even
if it is a special buffer for immediate execution. These commands will be rejected by PMAC (reporting an ERR005 if I6 is
set to 1 or 3) if there is no buffer open. Still other commands, such as J+, are on-line commands only, and cannot be
entered into a program buffer (unless in the form of CMD"J+", for instance).
There are three basic classes of on-line commands: motor-specific commands, which affect only the motor that is currently
addressed by the host; coordinate-system-specific commands, which affect only the coordinate system that is currently
addressed by the host; and global commands, which affect the card regardless of any addressing modes.
A motor is addressed by a #n command, where n is the number of the motor, with a range of 1 to 8, inclusive. This motor
stays the one addressed until another #n is received by the card. For instance, the command line #1J+#2J- tells Motor 1
to jog in the positive direction, and Motor 2 to jog in the negative direction. There are only a few types of motor-specific
commands. These include the jogging commands, a homing command, an open loop command, and requests for motor
position, velocity, following error, and status.
A coordinate system is addressed by a &n command, where n is the number of the coordinate system, with a range of 1 to 8,
inclusive. This coordinate system remains the one addressed until another &n command is received by the card. For
instance, the command line &1B6R&2B8R tells Coordinate System 1 to run Motion Program 6 and Coordinate System 2 to
run Motion Program 8. There are a variety of types of coordinate-system-specific commands. Axis definition statements
act on the addressed coordinate system, because motors are matched to an axis in a particular coordinate system. Since it is
a coordinate system that runs a motion control program, all program control commands act on the addressed coordinate
system. Q-variable assignment and query commands are also coordinate system commands, because the Q-variables
themselves belong to a coordinate system.
Some on-line commands do not depend on which motor or coordinate system is addressed. For instance, the command
P1=1 sets the value of P1 to 1 regardless of what is addressed. Among these global on-line commands are the buffer
management commands. PMAC has multiple buffers, one of which can be open at a time. When a buffer is open,
commands can be entered into the buffer for later execution.
Control character commands (those with ASCII values 0 - 31D) are always global commands. Those that do not require a
data response act on all cards on a serial daisy-chain. These characters include carriage return <CR>, backspace <BS>, and
several special-purpose characters. This allows, for instance, commands to be given to several locations on the card in a
single line, and have them take effect simultaneously at the <CR> at the end of the line (&1R&2R<CR> causes both
Coordinate Systems 1 and 2 to run).