PMAC Product Guide I323=-10 ; Home speed 10 cts/msec negative direction I326=0 ; No home offset I912=3 ; Capture on rising flag and rising index I913=0 ; Use HMFL3 as flag CMD"#3HM" ; Do actual homing move WHILE (M345=1) ; Waits for Home Search to start ENDWHILE WHILE (M333=0) ; Waits for Home motion to complete ENDWHILE DIS PLC12 ; Disables PLC once Home is found CLOSE ; End of program Command and Send Statements Using the COMMAND or CMD statement, online commands can 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. 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 could 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. Example:
M187->Y:$0817,17,1 ; &1 In-position bit (AND of motors) OPEN PLC3 CLEAR IF (M11=1) ; input is ON IF (P11=0) ; input was not ON last time P11=1 ; set latch COMMAND"&1A" ; ABORT all motion WHILE (M187=0) ; wait for motion to stop. ENDW COMMAND"&1B10R" ; start program 10 ENDIF ELSE P11=0 ; reset latch ENDIF CLOSE Programming PMAC 65