PMAC Product Guide 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. In addition, commands that generate a response to the host (including errors if I6 is not equal to 2) potentially can fill up the response queue if there is no host or the host is not prepared to read the responses. This will halt program execution temporarily until the response queue is emptied.
In standalone applications, set I1 to 1, disabling the serial handshake, so that any responses can be sent out of the serial port (the default response port) at any time, even if there is no host to receive it. In a PLC program, 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 ( or ) to a valid command issued from a program. It will issue a character for an invalid command issued from a program unless I6 is set to 2. Do not set I6 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. Many otherwise valid commands will be rejected when issued from a motion program.
For instance, a motor cannot be jogged in the coordinate system executing the program because all these motors are considered to be running in the program, even if the program is not requesting a move of the motors at that time. When issuing commands from a program, be sure to include all the necessary syntax (motor and/or coordinate system specifiers) in the command statement or use the ADDRESS command. For example, use CMD"#4HM" and CMD"&1A" instead of CMD"HM" and CMD"A" . Otherwise, motor and coordinate system commands will be sent to the most recently addressed motor and coordinate system which may not always be as the one intended. Examples:
COMMAND"#1J+" CMD"#4HM" CMD"&1B5R" CMD"P1" 47.5 ADDRESS#3 COMMAND"J-" IF(M40=1 AND M41=1) CMD"&4R" M41=0 ENDIF 208 Buffer Commands