Programmable Logic Controllers: Unit 2
Programmable Logic Controllers: Unit 2
Controllers
UNIT 2
- BY RASHMI SHARMA
2
PLC PROGRAMMING PROCEDURE
Begin laying out the industry standard terminal blocks around the PLC on the DIN rail. Build the terminal blocks in
a way that meets safety standards as well as provides access to all terminals.
Begin wiring a circuit breaker using local safety standards. Always ensure the breaker is open to avoid prematurely
energizing the system.
After wiring the breaker attach the outputs of the breaker to their respective terminal block clusters and any DC
power supplies that may be necessary for the job.
After wiring the first set of terminal blocks, with the PLC still disconnected, close the breaker and check for shorts
that could damage the PLC.
Lastly, wire the PLC using its respective diagram and make sure all AC and or DC inputs and outputs are energized
properly.
After wiring a PLC energize it to ensure it powers on correctly. If the PLC behaves strangely or doesn’t boot at all,
immediately check the wiring to ensure accuracy.
5
Step 3: Install Programs
Once the wiring has been double checked and the PLC is booting correctly begin installing the correct
software on the device being used to program the PLC.
For Micrologix Allen Bradley systems use RsLogix500 and RsLinx to program and network the PLC.
Ask a local administrator, IT specialist, or manager for the install files and all necessary serial numbers and
product keys.
Upon completing setup of all necessary programs make sure to restart the device to ensure a completed install.
6
Step 4: Networking
First assign the PLC an IP under the networking tab on the Micrologix device itself. An example IP is
“172.72.7.2”.
Configure the PLCs address and connect it to the programming device using ethernet. Open the networking and
sharing center tab on the device being used to program.
Click on “change adapter settings.” Next, right click on “ethernet” and select properties. Left click on “IPV4” and
select properties. Check the box that says “use the following IP address.” Use the same IP address as registered on
the PLC, however, change the final number.
An example IP is “172.72.7.1”. After inputting the IP into the programming device “OK” and close all windows.
Open RsLinx next, click the communication drop down tab and open “RsWho.” Once RsLinx has detected the
networked PLC click on the ethernet connection. Lastly double click on the PLC labeled by its IP to ensure a
connection.
7
Step 5: Programming
The first thing that should always be done upon first activating a PLC is to upload the program already on the PLC
to the programming device.
This ensures no valuable programs are lost from the PLC and are forced to be rewritten.
After uploading the installed program be sure to save and back it up just in case it is of any importance.
Finally, program the PLC using a background understanding of ladder logic, schematic diagrams of the project to be
programmed, and the debug feature that enables the program to be tested preemptively for errors.
Once all errors have been rectified download the program to the PLC identically to how the program was uploaded
from it.
8
Step 6: Wiring Outputs
Upon completion of the programming portion, shut down the PLC breaker and begin wiring the outputs of the
PLC.
It is crucial to double check the programming of the PLC before wiring outputs.
An incorrect program goes from being an error to a potentially hazardous situation once the PLC has control of
external real world outputs that can prove very dangerous.
The outputs should be wired using the very same DIN rail and terminal block set up as the inputs used.
Always ensure all wiring is to code and safe before proceeding. Before powering the system for the final run
ensure all wiring is exactly to code and no shorts or errors are present that could cause unexpected consequences.
Finally, power on the PLC and activate the process.
9
CONTACTS AND COILS
If a contact is connected to a load and the contact is closed, the load will be turned ON.
The vertical line on the left is the "Power" line, current must flow through the "Switch"
contact in order to turn ON the load "Lamp".
11
TYPES OF CONTACTS
12
COILS
A PLC output is really just an internal relay with a physical connection that can supply
electrical power to control an external load. Thus, like a relay, an output can also have
unlimited number of contacts that can be used in the ladder program.
Each Coil is tied to a specific Bit of data.
13
PROGRAM SCAN
Because the inputs can change at any time, it constantly repeats this cycle as long as the PLC is in the RUN mode.
The time it takes to complete a scan cycle is called the scan cycle time and indicates how fast the controller can
react to changes in inputs.
The time required to make a single scan can vary from about 1 to 20 ms.
If a controller has to react to an input signal that changes states twice during the scan time, it is possible that the
PLC will never be able to detect this change.
For example, if it takes 8 ms for the CPU to scan a program, and an input contact is opening and closing every
4 ms, the program may not respond to the contact changing state.
The CPU will detect a change if it occurs during the update of the input image table file, but the CPU will not
respond to every change.
16
is a function of
the following:
If the rung-condition-in to an input instruction is true, the controller evaluates the instruction
and sets the rung-condition-out to match the results of the evaluation.
If the instruction evaluates to true, the rung condition-out is true.
If the instruction evaluates to false, the rung condition-out is false.
If the rung-condition-in to an output instruction is true, the rung-condition-out is set to true.
If the rung-condition-in to an output instruction is false, the rung-condition-out is set to false.
21
Scan process applied to a single rung program
22
Scan process applied to a single rung program
If the input device connected to address I:3/6 is closed, the input module circuitry senses voltage at the input
terminal and a 1 (ON) condition is entered into the input image table bit I:3/6.
During the program scan, the processor examines bit I:3/6 for a 1 (ON) condition.
In this case, because input I:3/6 is 1, the rung is said to be TRUE or have logic continuity.
The processor then sets the output image table bit O:4/7 to 1.
The processor turns on output O:4/7 during the next I/O scan, and the output device (light) wired to this terminal
becomes energized.
This process is repeated as long as the processor is in the RUN mode.
If the input device opens, electrical continuity is lost, and a 0 would be placed in the input image table. As a result,
the rung is said to be FALSE due to loss of logic continuity.
The processor would then set the output image table bit O:4/7 to 0, causing the output device to turn off.
23
Scan process applied to a multiple rung program
24
Scan process applied to a multiple rung program
Update the input image table by sensing the voltage of the input terminals. Based on the absence or presence of a
voltage, a 0 or a 1 is stored into the memory bit location designated for a particular input terminal.
Solve the ladder logic in order to determine logical continuity. The processor scans the ladder program and
evaluates the logical continuity of each rung by referring to the input image table to see if the input conditions are
met.
If the conditions controlling an output are met, the processor immediately writes a 1 in its memory location,
indicating that the output will be turned ON; conversely, if the conditions are not met a 0 indicating that the device
will be turned OFF is written into its memory location.
The final step of the scan process is to update the actual states of the output devices by transferring the output table
results to the output module, thereby switching the connected output devices ON (1) or OFF (0).
If the status of any input devices changes when the processor is in step 2 or 3, the output condition will not react to
them until the next processor scan.
25
PLC Programming Languages
The term PLC programming language refers to the method by which the user communicates information to the
PLC.
The standard IEC 61131 (Figure 5-14) was established to standardize the multiple languages associated with PLC
programming by defining the following five standard languages.
26
PLC Programming Languages
Ladder diagram language is the most commonly used PLC language and is designed to mimic relay logic.
The ladder diagram is popular for those who prefer to define control actions in terms of relay contacts and coils,
and other functions as block instructions.
28
PLC Programming Languages
The instructional list consists of a series of instructions that refer to the basic AND, OR, and NOT logic gate
functions.
Functional block diagram programming uses instructions that are programmed as blocks wired together on screen to
accomplish certain functions.
Typical types of function blocks include logic, timers, and counters. Functional block diagrams are similar in layout
to electrical/electronic block diagrams used to simplify complex systems by showing blocks of functionality.
The primary concept behind a functional block diagram is data flow. Function blocks are linked together to complete
a circuit that satisfies a control requirement.
Data flow on a path from inputs, through function blocks or instructions, and then to outputs.
29
Functional Block diagram
30
Sequential Function Chart
To complete the entry of a relay-type instruction, you must assign an address to each instruction.
This address indicates what PLC input is connected to what input device and what PLC output will drive what
output device.
The addressing of real inputs and outputs, as well as internals, depends on the PLC model used.
Addressing formats can vary from one PLC family to another as well as for different manufacturers.
These addresses can be represented in decimal, octal, or hexadecimal depending on the number system used by the
PLC.
The address identifies the function of an instruction and links it to a particular bit in the data table portion of the
memory.
33
Instruction Addressing
Addresses contain the slot number of the module where input or output devices are connected. Addresses are
formatted as file type, file number, slot number, and bit.
34
I/O connection diagram
Branch instructions are used to create parallel paths of input condition instructions. This
allows more than one combination of input conditions (OR logic) to establish logic
continuity in a rung.
36
Input Branching
Input branching by formation of parallel branches can be used in your application program to allow more than one
combination of input conditions.
If at least one of these parallel branches forms a true logic path, the rung logic is true and the output will be
energized.
If none of the parallel branches complete a logical path, logic rung continuity is not established and the output will
be de-energized.
Here, either A and B, or C provides logical continuity and energizes output D.
37
Output Branching
On most PLC models, branches can be established at both input and output portions of a rung.
With output branching, you can program parallel outputs on a rung to allow a true logic path to control multiple
outputs.
When there is a true logic rung path, all parallel outputs become true. In the example shown, either A or B provides a
true logical path to all three output instructions: C, D, and E.
Additional input logic instructions (conditions) can be programmed in the output branches to enhance conditional
control of the outputs.
When there is a true logic path, including extra input conditions on an output branch, that branch becomes true.
Here, either A and D or B and D provide a true logic path to E.
38
Nested Branching
Input and output branches can be nested to avoid redundant instructions and to speed up
processor scan time.
A nested branch starts or ends within another branch.
In some PLC models, the programming of a branch circuit within a branch circuit or a
nested branch cannot be done directly.
It is possible, however, to program a logically equivalent branching condition.