Reference Guide

PMAC Quick Reference Guide
42 Programming PMAC
Home commands can be issued on the terminal window, a Motion Program or a PLC Program:
HOME1..8 ;Home axis 1 to 8 in a Motion Program. Program is halted
;
until home is completed.
#1HM ;Online command for homing motor #1 from the terminal window.
CMD”#1HM” ;Online command for homing motor #1 from a PLC program.
while (…) ;If a command statement is used in a PLC, the lines after
;must have a while
endwhile ;loop waiting for the home procedure to complete (see main
;PMAC manual for details).
HOMEZ is similar to these HOME commands but no motion will result in this kind of home search. PMAC
will determine the zero reference home position in the place where the axes are found when HOMEZ is
issued.
Command and Send Statements
Using the COMMAND or CMD statement, online commands could be issued from a PLC or Motion program
having the same result as if they were issued from a host computer or a terminal window. Certain online
commands might not be valid when issued from a running program. For example, a JOG command to a
motor part of a coordinate system running a motion program will be invalid. It is a good idea to have I6
not set to 2 in early development so it will be known when PMAC has rejected such a command. Setting
I6 to 2 in the actual application can prevent program hang up from a full response queue or from
disturbing the normal host communications protocol.
Messages to a host computer or terminal window can be issued using the SEND command.
If there is no host on the port to which the message is sent, or the host is not ready to read the message,
the message is left in the queue. If several messages back up in the queue this way, the program issuing
the messages will halt execution until the messages are read. This is a common mistake when the SEND
command is used outside of an Edge-Triggered condition in a PLC program. On the serial port, it is
possible to send messages to a non-existent host by disabling the port handshaking with I1=1.
If a program, particularly a PLC program, sends messages immediately on power-up/reset, it can confuse
a host-computer program (such as the PMAC Executive Program) that is trying to find PMAC by
querying it and looking for a particular response.
It is possible, particularly in PLC programs, to order the sending of messages or command statements
faster than the port can handle them. Usually, this will happen if the same SEND or CMD command is
executed every scan through the PLC. For this reason, it is good practice to have at least one of the
conditions that causes the SEND or CMD command to execute to be set false immediately to prevent
execution of this SEND or CMD command on subsequent scans of the PLC.