Ladder Logic 202: Outputs
This is a continuation of a series on programming techniques that I started last week. In the Ladder Logic 201 post I discussed conditioning, backchecking and debouncing of inputs. This weeks topic covers how outputs are actuated including permissives, Auto, Manual and Homing drivers. As with last week’s diagram, the black text represents the commented ladder element, the red text represents the address, while the blue represents the symbol or tag.
The diagram on the left shows the organization of a sample program. The input or output rungs shown in both this week’s and last week’s post might be in any cell, they are shown as b_Inputs and c_Outputs in the organization tree. Some programmers like to put all of their input and output rungs in a single subroutine rather than separating them by cell or station, but for longer programs with lots of safety zones or hundreds of I/O I like to separate them. This doesn’t mean that its wrong to put all of the I/O in one set of subroutines, indeed it might be better for small programs. The main purpose is to make it easy to locate.
The permissive rung at the top of the diagram illustrates situations in which you might not want the actuator to be able to move. The first contact says that a hypothetical axis 2 actuator must be in the retracted position to actuate this axis. This is common when actuators might be able to hit each other. The second normally closed (NC) contact says that the retract output may not be on at the same time as the extend output, again a common practice. The third system fault contact states that the actuator may not move if there is a fault present. Faults will be covered in next weeks post.
The output rung is shown in rung 002. Note that the permissive contact must be on for the output to be activated. This rung assumes that the output is connected to something like a pneumatic or hydraulic double-acting solenoid valve. If the actuator is already at the extended position turning off the output will not make the actuator retract, it will remain in position. In the case of a system fault, air might be exhausted from the system, sometimes known as an “air dump”. In the case of a vertical axis care must be taken to ensure that the actuator remains in position when gravity takes over, often by means of a shot pin, piloted air valve or use of a closed center valve which will trap the air. Hydraulic systems don’t have this problem.
The top branch of the rung illustrates that when the machine is in automatic mode the output will be actuated by a coil from the auto sequence subroutine. This will be covered in a later post. Typically this coil will be active during specified steps of the auto sequence, generally I like to keep the output coils for these commands immediately following the sequence in the same routine. There will also usually be a rung comment describing when the Auto Command (CMD) is true.
The second branch shows that when the machine is in manual operation an HMI pushbutton will activate the output. This might also be a physical pushbutton on an operator console. The third branch shows a contact driven from a homing routine. Homing a cell or station is a common procedure used to ensure that all axes are placed in their proper starting positions. It is also common to have a separate homing sequence in each cell, this might be placed in the routine list as “g_Homing” if desired.
Notice also the bit selection in the ladder diagram. Bits 1.0-1.x are used for the conditioned inputs discussed last week. Bit 2.0 is used as a permissive bit, bits 2.1-2.x might be reserved for more permissives. Bits 3.0-3,3 are used for system level bits such as faults, modes and machine states, other 3.x bits might be reserved for similar conditions. The 4.x bits are used for auto commands, the 5.x bits are used for HMI pushbuttons and the 6.x bits are used for home routine commands. As you can see, organization of the program is important. I usually decide which bit ranges I will be using before starting to program. An Excel spreadsheet is a great way to do this.
As with the input rungs, it is a good idea to place the rungs in order of the output addresses. When organizing the PLC I/O it is also good to assign addresses according to a system; I generally assign actuators in the approximate order that product flows through the system.
If you have any other suggestions or tips feel free to leave a comment!