simple AND circuit
March 13th, 2008 As a programming example, consider the simple AND circuit shown in Figure 1 consisting of two momentary pushbuttons in series operating a lamp. Although it would be very uneconomical to implement a circuit this simple using a PLC, for this example we will do so.
![]()
When we convert a circuit to run on a PLC, we first remove the components from the original circuit and wire them to the PLC as shown in Figure 2. One major difference in this circuit is that the two switches are no longer wired in series. Instead, each one is wired to a separate input on the PLC. As we will see later, the two switches will be connected in series in the PLC program. By providing each switch with a separate input to the PLC, we gain the maximum amount of flexibility. In other words, by connecting them to the PLC in this fashion, we can “wire” them in software any way we wish.
The two 120V control voltage sources are actually the same source (i.e., the control transformer secondary voltage). They are shown separately in this figure to make it easier to see how the inputs and output are connected to the PLC, and how each is powered.
![]()
Once we know how the external components are wired to the PLC, we can then write our program. In this case we need to connect the two switches in series. However, once the signals are inside the PLC, they are assigned new reference designators which are determined by the respective terminal on the PLC. Since SWITCH1 is connected to IN1, it will be called IN1 in our program. Likewise, SWITCH2 will become IN2 in our program. Also, since LAMP1 is connected to OUT1 on the PLC, it will be called relay OUT1 in our program. Our program to control LAMP1 is shown in Figure 3.
![]()
The appearance of the PLC program may look a bit unusual. This is because this ladder rung was drawn by a computer using ASCII characters instead of graphic characters. Notice that the rails are drawn with vertical line characters, the conductors are hyphens, and the coil of OUT1 is made of two parentheses. Also, notice that the right rail is all but missing. Many programs used to write and edit PLC ladder programs leave out the rails. This particular program (TRiLOGI by TRi International Pte. Ltd.) Leaves out the right rail, but puts in the left one with a rung number next to each rung.
When the program shown in Figure 3 is run, the PLC first updates the input image register by storing the values of the inputs on terminals IN1 and IN2 (it stores a one if an input is on, and a zero if it is off). Then it solves the ladder diagram according to the way it is drawn and based on the contents of the input image register. For our program, if both IN1 and IN2 are on, it turns on OUT1 in the output image register (careful, it does NOT turn on the output terminal yet!). Then, when it is completed solving the entire program, it performs another update. This update transfers the contents of the output image register (the most recent results of solving the ladder program) to the output terminals. This turns on terminal OUT1 which turns on the lamp LAMP1. At the same time that it transfers the contents of the output image register to the output terminals, it also transfers the logical values on the input terminals to the input image register. Now it is ready to solve the ladder again.
For an operation this simple, this is a lot of trouble and expense. However, as we add to our program, we will begin to see how a PLC can economize not only on wiring, but on the complexity (and cost) of external components.
consumer discount viagra viagra soft tabs discount sale viagra female opinion viagra soft tabs vs. levitra in natural toronto propecia free cialis soft tabs without prescription cheapest levitra in uk cheap levitra levitra female and cialis story cheap levitra on line sale online pharmacy cheap drugs
lorazepam cheap buy viagra online buy oxazepam online without prescription compare zyban zyban and zyban klipal mail order tramadol female opinion buy diazepam order diazepam canadian rx drugs find herbal xanax substitute drugstore cialis buy buy online levitra does tenuate work on women buy viagra valium order
