Industrial Motors -- Programming a PLC

Home | Articles | Forum | Glossary | Books


  • Convert a relay schematic to a schematic used for programming a PLC.
  • Enter a program into a programmable controller.

In this section, a relay schematic will be converted into a diagram used to program a programmable controller. The process to be controlled. A tank is used to mix two liquids. The control circuit operates as follows:

A. When the START button is pressed, solenoids A and B energize. This permits the two liquids to begin filling the tank.

B. When the tank is filled, the float switch trips. This de-energizes solenoids A and B and starts the mo tor used to mix the liquids together.

C. The motor is permitted to run for 1 minute. After 1 minute has elapsed, the motor turns off and solenoid C energizes to drain the tank.

D. When the tank is empty, the float switch de energizes solenoid C.

E. A STOP button can be used to stop the process at any point.

F. If the motor becomes overloaded, the action of the entire circuit will stop.

G. Once the circuit has been energized, it will continue to operate until it’s manually stopped.

Circuit Operation

A relay schematic that will perform the logic of this circuit is shown. The logic of this circuit is as follows:

A. When the START button is pushed, relay coil CR is energized. This causes all CR contacts to close. Con tactCR-1 is a holding contact used to maintain the circuit to coil CR when the START button is released.

B. When contact CR-2 closes, a circuit is completed to solenoid coils A and B. This permits the two liquids that are to be mixed together to begin filling the tank.

C. As the tank fills, the float rises until the float switch is tripped. This causes the normally closed float switch contact to open and the normally open con tact to close.

D. When the normally closed float switch opens, solenoid coils A and B de-energize and stop the flow of the two liquids into the tank.

E. When the normally open contact closes, a circuit is completed to the coil of a motor starter and the coil of an on-delay timer. The motor is used to mix the two liquids together.

F. At the end of the one minute time period, all of the TR contacts change position. The normally closed TR-2 contact connected in series with the motor starter coil opens and stops the operation of the mo tor. The normally open TR-3 contact closes and energizes solenoid coil C which permits liquid to begin draining from the tank. The normally closed TR-1 contact is used to assure that valves A and B cannot be re-energized until solenoid C de-energizes.

G. As liquid drains from the tank, the float drops. When the float drops far enough, the float switch trips and its contacts return to their normal positions. When the normally open float switch contact reopens and de-energizes coil TR, all TR contacts return to their normal positions.

H. When the normally open TR-3 contact reopens, solenoid C de-energizes and closes the drain valve.

Contact TR-2 recloses, but the motor cannot restart because of the normally open float switch contact.

When contact TR-1 re-closes, a circuit is completed to solenoids A and B. This permits the tank to begin re filling, and the process starts over again.

I. If the STOP button or overload contact opens, coil CR de-energizes and all CR contacts open. This de energizes the entire circuit.

Tank used to mix two liquids.

Relay schematic.

A program being developed on a programming terminal. (GE Fanuc.)

Developing a Program

This circuit will now be developed into a program that can be loaded into the programmable controller. Here’s a program being developed on a computer. Assume that the controller has an I/O capacity of 32, that I/O terminals 1 through 16 are used as inputs, and that terminals 17 through 32 are used as outputs.

Before a program can be developed for input into a programmable logic controller, it’s necessary to assign which devices connect to the input and output terminals. This circuit contains four input devices and four output devices. It’s also assumed that the motor starter for this circuit contains an overload relay that contains two contacts instead of one. One contact is normally closed and is connected in series with the coil of the motor starter. The other contact is normally open and is used to supply an input to a programmable logic controller. If the motor becomes overloaded, the normally closed contacts will open and disconnect the motor from the line. The normally open contacts will close and provide a signal to the programmable logic controller that the motor has tripped on overload. The input devices are as follows:

A. Normally closed STOP push button; B. Normally open START push button; C. Normally open overload contact; D. A float switch that contains both a normally open and normally closed contact.

The four output devices are:

A. Solenoid valve A

B. Solenoid valve B

C. Motor starter coil M

D. Solenoid valve C

The connection of devices to the inputs and outputs. The normally closed STOP but ton is connected to input #1, the normally open START button is connected to input #2, the normally open overload contact is connected to input #3, and the float switch is connected to input #4.

The outputs for this PLC are 17 through 32. Output #17 is connected to solenoid A, output #18 is connected to solenoid B, output #19 is connected to the coil of the motor starter, and output #20 is connected to solenoid C. Note that the outputs don’t supply the power to operate the output devices. The outputs simply complete a circuit. One side of each output device is connected to the ungrounded or hot side of a 120 V AC power line. Neutral is connected to the common terminal of the four outputs. A good way to understand this is to imagine a set of contacts controlled by each output. When programming the PLC, if a coil is given the same number as one of the outputs, it will cause that contact to close and connect the load to the line.

