Reference Manual

PMAC 2 Software Reference
PMAC Program Command Specification 307
COMMAND^{letter}
Function
Program Control-Character Command Issuance
Type
Motion program (PROG or ROT), PLC program
Syntax
COMMAND^{letter}
CMD^{letter}
where:
{letter} is a letter character from A to Z (upper or lowercase) representing the
corresponding control character.
Remarks
This statement causes the motion program to issue a control-character command as if it
came from the host. All control-character commands are global, so there are no
addressing concerns.
Warning:
Do not put the up-arrow character and the letter in quotes (do not use
COMMAND"^A") or PMAC will attempt to issue a command with the
two non-control characters ^ and A for this example, instead of the
control character.
Commands issued from within a program are placed in the command queue, to be parsed
and acted upon at the appropriate time by PMAC’s command interpreter, which operates
in background, between other background tasks. If issued from a motion program, the
command will not be interpreted before the next move or dwell command in the motion
program is calculated. If issued from a PLC program, the command will not be
interpreted before the end of the current scan of the PLC. This delay can make the action
appear to execute out of sequence.
Because of the queuing of commands and the fact that command interpretation is a lower
priority than command issuing, it is possible to overflow the queue. If there is no room
for a new command, program execution is temporarily halted until the new command can
be placed on the queue.
Also, commands that generate a response to the host (including errors if I6 is not equal to
2) can fill up the response queue if there is no host or the host is not prepared to read the
responses. This will temporarily halt program execution until the response queue is
emptied. In standalone applications, it is a good idea to set I1 to 1, disabling the serial
handshake, so any responses can be sent out the serial port (the default response port) at
any time, even if there is no host to receive it.
In a PLC program, it is a good idea to have at least one of the conditions that caused the
command issuance to occur set false immediately. This will prevent the same command
from being issued again on succeeding scans of the PLC, overflowing the command
and/or response queues. Typically in a motion program, the time between moves
prevents this overflow unless there are a lot of commands and the moves take a very
short time.
PMAC will not issue an acknowledging character (<ACK> or <LF>) to a valid command
issued from a program. It will issue a <BELL> character for an invalid command issued
from a program unless I6 is set to 2. It is a good idea to have I6 not set to 2 in early
development so you will know when PMAC has rejected such a command. Setting I6 to
2 in the actual application can prevent program hangup from a full response queue, or