PLC Programming: Ladder Logic Inputs
PLC Programming: Ladder Logic Inputs
PLC inputs are easily represented in ladder logic. There are two
types of inputs shown below. They are normally open and normally
closed inputs.
1
Ladder Logic Outputs
2. OSR (One Shot Rise) When initially energized, the instruction
In ladder logic there are multiple types of outputs, but these are not
will turn on for one scan, but then be off for all scans after, until
consistently available on all PLCs. Some of the outputs will be
it is turned off. An input transition on will cause the output x to
externally connected to devices outside the PLC, but it is also
go on for one scan (this is also known as a one shot relay)
possible to use internal memory locations in the PLC. Types of
outputs are shown below
2
PLC HARDWARE
3. The L (latch) and U (unlatch) instructions can be used to lock
outputs on. When an L output is energized the output will turn
on indefinitely, even when the output coil is de-energized. The • Many PLC configurations are available, even from a single
output can only be turned off using a U output. vendor. But, in each of these, there are common components and
concepts. The most essential components are:
• Power Supply - This can be built into the PLC or be an external
unit. Common voltage levels required by the PLC (with and
When the L coil is energized, x will be toggled on, it will stay without the power supply) are 24Vdc, 120Vac, 220Vac.
on until the U coil is energized. This is like a flip-flop and • CPU (Central Processing Unit) - This is a computer where ladder
stays set even when the PLC is turned off. logic is stored and processed.
5 6
3
• The configuration of the PLC refers to the packaging of the
• I/O (Input/Output) - A number of input/output terminals must be components. Typical configurations are listed below from largest
provided so that the PLC can monitor the process and initiate to smallest.
actions. 1. Rack - A rack is often large
• Indicator lights - These indicate the status of the PLC including (up to 18” by 30” by 10”)
power on, program running, and a fault. These are essential when and can hold multiple cards.
diagnosing problems. When necessary, multiple
racks can be connected
together. These tend to be
the highest cost, but also the
most flexible and easy to
7 maintain. 8
4
2. Mini - These are smaller than full sized PLC racks, but can have 3. Micro - These units can be as small as a deck of cards. They
the same IO capacity. tend to have fixed quantities of I/O and limited abilities, but
costs will be the lowest.
9 10
5
4. Software - A software based PLC requires a computer with an • If the light can be dimmed to different levels, it is continuous.
interface card, but allows the PLC to be connected to sensors and Continuous values seem more intuitive, but logical values are
other PLCs across a network. preferred because they allow more certainty, and simplify
control.
INPUTS AND OUTPUTS
• As a result most controls applications (and PLCs) use logical
• Inputs to, and outputs from, a PLC are necessary to monitor and
inputs and outputs for most applications.
control a process.
• Both inputs and outputs can be categorized into two basic types:
logical or continuous. Consider an example of a light bulb. If it
can only be turned on or off, it is logical control.
11 12
6
2. Lights - logical outputs that can often be powered directly from
• Outputs to actuators allow a PLC to cause an action to happen in
PLC output boards.
a process. A short list of popular actuators is given below.
3. Motor Starters - motors often draw a large amount of current
1. Solenoid Valves - logical outputs that can switch a hydraulic or
when started, so they require motor starters, which are basically
pneumatic flow.
large relays.
13 14
7
4. Servo Motors - a continuous output from the PLC can command • Outputs from PLCs are often relays, but they can also be solid
a variable speed or position. state electronics such as transistors for DC outputs or Triacs for
AC outputs. Continuous outputs require special output cards with
digital to analog converters.
• Inputs come from sensors that translate physical phenomena into
electrical signals. Typical examples of sensors are listed below.
1. Proximity Switches - use inductance, capacitance or light to
detect an object logically.
15 16
8
2. Switches - mechanical mechanisms will open or close electrical 4. LVDT (linear variable differential transformer) - measures linear
contacts for a logical signal. displacement continuously using magnetic coupling.
17 18
9
• Inputs for a PLC come in a few basic varieties, the simplest are • This is also referred to as NPN (sinking) and PNP (sourcing).
• Sourcing and sinking inputs are also popular. This output method Inputs
dictates that a device does not supply any power. Instead, the • In smaller PLCs the inputs are normally built in and are specified
device only switches current on or off, like a simple switch. when purchasing the PLC.
• Sinking - When active, the output allows current to flow to a • For larger PLCs the inputs are purchased as modules, or cards,
common ground. This is best selected when different voltages are with 8 or 16 inputs of the same type on each card. The list below
supplied. shows typical ranges for input voltages in order of popularity.
• Sourcing - When active, current flows from a supply, through the 1. 12-24 Vdc 5. 5 Vdc (TTL)
output device and to ground. This method is best used when all 2. 100-120 Vac 6. 200-240 Vac
devices use a single supply voltage. 3. 10-60 Vdc 7. 48 Vdc
19 20
4. 12-24 Vac/dc 8. 24 Vac
10
• PLC input cards rarely supply power, this means that an external • The design process will be much easier if the inputs and outputs
power supply is needed to supply power for the inputs and are planned first.
sensors, as shown how to connect an AC input card. • Tags are entered before the ladder logic.
• inputs are normally high • The program is entered using the much simpler tag names.
impedance. This means
that they will use very
little current.
• There are two inputs, one
is a normally open push
button, and the second is
a temperature switch, or
thermal relay. 21 22
11
Trade-offs when deciding which type of input cards to use. • PLC inputs must convert a variety of logic levels to the 5Vdc
1. DC voltages are usually lower, and therefore safer (12-24V). logic levels used on the data bus. This can be done with circuits
2. DC inputs are very fast, AC inputs require a longer on-time. For shown below. The circuits condition the input to drive an
example, a 50Hz wave may require up to 1/50 sec for optocoupler.
reasonable recognition.
• This electrically isolates
3. DC voltages can be connected to larger variety of electrical
the external electrical
systems.
circuitry from the internal
4. AC signals are more immune to noise than DC, so they are
circuitry. Other circuit
suited to long distances, and noisy (magnetic) environments.
components are used to
5. AC power is easier and less expensive to supply to equipment.
guard against excess or
6. AC signals are very common in many existing automation
reversed voltage polarity.
devices. 23 24
12
• As with input modules, output modules rarely supply any power,
• The output cards typically have 8 to 16 outputs of the same type
but instead act as switches.
and can be purchased with different current ratings.
• External power supplies are connected to the output card and the
• A common choice when purchasing output cards is relays,
card will switch the power on or off for each output.
transistors or triacs.
• Typical output voltages are listed below, and ordered by
• Relays are the most flexible output devices. They are capable of
popularity.
switching both AC and DC outputs. But, they are slower (about
1. 120 Vac
10ms switching is typical), they are bulkier, they cost more, and
2. 24 Vdc
they will wear out after millions of cycles.
3. 12-48 Vac
• Relay outputs are often called dry contacts. Transistors are
4. 12-48 Vdc
limited to DC outputs, and Triacs are limited to AC outputs.
5. 5Vdc (TTL)
Transistor and triac outputs are called switched outputs.
25 26
6. 230 Vac
13
• Dry contacts - a separate relay is dedicated to each output. This • Switched outputs - a voltage is supplied to the PLC card, and the
allows mixed voltages (AC or DC and voltage levels up to the card switches it to different outputs using solid state circuitry
maximum), as well as isolated outputs to protect other outputs (transistors, triacs, etc.) Triacs are well suited to AC devices
and the PLC. Response times are often greater than 10ms. This requiring less than 1A. Transistor outputs use NPN or PNP
method is the least sensitive to voltage variations and spikes. transistors up to 1A typically. Their response time is well under
1ms.
27 28
14
• PLC outputs must convert the 5Vdc logic levels on the PLC data • The output card shown below is an example of a 24Vdc output
bus to external voltage levels. This can be done with circuits card that has a shared common. This type of output card would
typically use transistors for the outputs.
similar to those shown below.
15