--- Components connected to I/O Rack.

Unfortunately, programmable logic controllers are not all programmed the same way. Almost every manufacturer employs a different set of coil numbers to per form different functions. It’s necessary to consult the manual before programming a PLC with which you are not familiar. In order to program the PLC in this example, refer to the information. This chart indicates that numbers 1 through 16 are inputs.

Any contact assigned a number between 1 and 16 will be examined each time the programmable logic controller scans the program. If an input has a low (0 V) state, the contact assigned that number will remain in the state it was programmed. If the input has a high (120 V) state, the program will interpret that contact as having changed state. If it was programmed as open, the PLC will now consider it as closed.

Outputs are 17 through 32. Outputs are treated as coils by the PLC. If a coil is given the same number as an output, that output will turn on (close the contact) when the coil is energized. Coils that control outputs can be assigned internal contacts as well. Internal contacts are contacts that exist in the logic of the program only. They don’t physically exist. Since they don’t physically exist, a coil can be assigned as many internal contacts as desired, and they can be normally open or normally closed.

The chart also indicates that internal relays number from 33 to 103. Internal relays are like internal contacts. They don’t physically exist.

They exist as part of the program only. They are programmed into the circuit logic by inserting a coil symbol in the program and assigning it a number between 33 and 103.

Timers and counters are assigned coil numbers 200 through 264 and retentive relays are numbered 104 through 134.

--- Output modules complete a circuit to connect the load to the line.


--- Numbers that correspond to spec ific PLC functions.

--- Lines 1 and 2 of the program.

Converting the Program

Developing a program for a programmable logic controller is a little different than 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.

2. Coils cannot be connected in parallel.

3. The program will be scanned in the order that it’s 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. Notice that contact symbols are used to represent inputs instead of logic symbols such as push buttons, float switches, etc.

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 devices connect to which input before a program can be developed. Also notice that input #1 is shown as a normally open contact. Referring, it can be seen that input #1 is connected to a normally closed push button. The input is programmed as normally open because the normally closed push button will supply a high voltage to input #1 in normal operation. Since input #1 is in a high state, the PLC will change the state of the open contact and consider it closed. When the STOP push button 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 de-energize.

Referring to the schematic, a control relay is used as part of the circuit logic. Since the control relay does not directly cause any output device to turn on or off, an internal relay will be used. The chart indicates that internal relays number between 33 and 103. Coil #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 #33 contact connected in parallel with input #2 is the holding contact, labeled CR-1.

The next two lines of logic are shown. The third line of logic in the schematic 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 3 uses a normally open contact, assigned the number 33 for contact CR-2. A normally closed contact symbol is assigned the number 4. Since the float switch is connected to input #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 be come high and the number 4 contact will open. The next contact is timed contact TR-1. The chart indicates that timers and counters are assigned numbers 200 through 264. In this circuit, timer TR will be as signed #200. Line 3 ends with coil #17. When coil 17 becomes energized, it will turn on output 17 and connect solenoid coil A to the line.

The schematic shows that solenoid coil B is connected in parallel with solenoid coil A.

Programmable logic controllers don’t permit coils to be connected in parallel. Each line of logic must end with its own coil. Since 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 that when coil 17 energizes it will cause contact 17 to close and energize output 18 at the same time.

Lines 3 and 4 of the circuit are added.

Lines 5 and 6 are added to the program.

Line 7 of the program.

In lines 5 and 6 of the schematic are added to the program. A normally open contact as signed number 33 is used as contact CR-3. A normally open contact assigned the number 4 is controlled by the float switch, and a second normally closed timed con tact 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 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, coil TR is actually controlled by contacts CR-3 and the normally open float switch. This logic can be accomplished as shown by connecting coil T200 in series with contacts assigned the numbers 33 and 4. float switches don’t normally contain this many contacts, but since 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. 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 has not 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.

Programming in Boolean

The preceding example circuit was developed for one specific type of programmable controller. It was in tended as an example of how to develop and enter a pro gram into the logic of the CPU using a programmable terminal.

There may be times when it’s necessary to use a small programming device that is hand held or that attaches directly to the CPU when entering a program. A unit of this type is shown. This programming unit can be used with the SERIES ONE group of programmable controllers manufactured by GE Fanuc Automation. The following program will be developed for entry into the SERIES ONE using the handheld programmer.

Developing the Program

The following program will be used as a trouble annunciator: A pressure switch is to be connected to the input of a programmable controller. When the pressure rises to a preset point, an audible alarm will be sounded and a warning light will flash off and on. When the operator acknowledges the trouble, the audible alarm will be silenced, but the warning light will continue to flash on and off until the pressure returns to a safe level.

Small programming unit attaches directly to the PLC.

