Phase Command (PCMD)

This instruction applies to the Compact GuardLogix 5370 and Compact GuardLogix 5380, CompactLogix 5370, CompactLogix 5380, and CompactLogix 5480, ControlLogix 5570 and ControlLogix 5580, and GuardLogix 5570 and GuardLogix 5580 controllers.
TIP:
When using this instruction with ControlLogix redundancy system, outputs controlled by this instruction may not be bumpless during redundancy switchover, if the instruction and phase program are not scheduled in the highest priority task.
The PCMD instruction transitions an equipment phase to the next state or sub-state.
Use the PCMD instruction to change the state or sub-state of an equipment phase.
In the running state routine, use the PSC instructions to transition the equipment phase to the complete state. For more information about Paused functionality, please see the PPD phase instruction.
  • This is a transitional instruction. Follow these steps when using it:
    • In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute.
    • In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition.
    TIP:
    The PPD instruction is necessary for using pause functionality.
RSL5K_PCMD InstructionV32
Number
Description
1
Command
Some states need a command to go to the next state. If the equipment phase is in the idle state, a start command transitions the equipment phase to the running state. Once in the running state, the equipment phase executes its running state routine.
2
Other states use a
Phase State Complete (PSC)
instruction to go to the next state. If the equipment phase is in the holding state, a PSC instruction transitions the equipment phase to the held state. Once in the held state, the equipment phase needs a restart command to go to the restarting state.
3
Sub-state
Use Auto Pause, Pause, and Resume to test and debug a state routine. The sub-states require the
Equipment Phase Paused (PPD)
instruction to create breakpoints in the logic.
Use the auto pause, pause, and resume commands to step through the breakpoints.
Available Languages
Ladder Diagram
PCMD_LD_avail_v31
Function Block
This instruction is not available in function block.
Structured Text
PCMD (PhaseName,Command,Result);
Operands
Ladder Diagram
Operand
Type
Format
Description
Phase Name
PHASE
Name of the equipment phase
Equipment phase to change to a different state.
Command
command
Command enumeration value
Command to send to the equipment phase to change its state. For available commands, refer to the illustration above.
Result
DINT
immediate
tag
To let the instruction return a code for its success or failure, enter a DINT tag in which to store the result code. Otherwise, enter 0.
Structured Text
The operands are the same as those for the Ladder Diagram PCMD instruction.
Guidelines for using the PCMD Instruction
Guideline
Details
Limit execution of a PCMD instruction to a single scan.
Limit the execution of the PCMD instruction to a single scan. Each command applies to only a specific state or states. Once the equipment phase changes state, the command is
no longer
valid. To limit execution, use methods such as:
  • Execute the PCMD instruction within a P1 Pulse (Rising Edge) or P0 Pulse (Falling Edge) action.
  • Place a one shot instruction before the PCMD instruction.
  • Execute the PCMD instruction and then advance to the next step.
Determine if need ownership of the equipment phase.
As an option, a program can own an equipment phase. This prevents another program or
FactoryTalk Batch
software from also commanding the equipment phase.
If using:
Then:
FactoryTalk Batch
software to also run procedures (recipes) within this controller
Also run procedures (recipes) within this controller. Before using a PCMD instruction, use an Attach to Equipment Phase (PATT) instruction to take ownership of the equipment phase.
Multiple programs to command the same equipment phase
Use an Attach to Equipment Phase (PATT) instruction to take ownership of the equipment phase.
None of the above
There is no need to own the equipment phase.
Using a POVR instruction instead of a PCMD instruction.
  1. Giving the hold, stop, or abort command?
    • No - Use the PCMD instruction.
    • Yes - Go to step 2.
  2. Must the command work even if the equipment phase is under manual control via
    Logix Designer
    ?
    • Yes - Use the POVR instruction instead.
    • No - Go to step 3.
  3. Must the command work even if
    FactoryTalk Batch
    software or another program owns the equipment phase?
    • Yes - Use the POVR instruction instead.
    • No - Use the PCMD instruction.
For example, suppose the equipment checks for jammed material. And if there is a jam, the equipment should always abort. In that case, use the POVR instruction. This way, the equipment aborts even if under manual control via
Logix Designer
.
Determine if need a return code.
Use the Result operand to get a code that shows the success or failure of the PCMD instruction.
If:
Then in the Result operand, enter a:
Anticipate ownership conflicts or other possible errors
DINT tag, in which to store a code for the result of the execution of the instruction.
Do
not
anticipate ownership conflicts or other possible errors
0
Want to interpret the result code, refer to the
Result Codes
table below.
PCMD Result Codes
If assigning a tag to store the result of a PCMD instruction, the instruction returns one of these codes when it executes:
Code (Dec)
Description
0
Successful command.
24577
Valid command.
24578
Invalid command for the current state of the equipment phase. For example, if the equipment phase is in the running state, then a start command is not valid.
24579
Cannot command the equipment phase. One of these already owns the equipment phase.
  • Logix Designer
  • HMI
  • external sequencer (for example,
    FactoryTalk Batch
    software)
  • another program in the controller
24594
Unscheduled or inhibited equipment phase or in an inhibited task.
TIP:
High priority HMI ownership is specific only to
CompactLogix
5370 and
ControlLogix
5570 controllers.
Affects Math Status Flags
No
Major/Minor Faults
None. See
Index Through Arrays
for operand-related faults.
Execution
For Structured Text, EnableIn is always true during normal scan. Therefore, if the instruction is in the control path activated by the logic, it will execute. All conditions below the think solid line can only occur during Normal Scan mode.
Condition/State
Action Taken
Prescan
No action taken.
Postscan
No action taken.
EnableIn is false
No action taken.
EnableIn is true
The instruction executes as described above.
Example 1
Ladder Diagram
L5K_PCMD_LD_ex1_v32
Number
Description
1
If ProcedureB_Stepindex = 20 (the routine is at step 20)
And this is the transition to step 20 (the ONS instruction signals that the EQU instruction went from false to true.)
Then
Change the state of the Add_Water equipment phase to running via the start command.
2
If ProcedureB_Stepindex = 20 (the routine is at step 20)
And the Add_Water equipment phase is complete (Add_Water.Complete = 1)
Then
Change the state of the Add_Water equipment phase to resetting via the reset command. Advance to step 30.
Structured Text
L5K_PCMD_FC_ex1_v32
Number
Description
1
When the SFC enters
Add_Water_Step
, change
ADD_Water
equipment phase to running via the start command, The P1 qualifier limits this to the first scan of the step.
2
Before the SFC leaves
Add_Water_Step
(
Add_Water_Complete
= 1), change
Add_Water
equipment phase to resetting via the reset command. The P0 qualifier limits this to the last scan of the step.
Example 2
Ladder Diagram
L5K_PCMD_LD_ex2_v32
NOTE:
If ProcedureB_Stepindex = 30 (the routine is at step 30)
And this is the transition to step 30 (the ONS instruction signals that the EQU instruction went from false to true.)
Then
Change the state of the Add_Water equipment phase to running via the start command.
Verify that the command was successful and store the result code in PCMD_Result[1] [DINT Tag].
Structured Text
L5K_PCMD_FC_ex1_v32
NOTE:
When the SFC enters
Add_Ingredient_Step
  • Change
    Add_Ingredient
    equipment phase to running via the start commend.
  • Verify that the command was successful and store the result code in
    PCDM_Result[2]
    (DINT tag).
The P1 qualifier limits this to the first scan of the step.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.