CONVERTING THE PROGRAM
Developing a program for a programmable logic controller is a little different from designing a circuit with relay logic. There are several rules that must be followed with almost all programmable logic controllers.
1. Each line of logic must end with a coil. Some manufacturers permit coils to be connected in parallel and some do not.
2. Generally, coils cannot be connected in series.
3. The program will scan in the order that it is entered.
4. Generally, coils cannot be assigned the same number. (Some programmable logic controllers require reset coils to reset counters and timers. These reset coils can be assigned the same number as the counter or timer they reset.)
The first two lines of logic for the circuit shown in Figure 59–2 can be seen in Figure 59–7. Notice that contact symbols are used to represent inputs instead of logic symbols such as pushbuttons, float switches, and so on. The programmable logic controller recognizes all inputs as open or closed contacts. It does not know what device is connected to which input. This is the reason that you must first determine which device connects to which input before a program can be developed. Also notice that input 1 is shown as a normally open contact. Referring to Figure 59–4, it can be seen that input 1 is connected to a normally closed pushbutton. The input is programmed as normally open because the normally closed pushbutton will supply a high volt- age to input 1 in normal operation. Because input 1 is in a high state, the PLC will change the state of the open contact and consider it closed. When the stop pushbutton is pressed, the input voltage will change to low and the PLC will change the contact back to its original open state and cause coil 33 to deenergize.
Referring to the schematic in Figure 59–2, a control relay is used as part of the circuit logic. Because the control relay does not directly cause any output device to turn on or off, an internal relay will be used. The chart in Figure 59–6 indicates that internal
relays number between 33 and 103. Coil number 33 is an internal relay and does not physically exist. Any number of contacts can be assigned to this relay, and they can be open or closed. The number 33 contact connected in parallel with input 2 is the holding contact labeled CR-1 in Figure 59–2.
The next two lines of logic are shown in Figure 59–8. The third line of logic in the schematic in Figure 59–2 contains a normally open CR-2 contact, a normally closed float switch contact, a normally closed on-delay timed contact, and solenoid coil A. The fourth line of logic contains solenoid coil B connected in parallel with solenoid coil A. Line three in Figure 59–8 uses a normally open contact assigned the number 33 for contact CR-2. A normally closed contact symbol is assigned the number 4. Because the float switch is connected to input number 4, it will control the action of this contact. As long as input 4 remains in a low state, the contact will remain closed. If the float switch should close, input 4 will become high and the number 4 contact will open.
The next contact is timed contact TR-1. The chart in Figure 59–6 indicates that timers and counters are assigned numbers 200 through 264. In this circuit, timer TR will be assigned number 200. Line three ends with coil number 17. When coil 17 becomes energized, it will turn on output 17 and connect solenoid coil A to the line.
The schematic in Figure 59–2 shows that solenoid coil B is connected in parallel with solenoid coil A. Most programmable logic controllers do not permit coils to be connected in parallel. Each line of logic must end with its own coil. Because solenoid
coil B is connected in parallel with A, they both operate at the same time. This logic can be accomplished by assigning an internal contact the same number as the coil controlling output 17. Notice in Figure 59–8 that when coil 17 energizes it will cause contact 17 to close and energize output 18 at the same time.
In Figure 59–9, lines 5 and 6 of the schematic are added to the program. A normally open contact assigned number 33 is used as for contact CR-3. A normally open contact assigned the number 4 is controlled by the float switch, and a second normally closed timed contact controlled by timer 200 is programmed in line 5. The output coil is assigned the number 19. When this coil energizes it turns on output 19 and connects motor starter coil M to the line.
Line 6 contains timer coil TR. Notice in Figure 59–2 that coil TR is connected in parallel with contact TR-2 and coil M. As was the case with solenoid coils A and B, coil TR cannot be connected in parallel with coil M. According to the schematic in Figure 59–2, coil TR is actually controlled by contacts CR-3 and the normally open float switch. This logic can be accomplished as shown in Figure 59–9 by connect- ing coil T200 in series with contacts assigned the numbers 33 and 4. Float switches do not normally contain this many contacts, but because the physical float switch is supplying a high or low voltage to input 4, any number of contacts assigned the number 4 can be used.
The last line of the program is shown in Figure 59–10. A normally open contact assigned
the number 33 is used for contact CR-4 and a normally open contact controlled by timer T200 is used for the normally open timed contact labeled TR-3. Coil 20 controls the operation of solenoid coil C.
The circuit shown in Figure 59–2 has now been converted to a program that can be loaded into a programmable logic controller. The process is relatively simple if the rules concerning PLCs are followed.