Parameters of the Programmable Controller

Before the program can be developed, the parameters of the programmable controller being used must be known. Because the SERIES ONE programmable controller is being used in this example, its parameters will be discussed. An operations and programming guide for the SERIES ONE. All coil and I/O references must be entered in OCTAL.

OCTAL is a number system that contains only eight digits, 0 through 7. The numbers 8 and 9 are not used because they don’t exist as far as the computer is concerned. This does not mean that the numbers 8 and 9 cannot be used when entering times for a timer, it applies only to the way inputs, outputs, and internal relays are identified. For example, any programmable controller that is octal base won’t use the numbers 8 or 9.

The I/O points for this unit are 000 through 157. Assume the first I/O module used with this controller contains eight units, and these eight units are inputs. The inputs will number from 0 to 7. Now, assume the next set of I/Os is an output module. Numbers 10 through 17 can be used as an output. Notice that numbers 8 and 9 are omitted. The programming guide indicates that a total of 144 internal coils exists. Coils 160 through 337 are non-retentive and coils 340 through 373 are retentive. There are a total of 64 timers and counters, which begin with 600 and go through 677. Remember that there are no 8s or 9s. After timer 607 is used, the next timer will be 610.

The circuit will be programmed into the controller using the small programming unit. The contacts labeled 0 and 1 are inputs. Con tact 0 is connected to the normally open pressure switch, which is used to sense the high pressure condition. Con tact 1 is connected to the normally open push button used to acknowledge the fault and to turn off the audible alarm. Coils 10 and 11 are outputs. Coil 10 is connected to the warning light and coil 11 is connected to the audible alarm. Coils T600 and T601 are timers used to produce the flashing action of the warning light. In this circuit, the warning light will be on for 0.5 second and off for 0.5 second. Coil 160 is an internal relay.


MEMORY TYPE MODE SWITCH POSITION FUNCTION RUN CPU scans logic, outputs enabled PROG Enter/Edit logic, no scanning STATUS INDICATORS RUN ON=CPU in RUN mode ON/OFF Operating state of I.O. internal coils or shift registers.

BATT ON=Lithium battery voltage low PWR ON=Power supply DC voltage normal CPU ON=CPU internal fault Watchdog timer timed out low DC voltage LOAD Controls transfer to and from external device (recorder, printer, PROM writer) VALID REFERENCES (OCTAL) SERIES ONE QUANTITY (DECIMAL) KEY DESCRIPTION LOGIC and EDITING KEYS I/O Points Internal Coils


Retentive Coils

Initial Reset

O.I. Second Clock

Disable All Outputs

Back-Up Battery Status

Shift Registers Timer/Counters Sequencers

Total maximum number of Timers and/or Counters Shift register and data register references are identical, however, shift registers operate on bits, while data registers (located in a totally different area of memory) operate on bytes

(Series One Plus Only) Entered before a 2-digit number to select a data operation.

(Series One Plus Only) Entered before a 3-digit data register or 2-digit group reference when programming data operations.

Places logic in series with previous logic.

Places logic in parallel with previous logic.

Starts a new line or group of logic.

Spec ifies a normally closed contact when used with AND/OR.

Ends line of logic with a coil, can be an output.

Spec ifies a timer function.

Spec ifies a counter function.

Spec ifies a shift register function.

Begins a master control relay function.

Ends a master control relay function.

Spec ifies a latched coil or used to force an I/O reference on.

Turns off a latched coil or forces an I/O reference off.

Included in sequence for removing (deleting) an instruction from program memory.

Included in sequence for adding (inserting) an instruction in program memory.

Causes logic to be placed in program memory.

Removes (clears) previous logic entry, acknowledges error codes, causes memory address to be displayed when monitoring a program.

Selects shifted functions (upper label above keys).

Used when initiating a search function.

Selects previous logic or function, and when monitoring, selects the previous group of 8 references.

Selects the next logic function. When monitoring, selects the next group of 8 references.

SHIFTED FUNCTION. Selects numerical values. to SHIFTED FUNCTION. Selects decimal point when entering numerical values, (timers using XXX.X seconds).

SHIFTED FUNCTION. Selects monitor operation.

SHIFTED FUNCTION. Initiates verify operation with peripheral.

SHIFTED FUNCTION. Initiates writing (recording) program in CPU memory to a peripheral.

SHIFTED FUNCTION. Initiates loading of CPU memory from a peripheral.

Steps (1000 steps) SERIES ONE PLUS I/O Points Internal Coils


Retentive Coils

Initial Reset

O.I. Second Clock

Disable All Outputs

Back-Up Battery Status

Programming guide for a SERIES ONE programmable controller. (GE Fanuc Automation North America Inc.)


--- Warning light and alarm circuit.

Operation of the Circuit

