9 -5 L ADDER R E L AY P ROGRAMMING L ADDER S CAN E V A L U AT I O N

9 -5 L ADDER R E L AY P ROGRAMMING L ADDER S CAN E V A L U AT I O N

Scan evaluation is an important concept, since it defines the order in which the processor executes a ladder diagram. The processor starts solving a ladder program after it has read the status of all inputs and stored this information in the input table. The solution starts at the top of the ladder program, beginning with the first rung and proceeding one rung at a time. As the processor solves the control program, it examines the reference address of each programmed instruction, so that it can assess logic continuity for the rung being solved. Even if the output conditions in the rung being solved affect previous rungs, the processor will not return to the previous rung to resolve it.

To make this clearer, let’s examine the diagram in Figure 9-28, which illustrates four simple rungs. The normally open contact 10, which we will assume corresponds to a push button, activates the first rung. If contact 10 turns ON, it will turn output 100 ON. In the next rungs, contact 100 will turn output 101 ON, contact 101 will turn output 102 ON, and contact 102 will turn output 103 ON. Even though they are connected to different rungs, all of these outputs turn ON in the same scan, because the processor updates the real output devices connected to the modules when it finishes the program scan. In this case, if outputs 100, 101, 102, and 103 were connected to pilot lights, they would all turn ON at the same time.

Figure 9-28. Ladder rung where all outputs turn ON in the same scan.

Figure 9-29 illustrates the same ladder logic as in Figure 9-28 but with the placement of rungs reversed. Assuming that input 10 is pushed in the first scan, the processor must make four scans before it energizes output 103. The logic the processor uses in the first scan is as follows: (1) When input 10 is pushed, the processor examines reference 102 and finds it OFF (logic 0);

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Languages 9

therefore, output 103 stays OFF. (2) In the second rung, contact 101 is OFF; therefore, output 102 remains OFF. (3) In the third rung, contact 100 is OFF, so output 101 remains OFF. (4) In the fourth rung, contact 10 is ON because the push button is pushed, so output 100 turns ON. In the next scan (second), if the push button remains ON, output 101 will turn ON because, at the end of the first scan, the reference address 100 was set to logic 1. This logic will continue until the fourth scan, when all four outputs will be ON. The outputs will turn OFF in the same way once the push button is released.

Figure 9-29. Ladder rung where the outputs turn ON in different scans.

The physical operation of a circuit like the one in Figure 9-29 is almost impossible to observe while a PLC is running the control program because a PLC completes its scan in milliseconds. All the pilot lights would seem to come ON at the same time, even if they actually came on in different scans. The only way to observe the ladder outputs would be to use single-scan PLC operation. With single-scan operation, the processor reads the inputs, ex- ecutes the logic, updates the outputs, and stops until another single scan is executed. Single-scan operation is generally used during the testing of a control program.

The important thing to remember about a ladder program is that for an output to have an effect on another rung in the same scan, it must be programmed before that rung. If it is not, order of execution problems can arise, especially when using transitional contacts and one-shot outputs to reset and unlatch other rungs. Figure 9-30 illustrates this type of programming order problem, where the output unlatch instruction will never occur. Once contact 10 closes, latching output 100, only the closing of contact 11 will unlatch the output. When contact 12 closes, it triggers the one-shot output 11 (or the transitional contact 12) for one scan. However, at the end of the scan, the one-shot output turns OFF, so it is not able to unlatch coil 100 in the next scan.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC Programming C HAPTER 3 Programming

Figure 9-30. (a) The one-shot output and (b) the transitional contact will never unlatch

coil 100.