Lecture 3 - 1
Lecture 3 - 1
current supply for the input device connected to it (Figure 4.1a). With sinking, the input
device provides the current to the input unit (Figure 4.1b).
Figures 4.2 and 4.3 show the basic input unit circuits for DC and AC inputs. Optoisolators
(see Section 1.3.4) are used to provide protection. With the AC input unit, a rectifier bridge
network is used to rectify the AC so that the resulting DC signal can provide the signal for
use by the optoisolator to give the input signals to the CPU of the PLC. Individual status
lights are provided for each input to indicate when the input device is providing a signal.
Input device
(a) (b)
LED indicator +P
PLC of input ignal Optoisolator Internal PLC voltage
Input Signal to
toPLC PLC CPU
Protection
diode
Voltage
divider circuit
Signal
Neutral
indicator
Inputs
Selected output
—¥• Multi-
plexer
When analog signals are inputted to a PLC, the input channel needs to convert the signal to a
digital signal using an analog-to-digital converter. With a rack-mounted system this may be
achieved by mounting a suitable analog input card in the rack. So that one analog card is not
required for each analog input, multiplexing is generally used (Figure 4.4). This involves
more than one analog input being connected to the card and then electronic switches used to
select each input in turn .Cards are typically available containing 4, 8, or 16 analog inputs.
Figure 4.5a illustrates the function of an analog-to-digital converter (ADC). A single analog
input signal gives rise to on/off output signals along perhaps eight separate wires. The eight
signals then constitute the so-termed digital word corresponding to the analog input signal
level. With such an 8-bit converter there are 28 = 256 different digital values possible; these
are 0000 0000 to 1111 1111, that is, 0 to 255. The digital output goes up in steps
(Figure 4.5b) and the analog voltages required to produce each digital output are termed
quantization levels.
If the binary output is to change, the analog voltage has to change by the difference in analog
voltage between successive levels. The term resolution is used for the smallest change in
analog voltage that will give rise to a change in 1 bit in the digital output. With an 8-bit ADC,
if, say, the full-scale analog input signal varies between 0 and 10 V, a step of one digital bit
involves an analog input change of 10/255 V or about 0.04 V. This means that a change of
Digitaloutput Digital
Bit output
—$• 7
—K• 6 0000 0010 —
— • 5
Analogue Analogue- —p•
—h• 4
to-digital —h• 3
input converter —h• 0000 0001 —
2
—$• 1
0 00000000
0 1 2
(a) (b) Analogue input
0.03 V in the input will produce no change in the digital output. The number of bits in the
output from an analog-to-digital converter thus determines the resolution, and hence
accuracy, that is possible. If a 10-bit ADC is used, then 210 = 1024 different digital values
are possible and, for the full-scale analog input of 0 to 10 V, a step of one digital
bit involves an analog input change of 10/1023 V, or about 0.01 V. If a 12-bit ADC is used,
then 212 = 4096 different digital values are possible and, for the full-scale analog input of 0
to 10 V, a step of one digital bit involves an analog input change of 10/4095 V, or about
2.4 m V. In general, the resolution of an n-bit ADC is 1/ (2n _ 1); this is sometimes approximated
to 2-n.
The following illustrates the analog-to-digital conversion for an 8-bit converter when the
analog input is in the range 0 to 10 V:
To illustrate this idea, consider a thermocouple used as a sensor with a PLC and giving an
output of 0.5 mV per °C. What will be the accuracy with which the PLC will activate the
output device if the thermocouple is connected to an analog input with a range of 0 to 10 V
DC and using a 10-bit analog-to-digital converter? With a 10-bit converter, there are 210=
1024 bits covering the 0 to 10 V range. Thus a change of 1 bit corresponds to 10/1023 V or
about 0.01 V, that is, 10 mV. Hence the accuracy with which the PLC recognizes the input
from the thermocouple is ±5 mV or ±10°C.
Conversion from analog to digital takes time and, in addition, the use of a multiplexer means
that an analog input card of a PLC only takes “snapshot” samples of input signals. For most
industrial systems, signals from a plant rarely vary so fast that this presents a problem.
Conversion times are typically a few milliseconds.
it is said to be .sinking (Figure 4.6b). Quite often, sinking input units are used for interfacing
with electronic equipment and sourcing output units for interfacing with solenoids.
Output units can be relay, transistor, or triac. Figure 4.7 shows the basic form of a relay
output unit, Figure 4.5 that of a transistor output unit, and Figure 4.9 that of a triac
output unit.
Output Output
unit Load _ unit Load
(a) (b)
From
PLC
CPU
o —V
Optoisolator Relay
Load
Optocoupler
Current
Fuse
flow
Output
PLC
(a)
Optocoupler
O
Output
Fuse Current
flow
O fi• Load
(b) PLC
Figure 4.8: Basic forms of transistor output: (a) current sinking, and (b) current sourcing.
80 Chapter 4
PLC
Triac o +l/
Fom
PLC Fuse
CPU
Optoisolator
Output
LED load
output signal
Analog outputs are frequently required and can be provided by digital-to-analog converters
(DACs) at the output channel. The input to the converter is a sequence of bits with each bit
along a parallel line. Figure 4.10 shows the basic function of the converter.
A bit in the 0 line gives rise to a certain size output pulse. A bit in the 1 line gives rise to an
output pulse of twice the size of the 0 line pulse. A bit in the 2 line gives rise to an output
pulse of twice the size of the 1 line pulse. A bit in the 3 line gives rise to an output pulse of
twice the size of the 2 line pulse, and so on. All the outputs add together to give the analog
version of the digital input. When the digital input changes, the analog output changes in a
stepped manner, the voltage changing by the voltage changes associated with each bit. For
example, if we have an 8-bit converter, the output is made up of voltage values of 28 = 256
analog steps .Suppose the output range is set to 10 V DC. One bit then gives a change of
10/255 V or about 0.04 V. Thus we have:
Digital
input Analog
output
7 —¥•• 2—
6 —¥•
5 — •
Digital-to- Analog
4 —¥•
analog —¥• 1—
3 —¥• conveerteer output
2 —¥•
1 —¥•
0
0 —'• 0000 0001
0000 0000 0000 0010
(a) (b) Digital input
00000000 0.00
00000001 0.04
0000001 0 0.08 + 0.00 = 0.08
00000011 0.08 + 0.04 0.J 2
000001 00 0.1 6
000001 01 0.0J 6 —!—0.00 + 0.04 0.20
0000011 0 0.016 —!—0.08 0.24
00000111 0.016 -I- 0.08 + 0.04 0.28
00001 000 0.32
etc.
Analog output modules are usually provided in a number of outputs, such as 4 to 20 mA, 0 to
+5 V DC, and 0 to +10 V DC, and the appropriate output is selected by switches on the
module. Modules generally have outputs in two forms, one for which all the outputs from that
module have a common voltage supply and one that drives outputs with their own individual
voltage supplies. Figure 4.11 shows the basic principles of these two forms of output.
PLC
Common Individual
PLC
live supplies
O O O L1
1
oN1
2
O O L2
2
4 o N2
5 o L3
0
6 3 N3
7
O o o L4
Fuses Output 4
o N4
loads
Fuses Outputs
(a) (b)
Figure 4.11: Forms of output: (a) common sup P y• and (b) individual supplies.
I/O Processing &S
Might have a reference voltage and compare the voltage from a sensor with it and so obtain
an on/off output depending on whether the voltage from the sensor is above or below the
reference voltage.
4.3 R e m o t e C o n n e c t i o n s
When there are many inputs or outputs located considerable distances away from the PLC,
though it would be possible to run cables from each such device to the PLC, a more economic
solution is to use input/output modules in the vicinity of the inputs and outputs and use just a
single core cable to connect each over the long distances to the PLC, instead of using the
multicore cable that would be needed without such distant I/O modules (Figure 4.18).
Input/output module
Remote input/
output module
Other input/output
modules
Master
PLC
Communication
module
PLC
PLC Communication
port
In some situations a number of PLCs may be linked together with a master PLC unit
sending and receiving input/output data from the other units (Figure 4.19). The distant PLCs
do not contain the control program since all the control processing is carried out by the
master PLC.
The cables used for communicating data between remote input/output modules and a central
PLC, or remote PLCs and the master PLC are typically twisted-pair cabling, often routed
through grounded steel conduit to reduce electrical “noise.” Coaxial cable enables higher
data rates to be transmitted and does not require the shielding of steel conduit. Fiber-optic
cabling has the advantage of resistance to noise, small size, and flexibility and is now
becoming more widely used.
Bits
7
Bits
6
7 6 5 4 3 2 10
5
4
(a) 3
2
1
0
(b)
Bus systems generally employ the method in which a system that wants to transmit listens
to see whether any messages are being transmitted. If no message is being transmitted, a
station can take control of the network and transmit its message. This method is known
as carrier sense multiple access (CSMA). However, we could end up with two stations
simultaneously perceiving the network to be clear for transmission and both
simultaneously taking control and sending messages. The result would be a “collision”
of their transmitted data, resulting in corruption. If such a situation is detected, both
stations cease transmitting and wait a random time before attempting to again transmit.
This is known as carrier sense multiple access with collision detection (CSMA/CD).
PLC manufacturers adopt different forms of network systems and methods of communication
for use with their PLCs. For example, Mitsubishi uses a network termed MelsecNET, Allen-
Bradley has Data Highway Plus, General Electric uses GENET, Texas Instruments uses
TIWAY, and Siemens has PROFIBUS DP. Most, like Allen-Bradley, employ peer-to-peer
forms. With Siemens, PROFIBUS DP is a star, that is, a master/slave form.
Standard Levels
Plant Mainframe
Proprietary LAN network
computer
network
LargePLC
Supervisory Supervisory Computer
PLCs, CNC
Robot PLC Computer PLC PLC
machines, etc.
lowest layer, Device Net, to deal with sensors and drives. PLCs would take instructions from
the Ethernet layer and exercise control through the Control Net layer.
6. Processing Inputs
A PLC is continuously running through its program and updating it as a result of the input
signals. Each such loop is termed a cycle. PLCs could be operated by each input being
examined as it occurred in the program, its effect on the program determined, and the output
correspondingly changed. This mode of operation is termed continuous updating.
Because there is time spent interrogating each input in turn with continuous updating, the
time taken to examine several hundred input/output points can become comparatively long.
To allow more rapid execution of a program, a specific area of RAM is used as a buffer store
between the control logic and the input/output unit. Each input/output has an address in this
memory. At the start of each program cycle the CPU scans all the inputs and copies their
status into the input/output addresses in RAM. As the program is executed, the stored input
data is read, as required, from RAM and the logic operations are carried out. The resulting
output signals are stored in the reserved input/output section of RAM. At the end of each
program cycle all the outputs are transferred from RAM to the appropriate output channels.
The outputs then retain their status until the next updating. This method of operation is
termed mass I/O copying. The sequence can be summarized as follows (Figure 4.31):
1. Scan all the inputs and copy into RAM.
2. Fetch, decode, and execute all program instructions in sequence, copying output
instructions to RAM.
Scan all
inputs
Updat
e
output
s
T Terminal number
Rack number
I = input
Q =output
Xx x . x
— Bit number
Byte number
With the Siemens SIMATIC S5, the inputs and outputs are arranged in groups of eight. Each
such group is termed a byte, and each input or output within a group of eight is termed a bit.
The inputs and outputs thus have their addresses in terms of the byte and bit numbers,
effectively giving a module number followed by a terminal number, a full stop (.) separating
the two numbers. Figure 4.33 shows the system. Thus 10.1 is an input at bit 1 in byte 0, and
Q2.0 is an output at bit 0 in byte 2.
The GEM-80 PLC assigns inputs and output addresses in terms of the module number and
terminal number within that module. The letter A is used to designate inputs, and B outputs.
Thus A3.02 is an input at terminal 02 in module 3, and B5.12 is an output at terminal
12 in module 5.
In addition to using addresses to identify inputs and outputs, PLCs also use their
addressing systems to identify internal, software-created devices, such as relays, timers, and
counters.
Summary
The input/output units of PLCs are designed so that a range of input signals can be changed
into 5 V digital signals and a range of output signals are available. For a PLC input unit with
sourcing, it is the source of the current supply for the input device connected to it; with
sinking, the input device provides the current to the input unit. For a PLC output unit with
sourcing, it provides the current to the output device, and for sinking, the output device
produces the current for the PLC output. Output units can be relay, transistor, or triac.
For inputs, signal conditioning is generally used to convert analog signals to a current in the
range 4 to 20 mA and, thus, by passing through a 250 Ω resistor, to a 1 to 5 V input signal.
This might be achieved by a potential divider or perhaps an operational amplifier. An