The circuit operates in the following manner: When the pressure switch closes, all 0 inputs change position. This provides a current path to timer T600, which begins timing. A current path is provided to output 10, which turns on the warning light, and a current path is provided to the audible alarm, turning it on. The normally open 0 contact connected in series with coil 160 closes. At the end of a half second, timer T600 times out and changes the position of all T600 contacts. The normally closed contact connected in series with the warning light opens and turns off output 10. The normally open T600 contact closes and permits timer T601 to begin timing. At the end of a half second, timer T601 opens its normally closed contact connected in series with timer T600. This causes timer T600 to reset and return all of its contacts to their normal position. The normally closed T600 contact permits output 10 to turn on again, and the normally open T600 contact resets timer T601. When timer T601 resets, its contact returns to its normal position, and timer T600 begins timing again.

This condition continues until the operator presses the acknowledge button, causing input contact 1 to close.

Contact 1 completes a current path to internal relay 160.

When internal relay 160 energizes, the normally open 160 contact closes and seals the circuit around contact 1.

The normally closed 160 contact opens and turns off the audible alarm. At this time in the circuit, the audible alarm has been turned off, but the warning light is flashing on and off at half-second intervals. This will continue until the pressure drops to a safe level and input 0 reopens all of its contacts, causing the circuit to reset to its normal position.

Entering the Program

Now that the circuit has been developed, it must be entered into the memory of the CPU. When using a small programming terminal, the program must be entered in a language called Boolean.

When programming in Boolean, to connect one contact in series with another, the AND function must be used.

To connect a contact in parallel with another, the OR function is used. To change a contact from open to closed, the NOT function is used. To start a line of the program, the STR function must be used. To end a line of the program, the OUT function is used except when programming a special function such as a timer or counter. When ending a line of the program with a timer, the TMR function is used; when ending the line with a counter, the CNT function is used. Each component of the program must be entered into memory using the ENT key. Some of the keys on this programming unit use serve two functions. The AND key, e.g., is also used to enter the number 7 into the pro gram. The NOT key is also used to enter the number 0 into the program. The second function keys are very similar to the dual purpose keys on a typewriter where the shift key is used to access the second function of a key. The same is true for this unit. The SHF key is used to cause the keys to perform their second function.

Once the SHF key has been pressed, it will remain in effect until the ENT key is pressed. There is no need to hold the SHF key down when entering more than one digit into the program.

The first line of logic will be entered as follows:


Notice that the STR command is used to start the line of logic. The SHF key must be pressed in order to permit the number 0 to be entered. The ENT command causes that instruction to be entered into the logic of the CPU.

The AND function causes the next contact entered to be connected in series with the first contact, and the NOT command instructs the CPU that the contact is to be normally closed instead of normally open. The TMR command instructs the programmable controller that the contact is to be controlled by a timer. Since this line of logic is ended with a timer instead of a normal output or internal relay, the TMR command is used again to instruct the CPU that the last coil is a timer and not an internal relay or output. The CPU can interpret this last timer command to be a coil instead of a contact because directly following this command, the time of the timer had been entered instead of a tie command such a AND or OR. The time is entered with the use of a decimal point in this controller instead of assuming each time interval to be 0.1 second. Different programmable controllers use different methods to enter the time.

The second line of logic is entered as follows:

STR SHF 0 ENT AND NOT TMR SHF 600 ENT OUT SHF 10 ENT The third line of logic is entered as follows:

STR TMR SHF 600 ENT TMR SHF 601 ENT SHF .5 ENT The fourth line of logic is entered as follows:

STR SHF 0 ENT AND NOT SHF 160 ENT OUT SHF 11 ENT The fifth and sixth lines of logic will be entered together because the sixth line of logic is connected in parallel with the fifth:

STR SHF 1 ENT OR SHF 160 ENT AND SHF 0 ENT OUT SHF 160 ENT This completes the programming of the circuit into the CPU.


1. Why are NEMA symbols representing such components as push buttons, limit switches, and float switches not used in a programmable controller schematic?

2. Explain how to program an internal relay into the controller.

3. Why are the contacts used to represent stop buttons and overload contacts programmed normally open?

4. Why is the output I/O used to energize a motor starter instead of energizing the motor directly?

5. A timer is to be programmed for a delay of 3 minutes. What number is used to set this timer?

6. When programming in Boolean, what command is used to connect two circuit components together in series?

7. When programming in Boolean, what command is used to connect two circuit components together in parallel?

8. When programming in Boolean, what command is used to change a contact from normally open to normally closed?

9. Why are the numbers 8 and 9 not used in an OCTAL based system?

Top of Page

PREV: Programmable Logic Controllers (PLC) NEXT: Analog Sensing for (PLC) Programmable Controllers Guide Index HOME