Chapter 2. Program OrganizationGFK-2950C February 2018 212.1.8 LanguagesLadder Diagram (LD)Logic written in Ladder Diagram language consists of a sequence of rungs that execute from top tobottom. The logic execution is thought of as power flow, which proceeds down along the left rail ofthe ladder, and from left to right along each rung in sequence.Relay Power flow into function CoilMultiplication functionPowerRail Power flow out of functionFigure 11: Explanation of Ladder Diagram RungThe flow of logical power through each rung is controlled by a set of simple program instructions thatwork like mechanical relays and output coils. Whether or not a relay passes logical power flow alongthe rung depends on the content of a memory location with which the relay has been associated inthe program. For instance, a relay might pass positive power flow if its associated memory locationcontains the value 1. The same relay passes negative power flow if the memory location contains thevalue 0.Usually an instruction that receives negative power flow does not execute and propagates thenegative power flow on to the next instruction in the rung. However, some instructions such astimers and counters execute even when they receive negative power flow, and may even passpositive power flow out. Once a rung completes execution, with either positive or negative powerflow, power flows down along the left rail to the next rung.Within a rung, there are many complex functions that are part of the standard function library andcan be used for operations like moving data stored in memory, performing math operations, andcontrolling communications between the CPU and other devices in the system. Some programfunctions, such as the Jump function and Master Control Relay, can be used to control the executionof the program itself. Together, this large group of Ladder Diagram instructions and standard libraryfunctions makes up the instruction set of the CPU.