Professional Documents
Culture Documents
The PLC system basically consists of seven functional components. As shown in fig.1,
these are the central processing unit , the memory, the input interface unit, the output
interface unit, the communication interface circuit. All communications between these PLC’s
main units take place via four buses: These are:
The data bus: This bus is used to transfer the data between the CPU , the memory, and the
input / output units.
The address bus: This one is responsible for transferring the address of the memory the data
will be send to or fetched from.
The control bus : The control bus controls and synchronize all the traffic between the PLC
main units.
The I/O System bus: This last bus is used for I/O communication.
Communication
Power Supply
Unit
Unit
The CPU is considered as the PLC’s brain. It has the following items :
1- An arithmetic and control unit (ALU) responsible for carrying out arithmetic , logical
operations, and data manipulation on the data held in the memory according to
the instruction of the user program.
3- Control unit to generate the timing signal required to synchronize and control all the PLC
activities.
Memory Unit :
It is the place where the program containing the control instructions is stored. Also it is
the place where data from inputs terminals and data for output terminals are stored. In
general , the PLC may have :
- Read only memory (ROM) to permanently store the PLC operating system .
- Random access memory (RAM) to store data related to the input and output devices in
addition to that of timers, counters , and other internal devices.
As an illustrative example, Tables 1 and 2 show the random access memories embedded in
the high performance XGB basic unit .
To prevent the loss of the program and certain type of data when the power supply is
switched off , a battery is used in the PLC to maintain the user program RAM area and also
the data RAM marked as retain .
Table 1 : The user program memory embedded in the high performance XGB PLC
These units take mid position between the PLC internal digital circuitry and the outside
environment. They allow field input devices ( on/off switches, limit switches, proximity
switches, shift encoders, temperature transmitters, level transmitters, pressure transmitters,
etc ) to control the PLC digital inputs . They allow the PLC digital outputs to control the
field output devices (solenoid valves, magnetic relays, solid state relays, AC drives, stepper
drive, servo drives, etc). In addition to the above, these interface circuits provide signal
conditioning and isolation functions to protect the PLC and allow the input and output
signals to be directly connected without the need for any extra electronic circuitry. From the
point of view of PLC memory, each PLC input or output device has its unique address .
These addresses are what dealt with in the user program instructions.
The signals applied to the PLC input strip points may be AC voltage signals ( 24VAC,
220VAC) may be DC voltage signals ( 12VDC , 24VDC) depending upon the PLC brand
selected. But the PLC internal voltage logic is 5VDC irrespective of the PLC brand so there
is a need for an electronic circuits to map the voltage signal applied to the PLC input strip
into the PLC internal 5VDC logic level. This is the function of the PLC digital input
interface circuits. Figs 2 to 5 display illustrative samples of PLC input interface unit
channels. Fig.2 represents an AC input channel which is fed from an AC type field input
device. Fig3 stands for sink type DC input channel which is supplied from source type DC
field input device. It is called so because the current flow from the field input device toward
the channel .Fig.4 is also DC input channel but this one is considered as source DC input
channel because of the current flow from the channel toward the field input device. Fig5
shows a DC channel which can works with both types of DC field devices.
SW
5VDC
R1 R2
AC R3 buffer
R4
Voltage C1 TO PLC Processor
Signal
C2
R1
buffer
R3
R2 C1
SW
5VDC
R1
R3 buffer
R2 C1
SW
5VDC
DC R1
Voltage R3
buffer
Signal
R2 C1
The PLC internal output logic is restricted to the 5VDC logic which means the output
terminals of the PLC processor (output image register ) may be 0 or 5VDC irrespective of
the brand of the PLC used. The field output devices differ in their voltage need, some of
them must be powered using 12VDC source, some must be powered via 24VDC source,
some must be powered from 24VAC source, some from 220VAC source, some require
slow ON/OFF switching and some need fast ON/OFF switching, some has no surge current,
some has large surge current. The PLC processor digital output circuits have no problem
with the switching speed because of their dependence on transistor switches, the only
problems they have are the voltage type and current rating. As mentioned above ,they can
only supply low level discrete DC voltage output signal (0 or 5VDC). so there is a need for
an electronic circuits to map the processor digital output voltages in to that required by the
field output devices. To achieve such mapping and to provide some form of isolation barrier,
the PLC manufacturers supported their PLCs with digital output interface circuits. In this
context, there are three main types as shown in Fig6 to Fig9. Fig6 displays the relay type
output circuit. This type of output circuits are characterized by:
- Isolate the PLC processor output circuit from the external load circuit.
- Can withstand high surge current and voltage transient because the element in contact with
the load circuit is metallic contact.
Fig7 and Fig8 show Source and sink type output circuits. both uses transistor to control
current flow in the field output devices. These output interface circuits are characterized by:
- Isolate the PLC processor output circuit from the external load circuit.
- Can only be used with DC circuits, because the transistor based switch allows one
current flow direction.
- Load over current and high reverse voltages may destroy such type of output interface
circuits.
- - Isolate the PLC processor output circuit from the external load circuit.
- Can only be used with AC circuits because of the triac type switching element.
- Load over current may easily destroy this type of output interface circuits.
5VDC 5VDC
%QX0.0.0
Load
˜ %QX0.0.1
Load
0V 0V
( a) (b)
5VDC
12/24VDC
%QX0.0.1
Load
5VDC Load
12/24VDC
%QX0.0.1
%QX0.0.1 Load
The PLC analog input interfacing circuits convert current or voltage input signals
coming from field analog input devices (like voltage, current, temperature , speed, pressure,
flow, level, vibration, weight, and position transmitters) into digital data usually word data
types and assign these data to the PLC memory allocated for the analog input channels (in
case of XGB-XECU PLC type, this is defined by the prefix %UW ).
The typical nominal range for the accepted analog signals in XGB-XECU PLC are :
1: 0 – 20mA
2: 4 – 20mA
3: 0 – 5V
4: 1 – 5V
5: 0 – 10V
6: -10 – +10V
The digital data range representing the analog signals over their entire span can be selected
from more than one options. For example, in case of XGB-XECU PLC these are:
1: 0 – 16000
2: -8000 – 8000
3: 4000 – 20000
4: 0 – 10000%
Fig. 10 and Fig11 show how the 2 wire and four wire field transmitters are connected to
the PLC analog input channels .
A/D A/D
2 Wires Sensor / V0+ 2 Wires Sensor / V0+
Transmitter I0+ Transmitter I0+
COM COM
V1+ V1+
2 Wires Sensor / 2 Wires Sensor /
Transmitter I2+ Transmitter I2+
COM COM
V3+ V3+
2 Wires Sensor / 2 Wires Sensor /
Transmitter I3+ Transmitter I3+
COM COM
V4+ V4+
2 Wires Sensor / 2 Wires Sensor /
Transmitter I4+ Transmitter I4+
COM COM
(a) (b)
(a) (b)
The PLC digital to analog output interfacing circuits convert the digital data stored in
the PLC memory allocated for the analog out channels (in case of XGB-XECU PLC type,
this is defined by the prefix %UW ) into analog output voltage or current signals.
The digital data range to be converted can be selected from more than one options. For
example, in case of XGB-XECU PLC these are:
1: 0 – 16000
2: -8000 – 8000
3: 1000 – 5000
4: 0 – 10000%
The typical nominal range for the generated analog signals in XGB-XECU PLC are :
1: 0 – 5V
2: 1 – 5V
3: 0 – 10V
4: -10 – +10V
A/D
V1
V0+ Analog Output Device
CM Input Resistance > 1KΩ
V0-
V1+ V1
Analog Output Device
V1- CM Input Resistance > 1KΩ
I0+
I1
I0- Analog Output Device
CM Input Resistance <600Ω
I1+
I1
I1- Analog Output Device
CM
NC Input Resistance <600Ω
NC
+
-
Fig.12:
BINARY STATE SENSORS & ACTUATORS
CHAPTER 4
.
BINARY STATE SENSORS & ACTUATORS
The universe of discourse includes a lot of what can be described by two states (0,1).
Read/write, start/stop, open/close, key/lock, forward/backward, up/down, left/right,
release/block, enter/exit, clockwise/counterclockwise, on/off, high/low,
full/empty, shine/dark, are all examples of two state expressions used to command two
values actions or express the state of binary entities. These are the words needed in the
construction of many process control algorithms. But as linguistic words neither the
machinery nor the process controllers can understand. So to create an automated
environment with full understanding between the human being, machinery, and process
controllers a certain type of translation or interfacing should be sandwiched between the
different entities. The binary state input devices ( sensors) are the translators that inform
the controller the states of the process whereas the binary output devices (actuators) play
the translation role between the controllers and the machinery.
4.1: Sensors
Sensors are input type devices have the ability to represent the value or state of a chosen
parameter in a form suitable for decision making in programmable controllers. Binary
sensors set includes many different types of switches ( too many to cover). Hand operated
switches, limit switches, inductive proximity switches, capacitive proximity switches, photo
electric switches, magnetic switches, temperature actuated switches, pressure actuated
switches, float switches, mercury switches, and shaft encoders are examples of the sensors
set items.
Human operator actuated switches share the same opening and closing functions but they
differ in their shapes and activation / inactivation mechanism. The shape and activation /
inactivation determine the application area. From these points of view, these switches can be
classified into:
These are finger tip actuated pushbuttons. They have an activation area surrounded or
shrouded by hard sleeve to prevent unintended depressing of the button. The depressing is
only possible by an object smaller than the sleeve. With finger tip it is possible to access the
activation area but with hand palm, the sleeve blocks the entrance and no activation can
take place. There are two types of these pushbuttons, the black or green colored
normally open pushbutton and the red colored normally closed one. For both of
them, the activation is done by depressing the actuator against the internal spring
whereas inactivation occurs when removing the depressing object and allowing the spring
to lift up the actuator. For the normally open one the activation bridges the button’s two
terminals where as the inactivation isolates these two terminals creating an open
BINARY STATE SENSORS & ACTUATORS
circuit between them. In the case of normally closed one the activation does the
reverse, it pushes away the metallic conducting bar creating an open circuit between the
button’s terminals and the inactivation returns the bar to its initial position and this in turn
leads to bridge the button terminal again. Figs. 4.1and 4.2 present the real pictures of
these pushbuttons, the schematic diagram of their internal configuration under pressed and
released situations, and their circuit symbols respectively.
These are similar in operation to their predecessors and share the same circuit samples
but differ in their actuator shapes. Here the activation area is extended beyond the sleeve
and this lead to an easy activation. They can be activated by objects smaller than their
actuators like finger tip and also by object larger than their actuators like hand palm or
more than one finger. Figs 4.3 and 4.4 display the external appearance of this type of
pushbutton along with the operational behavior under pressed and released situations.
BINARY STATE SENSORS & ACTUATORS
Fig. 4.3: Extended actuator ON pushbuttons. (a) : Real picture . (b): Behavior
under normal condition . (c): Behavior under pressed condition
Fig. 4.4: Extended actuator OFF pushbuttons. (a) : Real picture . (b): Behavior
under normal condition . (c): Behavior under pressed condition
The palm actuated ON/OFF switches or simply mushroom switches have mushroom
head like actuating shapes and internal springs to return them to their normal situations
after lifting the depressing objects. Their mushroom head activation area is wide enough
and smooth to be easily pressed by the operator. The operators can activates them
comfortably by their palms. Usually they are used for making or breaking electrical circuit
for short time periods. In general, their structure is suitable for ON/OFF applications that
occur tenth times per day. Fig4.5 shows the single circuit and double circuit versions of
these types of push buttons along with their circuit symbols.
BINARY STATE SENSORS & ACTUATORS
(a) (b)
Fig.4.5: Palm actuated pushbuttons. (a) : Single circuit type. (b): Double circuits type
The emergency stop push buttons adopt the mushroom or palm type actuators to enable
their users to activate them easily and quickly using any part of their bodies they can use at
the time they need to activate these buttons. Always the mushroom type buttons used for
emergency stop purposes are red colored and provided with detention or position
maintaining mechanism to keep the switch in the active state ( after being depressed )
until later released by the operator by pulling its actuator up or rotating it in a specific
direction marked on the activation face. Fig. 4.6 display samples of these emergency stop
push buttons
(a) (b)
These hand actuated switches are also called rotary switches because their operational
states depend upon the direction at which their lever are rotated. Some of these
switches take one of two positions where as the others can be turned right, center, or left to
open or close the electric contacts.
The first two position category is subdivided into two sub categories, one with one set of
contacts and the other with two sets of contacts. The one with one set of contacts (Fig.7-a)
behave either as short circuit through bridging its set’s two contacts or as an open circuit
through breaking the continuity between its set’s two contacts. The one with two sets of
contacts(Fig.7-b) has four connection points, two for the first contact set and two for the
second contact set. As stated earlier, this switch toggles between one of two position. In the
first position, one of the sets say “A” is forced to closes its two contacts to create short
circuit and the second say “B” is forced to open its two contacts to create open circuit
The three positions category one (Fig. 7-c) has two contact sets and can be positioned in
one of three positions left position, middle position, and right position. Here in the left
position one of contact sets say “A” is opened and the second one say “B” is closed, in
the middle position both A and B are opened, and in the right position A is opened and B is
closed.
Mechanical Limit switches are contact sensing devices used to detect the arrival or
departure of relatively low speed moving objects in industrial applications. They are called
so because when an object makes contact with the actuator of the switch , it eventually
moves the operating mechanism to the limit where the switch electrical contacts change
their states, the normally closed one becomes open and the normally open one becomes
closed. Most of the mechanical limit switches consist of four items. These are:
- The actuator : It is that part of the switch which comes in contact with the moving
object.
- Operating head : The operating head which is attached to the actuator allows the rotary,
linear, or perpendicular movement to open and close the switch’s contacts.
- Electrical Contacts and their terminals : Usually, the mechanical limit switches are
provided by two sets of contacts. One set is of normally open contact type, and the other
of normally closed contact type.
- The container : It is also called the switch body and it is where the contacts and their
connecting terminals are mounted.
Broadly, mechanical limit switches are classified into lever type actuator and plunger type
actuator. Fig.4.8 introduces samples of these two types.
Proximity sensors are solid state electronic devices used to detect the presence or
absence of an object without any real contact. They are activated/deactivated depending
upon the nearness or closeness of the object being detected to the sensor face. There are
four fundamental types of proximity sensors, the inductive proximity sensor, the capacitive
proximity sensor, the photoelectric proximity sensor, and the ultrasonic proximity sensor. All
these solid state devices are well protected against vibration, liquids, and corrosive agents
in the industrial environment.
As their names imply, inductive proximity sensors are used to detect the presence
or absence of metallic objects. The sensor as a package consists of LC oscillator,
signal evaluator, and switching amplifier ( see figure 4.9a). The operating principle is that
when a metallic object comes close to the changing magnetic field created by the LC
oscillator, eddy current will flow in the coming object causing an ohmic power loss. This
power loss loads the oscillator. As the object moves nearer, the loading effect increases
causing more reduction in the oscillator output. When the oscillator output reduction
drops below the threshold level, the signal evaluation circuit triggers the switching
output amplifier to change the binary state of the sensor. The label assigned to the
sensor depends upon the switching amplifier output transistor. If the output transistor is PNP
type, the sensor is called PNP or current-sourcing sensor ( figure 4.9b). If it is NPN
transistor, the sensor takes the label of current-sinking ( figure 4.9c).
(a)
(b) (c)
Fig.4.9: Inductive Proximity Sensor.
BINARY STATE SENSORS & ACTUATORS
Capacitive proximity sensors are similar to inductive proximity sensors except that
in capacitive type sensors the target material varies the capacitance of the RC oscillator
whereas in the inductive sensor metallic target varies the inductance of the LC oscillator.
Here the sensor package consists of
- An RC oscillating circuit for which the capacitor plates are part of the sensor itself ( Fig.
4.10a) or the capacitor plates are distributed between one plate at the sensor face and the
other is the earthed fixture (earthed machine cover or mounting bracket ) to which the sensor
is attached (Fig.10b).
- Capacitance change evaluation circuit: The capacitance of any plate type capacitor is
function of the area of the plates, the distance separating the plates, and the permittivity of
the dielectric sandwiched between the plates(C= εo εr A/d ). In general in this type of sensor,
the plates area is fixed so the only parameters that may change the capacitance are the
permittivity ( εr ) and separation distance (d). So any object that affect any one of these
parameters will causes change in oscillator capacitance. The capacitance increases as the
permittivity increases or the separation distance decreases. The capacitance decreases as the
permittivity decreases or the separation distance increases.
- Switching amplifier : when the change in the capacitance comes above certain value, the
evaluation circuit turns the output power transistor ON to connect the load either to the
positive terminal of the dc supply in case of PNP type sensor (Fig.4.10c) or connecting the
load to the negative terminal of the dc supply in case of NPN type sensor (Fig.4.10d).
When the capacitance change drops below a threshold limit, the switching amplifier is turned
OFF.
- dielectric type in which the capacitor plates are built in parts of the sensor. Here the target
object only affect the permittivity parameter because both the area and the separation
parameters are fixed. These types can be used for conductive and non conductive materials.
- Conductive type in which the sensor contributes only in one plate and the other belong to
the metallic structure to which the sensor is attached, here the target object is of conducting
nature (like metal, salt water, blood, acids, etc. ) and it affects the separation distance .
BINARY STATE SENSORS & ACTUATORS
Dielectric
RC Circuit Signal Switching
object
Oscillator Evaluator Amplifier
(a)
Metallic object
(b) (c)
Fig.4.10: Capacitive Proximity Sensor.
Photoelectric proximity sensors are also another type of position sensors. They are used
to sense the presence or absence of an object at predetermined positional point. They use
light-emitting diodes to generate modulated light waves, phototransistors or photodiodes
to detect the transmitted or reflected light waves, and switching electronic circuits to
manipulate and evaluate the detected signal to decide whether to switch ON or switch OFF
the burden connected to the sensors output. The light transmitter and receiver are
positioned in such a way that the presence of the object under monitoring either blocks
or reflects the emitted light beam. Fundamentally there are three types of optical
BINARY STATE SENSORS & ACTUATORS
sensors. These are the thru-beam optical sensor, the retro-reflective optical sensor, and the
diffuse-reflective optical sensor.
The transmitter and receiver of the thru-beam sensor are housed in different cases that are
separated from each other ( figure 4.11). Both the transmitter and receiver are provided
with focusing lenses and are aligned in such a way that the greatest amount of pulsed light
reaches the receiving unit. The transmitter emits light pulses to the receiver. When the light
pulses are interrupted by the virtue of presence of opaque or reflective object, the switching
action in the receiving unit is fired.
- The maximum sensing distant is module dependent but it may reach to meters.
Transmitter Receiver
Internal
Electronics
Load
(a)
Transmitter Receiver
Target
Internal
Electronics
Load
(b)
Fig.4.11: PNP Type Thru-Beam Optical Sensor. (a): No target. (b): Under presence of target
BINARY STATE SENSORS & ACTUATORS
In diffuse-reflective optical sensor, the emitter and receiver are located in single
housing and the target itself is responsible for reflecting the light beam back to the
sensing unit. Here the emitter should be placed perpendicular to the target ( Fg.4.12),
whereas the receiver is positioned at some angle to be able to receive the reflected light.
Target presence reflects the transmitted light signal causing the triggering of the switching
function. Target absence allows the light beam to travel far from the receiver and generates
no switching signal.
- It does not work if the background has lighter color than the object.
-The shape, the color of the object, and its background have an effect on how well it works. .
Transmitter
Internal
Electronics Receiver
Load
Transmitter
Internal
Electronics Receiver
Load
the retro-reflective sensor has both the emitter and receiver housed in single housing like
the diffuse-reflective type. As it is clear from Fig.413, it has a reflecting item to reflect
the light beam toward the receiver . The target presence blocks the light being
received and fires the switching function. This type of sensors does not work well
with glossy and reflective objects. To overcome this problem with glossy and reflective
objects that reflect the light as if they were a reflectors, a linear polarizing filters are located
in front of the transmitter and the receiver. The polarization planes of these filters are
perpendicular to each other. With this modified structure, only light beams passing
through the transmitter polarization filter, reflector, and the receiver polarization filter can
reach the receiver unhindered.
Transmitter
Internal
Electronics Receiver
Load
Transmitter
Internal
Electronics Receiver
Load
The word "reed" refers to a piece of thin and upright cane and it also refers to electrical
contact used in magnetically operated switch. Here both meaning are of key importance, the
first refers to springy feature and the second to conductive feature and these are what the
reed switch contacts must be characterized with. The reed switch consists of two strips
of springy ferromagnetic materials (e.g. iron-nickel) with their contacting ends coated
with plating material (e.g. rhodium). These strips are sealed in inert gas filled glass or
plastic capsule and are available in different sizes and shapes ( Fig.4.14 ).
Fig4.14:
Functionally, these switches came to control the making and breaking of electric circuit, so
structurally they may be of normally open, may be of normally closed, and may be
combination of these two. All of these switches are activated or driven by either permanent
magnetic field or current carrying coil created field (electromagmatic field). Their behavior
depend upon the way the magnetic field moves toward them or leaves them.
To get an idea about the operation of reed switches, the following cases would be
introduced:
Case 1: Normally open reed switch behavior under forward and backward movement of
the permanent magnet with the movement direction is perpendicular to the switch
plan ( Fig.4.15).
When the permanent magnet reaches point B, the reed contacts close by snap close action
because the field force exceeded the Pull-in force. The returning back to point A opens the
contacts when field force drops below the pull-out value.
BINARY STATE SENSORS & ACTUATORS
N S A A
N S
B B
(a) (b)
Fig.4.15: Normally open reed switch . (a): Magnet is far. (b): Magnet is close.
Case 2: : Normally close reed switch behavior under forward and backward movement of
the permanent magnet with the movement direction is perpendicular to the switch
plan ( Fig.4.16).
When the permanent magnet reaches point B, the reed contacts open because the field
force cancels that of the built-in magnet. The returning back to point A closes the contacts.
N S A A
N S
B B
(a) S N (b) S
(b) N
Fig.4.16: Normally close reed switch . (a): Magnet is far. (b): Magnet is close.
BINARY STATE SENSORS & ACTUATORS
Pressure sensors are used to ensure the correct or safety operation of an industrial
applications like cooling system in which the compressor discharge side pressure should
not exceeds a preset high pressure level and at the same time the compressor suction side
pressure should not drops below a preset low pressure level.
Bellow
Bellow
(a) (b)
Air pressure inlet
Fig.4.17: Bellow type switch. (a): Pressure is less than PS (b): Pressure is greater than PS
Bi-Metallic Thermostat
These are derived from the facts that when materials are heated they expand and the high
expansion coefficient material expands more than that with lower expansion coefficient.
From this origin, this type of binary switch is constructed by bounding two strips of
different materials with different coefficients of expansion. The lower coefficient strip is
placed on the top of the strips assembly to allow the bending or shrinking . The assembly
bends upward for an increase in temperature above the setting point and shrinks causing a
downward bending for temperature reduction. Figure 4.18 details these two movements.
Heated state
Volatile Liquid Operated Thermostat
The construction of this thermostat had been extracted from the fact that volatile liquids
try to occupy volumes proportional to their temperatures. As the temperature increases
these volatile liquids expand causing a pressure on their containers and the reveres gives the
reverse. From this, this type of thermostat is built by allowing the volatile liquid to expand or
shrink in a bellow through capillary tube ended with a bulb in contact with the temperature
source. Figure 4.19 displays a schematic diagram of such type.
Micro Micro
Switch Switch
(b
Bulb
)
capillary tube
(a) (b)
Fig.4.19: Bellow type switch. (a):Low temperature (b): High temperature
BINARY STATE SENSORS & ACTUATORS
Liquid level sensors which are also called float sensors are used to monitor the level of
a liquid. They are made up of micro limit switch and level sensitive mechanism to control
the operation of the micro switch. What is shown in figure 4.20 is one type of such switches.
It consists of micro switch, solid ball, and pivoted lever encapsulated in one floating encloser
in addition to adjustable length suspending thread. The operating mechanism of such switch
is that when the liquid level drops below the minimum specified level ( figure 4.21a),
the floating encloser is hanged, the micro switch plunger is released, and the normally
closed contacts are bridged to close the electrical circuit. When the liquid height rises beyond
the free length of the thread, the floating encloser turns up down ( figure 4.21b), the solid
ball pushes the pivoted lever against the switch plunger, and the plunger under press takes
the bridge away from the contacts to stop or open the electrical circuit.
Thread
Pivoted lever
(a) (b)
Fig.4.21: Float sensor extreme positions. (a): Lower position: (b) : Upper position.
BINARY STATE SENSORS & ACTUATORS
In 1870 Edwin Hall stated that when a flat current-carrying conductor of thickness “t” and
carrying current “I” is placed in a magnetic field with flux density B, a voltage will be
generated perpendicular to both the current and the field ( Fig.422). This Hall called voltage
is expressed as :
VH=KH.B.I/t where KH stands for Hall coefficient KH which is directly proportional to the
product of the charge mobility and conductor’s resistivity, B represent the field flux density,
I is the current flowing through the flat conductor, and t is the conductor thickness.
Magnetic flux
lines VH
t
B VH
I
VH
I
According to this equation, Hall effect is negligibly small in most of the metallic conductors
and also insulators because in the former the resistivity is low and in the later the charge
mobility is too low. Hall effect is noticeable in some semiconductors like Indium antimonide
in which KH approaches 20 V/T.
As stated in Fig.4.23, Hall effect proximity switches or sensors basically consist of:
BINARY STATE SENSORS & ACTUATORS
- DC voltage regulator to provide well regulated dc voltage source for Hall element and
also to enlarge the external dc voltage required to supply the sensor as whole.
- Differential amplifier to boost the Hall voltage from its micro volt range to applicable
range.
- Schmitt-trigger with built in hysteresis connected to the amplifier to generate the two
output states “0” and “1” of the senor.
VS+
Regulator
Vout
VS-
Digital output Hall effect sensors are designed to be in the “OFF” state when there is no
magnetic field passing through them and turn “ON” when subjected to magnetic field with
sufficient magnetic flux density and correct polarity.
BINARY STATE SENSORS & ACTUATORS
4.2: Actuators
Actuators are the output devices that are responsible to implements the actions decided
by the controllers or transform the actions into the forms the process machinery can
understand. Actuators are subdivided into electromagnetic output devices and solid state
output devices.
The electromagnetic relays are magnetic actuated switches operated by relatively small
amount of electric current and capable to switch on/off much larger currents. They are still
used as an auxiliary device to switch on/off the field devices. The electromagnetic relay
consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the
coil is energized, by passing current through it, the core becomes magnetized as long as the
excitation source is present. The magnetized core attracts the iron armature. The armature is
pivoted which causes it to operate one or more sets of contacts. When the coil is de-
energized the armature and contacts are released. Each relay consists of magnetic coil,
movable armature, restraining spring, fixed set of electrical contacts, and movable set of
electrical contacts (Fig4.23).
Hinged armature Bounding strip
NC contact
Spring NO contact
Casing
Yoke Insulator
Fig,4.23: Magnetic Relay’s Components,
BINARY STATE SENSORS & ACTUATORS
Figure 4.24 shows an illustrative drawing for the electromagnetic relay construction and its
contacts configuration when its coil is excited and when its coil is not excited. As it is shown
in the figure, exciting the coil pulls down the movable armature, disconnect the movable
contacts from the fixed normally closed contacts and connects them to the fixed normally
open contact. The reverse occurs on de-energizing the relay coil. The relay's contacts are
usually rated between 5 and 10 amperes. The coil possible voltage ratings are 12, 24, 48,
120, 220 VDC or VAC. Also they come with different number of terminals (Fig.4.25).
NO NO
Com Com
NC NC
(a) (b)
Fig.4.25: Relay behavior. (a) : The coil is de-energized (b): The coil is energized
On delay relays are also called on delay timers. Functionally they are identical to the
normal electromagnetic relays except that they are provided with a certain types of
contacts close delay mechanism. In general they are a combination of normal
electromagnetic relays and delay timing units. The timing delays unit may be thermal, may
be mechanical, may be pneumatic, and may be electronic. With any type of on delay
relays the required delay time should be set before energizing the relay power terminals.
After power application, the movable contacts continue keeping contact with the fixed
normally closed contacts (NCs) for an extra time period equals to the selected preset
time then after the passage of that time, they move toward the fixed normally open contacts
and make contact with them. Deenergizing the unit power terminals returns the movable
contacts to their position when the relay is de-energized. Fig4.27 states the behavior of the
on delay relay contacts under the energization and de-energization states. Fig.4.28 display
symbol of market available timing units.
NCs behave as short circuits NCs behave as open circuits NCs behave as short circuits
NOs behave as open circuits NOs behave as short circuits NOs behave as open circuits
(a)
(b)
Off delay relays are also called off delay timers. Functionally they are identical to the
normal electromagnetic relays from the point of view of making and breaking electrical
circuits using normally open contacts and normally closed contacts. Their only difference is
that they are provided with a certain types of contacts open delay mechanism. In
general they are a combination of normal electromagnetic relays and off delay timing units.
As it is the case with on delay relays, in off delay relays the required off delay time should
also be set before energizing the relay power terminals. After power application, the
BINARY STATE SENSORS & ACTUATORS
movable contacts directly move toward the fixed normally open contacts and make contacts
with them. The time the power is switched off, the timing functions start running, as long as
the elapsed time is less than the preset one, the normally open contacts stay in contact with
the movable ones. Once the elapsed time exceeds the preset one the movable contacts leaves
the normally open ones and creates contact with the normally closed contacts (NCs). Fig4.29
states the behavior of the off delay relay contacts under the energization and de-energization
states. Fig.4.30 display two types of market available off delay timing units.
NCs stay closed NCs are open circuited NCs return short circuited
NOs stay opened NOs are short circuited NOs return open circuited
(a) (b)
Fig.4.30: Samples of off delay timers. (a): Standalone one. (b) : Contactor top mounted one
BINARY STATE SENSORS & ACTUATORS
4.2.4 Solenoid
∆X
Coupling bar
Spring
Plunger
Coil
Steel housing
(a) (b)
Fig.31: Solenoid behavior. (a) : OFF state. (b): ON state
Orifice
Inlet Outlet
(a) (b)
Fig.34: Solenoid Valve behavior. (a) : OFF state. (b): ON state
Magnetic contactors are special type of electromagnetic relays. They are designed to
carry heavy current, their current rating may ranges from 10 A to 2000A. To conduct
and interrupt heavy currents, the contactors are provided with spark extinction
mechanism to let the contactors contacts make and break the heavy currents without
damage. The pictures in figure 4.36 give an idea about the construction of this switching
devices in addition to its behavior under the powered and unpowered states. Fig.4.37 display
examples of industrial magnetic contactors.
NC
Control
contacts
NO
L1 T1
Power
L2 T2
contacts
L3 T3
Armature
Coil
˷
Fig.4.36: Basic construction of magnetic contactor. (a): OFF state. (b): ON state
BINARY STATE SENSORS & ACTUATORS
DC solid state relays are power electronics switching devices in which small control
signals (3-32VDC ) control large DC load currents. Figure 4.38 introduces the basic
functional blocks of this contact less relay. As it is sound from the figure it is free from
any mechanical part and so it can be used for high switching rates as compared to
BINARY STATE SENSORS & ACTUATORS
the electromagnetic one witch can only be used with relatively small switching rate
applications. Here the application of the control signal creates conducting bridge between
the power source and the load via the power transistor low forward resistance.
Blocking the control signal increases the transistor resistance connected in series with the
load ( device reverse resistance) and this reduces the load current into negligible value. The
Solid state relays can be driven by different devices because of its control voltage wide
operating range. Fig.4.39 shows symbols of these relays.
Load
0-Vdcmax
voltage
Input Output
3-32VDC circuit circuit
voltage
AC solid state relays are power electronics switching devices used to control the switching
of heavy AC load currents using either two antiparallel connected thyristors or triac switches
. Here the firing signal and hence the heavy AC load current is also controlled by small
control signals ( 3-32VDC). Figure4.40 shows the basic functional blocks of this mechanical
parts free relay. Here the application of the control signal creates conducting bridge
between the power source and the load via the power semiconductor device low forward
resistance. Blocking the control signal stops the firing pulses and leads to negligible current
flow in the load or in other word increases the power switch resistance connected in series
with the load into very high value. Samples of ac solid state relays are shown in fig,4.41.
Load
0-VACmax
voltage
Input Output
3-32VDC circuit circuit
voltage
N
Fig.4.41: Functional blocks of triac type solid state relay
Bit :
Bit is the smallest unit of storage. A bit stores just a “0” or “1”. The Bit is suitable
to represents the lamp’s state ( dark, shining). The Bit is suitable to represents the
push-button states ( presses, released ). The Bit is suitable to represents the selector
switch (ON,OFF).
Byte :
Byte is a group of 8 bits.
When all its eight bits take their “0” value
( 27*0 + 26*0 +25*0 24*0 +23*0 +22*0 +21*0 +20*0) , the decimal equivalent of the
Byte is “0”.
When all its eight bits take their “1” value
( 27*1 + 26*1 +25*1 24*1 +23*1 +22*1 +21*1 +20*1) , the decimal equivalent of the
Byte is “255” and this equals to 28-1 ( where 8 refers to the fact that the Byte
consists of 8 Bits).
Word :
Word is a group of 16 Bits ( two Bytes).
When all its sixteen bits take their “0” value
( 215*0 + 214*0 + 213*0 +212*0 +211*0 +210*0 +29*0 + 28*0 + 27*0 + 26*0 +25*0 +24*0 +23*0 +22*0 +21*0 +20*0)
, the decimal equivalent of the Word is “65535” and this equals 216-1 ( where 16
refers to the fact that the Word consists of 16 Bits) .
Double Word :
Double Word is a group of 32 Bits ( 2 words or 4 bytes).
When all its thirty two bits take their “0” value
( 231*0 + …………….. +211*0 +210*0 +29*0 + 28*0 + 27*0 + 26*0 +25*0 +24*0 +23*0 +22*0 +21*0 +20*0)
, the decimal equivalent of the Double Word is “4 294 967 295” and this equals
232-1 ( where 32 refers to the fact that Double Word consists of 32 Bits) .
Long Word :
Long Word is a group of 64 Bits (4 words or 8 bytes ).
When all its sixty four bits take their “0” value
( 263*0 + …………….. +211*0 +210*0 +29*0 + 28*0 + 27*0 + 26*0 +25*0 +24*0 +23*0 +22*0 +21*0 +20*0)
, the decimal equivalent of the Long Word is “9223 3720 3685 4775 807” and
this equals 264-1 ( where 64 refers to the fact that Long Word consists of 64 Bits) .
Integer :
Integer is a whole number ( not fractional number ) that can be positive, negative,
or zero.
The following numbers are integer type numbers :
0,1,1000,1959, -2000, -16000, 16000, etc.
In PLC and in computers in general, Integer number is represented by 16 bits (
one Word or two Bytes ), the most significant bit (the bit with weight 215) is used
for the number’s sign ( 1means negative number and 0 means positive number )
whereas the remaining 15 bits are used for the number’s magnitude. Because of
this distribution , the Integer number takes values from -32768 through 0 to 32767
.
Why the maximum value of integer number is 32767?
Answer:
As mentioned above, the number of bits allocated for the magnitude in integer
type is 15 bits and this reaches its maximum value when all the bits take their “1”
value
( 214*1 + 213*1 +212*1 +211*1 +210*1 +29*1 + 28*1 + 27*1 + 26*1 +25*1 +24*1 +23*1 +22*1 +21*1 +20*1)
=215-1=32767
Double Integer :
In PLC and in computers , Double Integer number is represented by 32 bits (two
Words or 4 Bytes ), the most significant bit (the bit with weight 231) is used for the
number’s sign ( 1means negative number and 0 means positive number ) whereas
the remaining 31 bits are used for the number’s magnitude. Because of this
distribution , the Double Integer number takes values from -2147483648 (=-231)
through 0 to 2147483647 (=231-1 ).
Long Integer :
In PLC and in computers , Long Integer number is represented by 64 (4 Words or
8 Bytes ) bits, the most significant bit (the bit with weight 263) is used for the
number’s sign whereas the remaining 63 bits are used for the number’s magnitude.
Because of this distribution, the Long Integer number takes values from -263
through 0 to 263 -1.
Unsigned Integer :
In PLC and in computers , Unsigned Integer number is represented by 16 bits (
one Word ). It differs from the Integer by the maximum and the minimum values
because the Integer type uses 15 bits for the magnitude and one bit for the sign
where as the Unsigned Integer takes only positive values and so the whole number
of bits (16 bits ) are used for the number representation . Its minimum value is 0
and its maximum value is 65535 (216-1).
In PLC programming, contacts and coils instructions play the same roles of the
independent and dependent variables of Boolean expression assignment statements
A O B = C in which A and B are the independent variables , O is the logic function, and C
is the dependent variable ( mapping result). The contact instructions { | | , |/| , |P| ,
|N|} form the independent variables set whereas the coil instructions { ( ), ( /
), ( S ), ( R ), ( P ), ( N ) } take the position of the dependent ones . Each of
aforementioned PLC instructions has its own unique applications. The following
will details the meaning and applications of these instructions :
Fig, 2.1 shows how to construct 3-input AND logic gate using normally open contact
instruction.
Instruction.
The normally closed contact instruction takes the role of the normally closed
contact of magnetic relay. As its instance when being activated, disconnects the rung
points connected to its left and rights sides. The state of the contact reflects the negated
state of its driving bit. When the driving bit is "1" the contact behaves as an open circuit
and behaves as a closed circuit when the driving bit is "0". The way these contacts are
connected is also important. The serial connection gives NOR logic gate's equivalent
and the parallel one gives the NAND logic gate equivalent.
Fig,2.3 displays the construction of 3-input NOR gate using the normally closed contact.
Fig.2.4 shows how to constructs 3- input NAND logic gate using normally closed contact
Instructions.
Figure 2.3 : 3-input NOR Gate
Switches
Scan#1 Scan#2 Scan#3
Instruction Right
Side signal
Switches
Figure 2.5: Positive transition sensing contact behavior
Switches
Fig 2.6 states how to use this instruction in constructing rising edge T flip-flop.
This one is identical to its predecessor except that the temporary logic one state
takes place at the transition of its logic value from logic one ( its value at the previous
state) to logic zero ( at the current scan) and then return to zero again ( at the next
scan. Figure 2.7 shows the behavior of such instruction .
Scan#1
Switches Scan#2 Scan#3
Instruction Right
Side signal
Switches
Switches
Figure 2.7: Negative transition sensing contact
behavior
Fig. 2.8 illustrates how this instruction can be used to construct falling edge T flip-flop.
This coil instruction behaves the same way the magnetic contactor's coil behaves.
Its activation and deactivation depends upon its left side rung logic value. Logic one
means an active state and this means writing "1" in its corresponding bit location in the
process-image register. Logic zero resets it corresponding bit. In other words, one can say
that this instruction is the dependent logic variable in a logic expression ( Ex :D= ( A
AND B ) OR C.
Fig. 2.9 shows this coil instruction represents the dependent variable “ D” in the logic
expression “ D = ( A AND B ) OR C “.
The negated coil instruction can be considered as coil instruction followed by logic
NOT gate . It does the reverse of the normal coil instruction. When the logic value of its
left side rung equals "1" , it writes "0" in its corresponding bit location in the
process-image register and does the reverse when its left side rung jumps to "1".
These two coils instructions control the same bit in the process-image register. The
SET coil instruction sets the bit ( write logic "1" to the bit) when its left side rung
toggle to logic "1" and remain so what over the value of its left side rung is. The
RESET coil instruction reset the bit(write logic "0" to the bit) set by SET instruction when
its left side rung toggle to logic "1" and remain so what over the value of its left side
rung is. From the point of view of digital logic, these two coil instructions play the
same roles of the "S" and "R" inputs of the well-known SR flip-flop.
Fig. 2.12 uses the SET and RESET coil instruction in building first in priority circuit.
Instruction Left
Side signal
Switches
Scan#1
Switches Scan#2 Scan#3
Fig. 2.14 uses positive transition sensing coil instruction to build positive triggered JK flip
flop
The negative transition sensing coil instruction does the reverse of its counterpart ,
the positive transition sensing coil instruction. When its left side rung logic value
changes from one ( rung valve at the previous scan ) to zero ( at the current scan )
this coil instruction forces its corresponding bit in the process image register to take
logic "1" only during the current scan.
ON Delay Timers
ON delay timers are used to create contact instructions (Q) that becomes active
after preset time interval passage. These timers instructions are classified in to direct time
setting timers (TON) in which the time setting is the time assigned to the input PT (here
PT is of TIME data type) and indirect or integer time setting (TON_UINT) in which the
time setting is the product of integer type preset time setting (PT) and integer type time
unit (UNIT). Both has an enable input (IN) to activate or deactivate the instruction and
an output variable ET to register and display the elapsed time. Figure 1 displays the
ladder symbols of these timers and also their timing diagram.
TON TON
IN Q IN Q
PT
PT ET ET
UNIT
(a) (b)
IN IN
PT PT
Q Q
PT*UNIT
PT
ET ET
Figure 1: ON delay timers a): On timer b): On timer of integer setting.
Example 1: ON delay Motor Starter.
Stop1 Start1 X1
es
Swi
X TON Motor #1
tch
IN Q Switches
S es
w T#60S
PT ET
Stop2
it Start2
Switche X
c
Switc Switc
s 2
h X2
hes hes
e
X2 TON_UNIT Motor #2
S
Swi
s IN Q w
Switch tch Switches
it
es es 60
PT ET
c
Swi h
1000 PT
tch e
Switche
Figure 2: ON delay Motor Starter. es s
s
T#60S
PT ET
Main T1.Q Delta
Star:%QX0.0.1
Switche
Switc Switc Switc
s Switches
hes
Main hes
T1.Q hes
Star
Delta:%QX0.0.2
OFF delay timers are used to delay the off activities. When activated (IN=1), these
timers instantaneously close their normally open contacts but when deactivated (IN=0) they
delay the opening of these contacts until the preset time delay is elapsed. These timers
instructions are classified in to direct time setting timers (TOF without rest facility and
TOF_RST with reset facility) in which the time setting is the time assigned to the input
PT (here PT is of TIME data type) and indirect or integer time setting (TOF_UINT) in
which the time setting is the product of integer type preset time setting (PT) and integer
type time unit (UNIT). Each has an enable input (IN) to activate or deactivate the
instruction and an output variable ET to store the elapsed time. Figure 4 displays the
ladder symbols of these timers and also their timing diagram.
TOF TOF_RST
IN Q IN Q
PT
PT ET ET
UNIT
IN IN
Q Q
PT PT
PT PT
(a)
RST
TOF_UNIT
IN Q (b)
ET PT
ET
UNIT
IN
Q
PT*UNIT
PT* UNIT
(c)
Figure 4: OFF delay timers a): OF timer b): OF with reset c) OF timer with integer setting.
Example 3: Three phase induction motor bidirectional star delta starter.
Switches FWOFFT
FWMain TOFF
Switches
Switches IN Q
TFON
FWMain
T#1m
PT ET
TON
Switches
Switches
IN Q Switche
s
T#60S
PT ET
Switche
Stop StartREV:%IX0.0.2 FMMain FWOFFT.Q REVMain:%QX0.0.1
s
Switches Switches
Switches Switches Switches
REVMain
Switches REVOFFT
REVMain TOFF
Switches
Switches
IN Q
TRON
T#1m
PT ET
REVMain TON
Switches
Switches Switche
IN Q
s
T#60S
PT ET
Switche
TFON.Q
FWMain Delta
Star:%QX0.0.2
s
Switches Switches Switc
Switches
REVMain TRON.Q
hes
` Switches Switches
Delta:%QX0.0.3
FWMain TFON.Q Star
Switches
Switches Switches Switc
REVMain TRON.Q
hes
Switches Switches
Pulse timers are used to produce fixed duration output after being excited by their left side
rung positive transition. On the positive transition of IN, these timers instantaneously close
their normally open contacts and remain so till the elapsed time reaches the preset time, the
moment the contacts return to their state. Negative transition of RST resets the elapsed
time output (ET) and allow for new cycle. Any toggling for IN in the period from the
positive transition to the preset time is neglected. These timers instructions are classified
into direct time setting timers (TP without rest facility and TP_RST with reset facility)
and indirect or integer time setting (TP_UINT). Figure 6 displays the ladder symbols of
these timers and also their timing diagram.
TP TP_RST
IN Q IN Q
PT
PT ET ET
UNIT
RST
I
N
Q
PT IN
P
T
ET Q
PT
(a) PT
ET
TP_UNIT
IN Q
ET RST
PT
ET (b)
UNIT
RST
I
N
Q
PT
P
T
ET
(c)
Figure 6: OFF delay timers a): OF timer b): OF with reset c) OF timer with integer setting.
Example 4: Automatic liquid mixing machine.
MixingMotor
SValve2
LS2
SValve1 LS1
MixerOutlet
Stop:% IX0.0.1 i
LS1 LS2 SVslve2:%QX0.0.1
t
Switches Switches Switches
c
SValve1
h
2Switche
e MixingMotor:% QX0.0.2
SValve2 s TP_UNIT
Switches s
IN Q Switches
% MW2
PT
1000
Switche UNIT
0Switches
RST
s
Switche
MixerOutlet:%QX0.0. 3
MixingMotor:%QX0.0.2
s TP_UNIT
N
Switches
IN Q
% MW3 PT
1000
Switche UNIT
s
0Switche
RST
s
Switche
Integration timers (TMR) integrate the ON period or periods of their inputs marked IN
and store the accumulated time in the elapsed time variable (ET). When ET reaches the
preset time ( PT in case of TMR and PT*UNIT in case of TMR_UNUIT), the instructions
assign "1" to their outputs Q. New cycle can be initiated after stropping the RST inputs.
Figure 8 shows their ladder symbol and timing diagrams.
TMR TMR_UNIT
IN Q IN Q
PT
PT ET ET
UNIT
RST RST
IN IN
Q Q
PT PT
RST RST
(a) (b)
Figure 8: TMR timers (a): Direct TMR (b): TMR with integer setting
Example 5: Ice cream cone filling machine with teaching function.
N/T:%IX0.0.0 R
P
Switches Swi
S tch
w TMR1 es
i
N/T Fill:%IX0.0.1 TMR
Switches
t
Switc Switches
IN Q
c
hes
h T#1m
PT ET
e
R
Switche
s
RST
s
S
wi
tc
Fill
N/T MOVE
he
N IN Q
Switches s
Quantity
Sw TMR1.ET OUT
IN
itc
Switches
Switches
N/T he Fill
TP1Switc
s
IN TP hes
Switches Switc
hes
Q
Quantity
PT ET
Switches
N/T Fill
FillerOutlet:%QX0.0.
0
Switches Switc
N/T TP1.Q
hes
Switches
Switches Switche
Integration timers with flickers (TMR_FLK) produces an out signal Q with mark equals
to the time assigned to ON time input variable and space equals to the time assigned to the
OFF time input variable. Figure 10 pictures the ladder symbol used and state the operating
principle of this timing instruction.
TMR_FLK IN
IN Q
ON ON Time
ET
OFF
OFF Time
RST
TMR_FLK1
Switches
IN Q
T#60S
ON ET
T#60S
Switche OFF
s
Switches
T#60S RST
EN Q
Switches
TMR_FLK1.Q MOVE
EN Q
Switches
2#10101010
OUT %QB0.0.0
IN
Switches
A/M Fill
TRTG Timers
Retriggerable timers produce an out signal Q with pulse width equals to the time
assigned to PT in case of ( TRTG) type and equals to PT*UINT in case of TRTG_UINT
one. Here the new pulse can only be generated after the elapsed of the preset time ( until
ET=PT) and occurrence of positive transition of the instruction input IN. Figure 12
pictures the ladder symbol used and gives more deep understanding to the relationship
between the various variables of this timing instruction.
TRTG TRTG-UINT
IN Q IN Q
PT
PT ET ET
UNIT
RST RST
IN IN
Q Q
PT PT
RST RST
(a) (b)
Figure 12: TRTG timers (a): Direct TRTG (b): TRTG with integer setting
Example 7: PWM Heater Control.
TRTG1
Switches Switches
IN Q
TRTG1.Q % MW2 PT ET
N
Switches 1000
Switche UNIT
S
TMR_FLK1.Q s
Switches
0 RST
wi GE
EN Q
Switches tc
Swi
OFF Period IN1 Pulses:%QX0.0.0
he OUT
TRTG1.E tch
Switches
IN2
s
TSwitches es
Switches
UP Counting Counters
Up counters increase their current count output variable “ CV” each time their
trigger inputs experience a transition from logic zero to logic one. The instruction output
Boolean variable Q toggles from zero to one when CV reaches the preset count value “ PV”
and stay so unless reset by the reset input R. The upper counting level depends upon the
counting instruction type. Table 1 lists the upper limits for the various up counting
instructions . Figure 1 shows the instruction function block and timing chart.
CTU_XXXXX R
CU Q
CU
R
Q
CV
PV CV
PV
CV=0 CV=PV
CV=1 CV=Max Count
books each time preset number of books have been passed ( say 12 books).
BooksSensors
BooksSensors C1.Q ResetC1
ResetC1
P
Switches
Switches Switches Switches
Switches
C1
Swi
BooksSensors CTU_INT
tch Swit
N
Switches
es
IN ches Q
Swit ResetC1
R
che
Switches
s
Req.Quantity PV CV
Switches Switches
Down counters decrease their current count output variable labeled CV , starting from
the preset value "PV" loaded by the load input "LD", each time their trigger inputs
experience transition from logic zero to logic one. The instruction output Boolean
variable Q toggles from zero to one the time CV reaches zero and stay one unless reset by
the load input LD . The minimum counting level depends upon the counting instruction
type. Table 2 lists the lower limits for the various down counting instructions . Figure 2
shows the instruction function block and details its timing chart.
LD Q
PV CV
PV CV 0
CV=PV CV=0
CV=PV-1 CV=Mini Count
Example 2: Write ladder diagram to track the number of remaining items in a store
previously loaded with 100 items.
Swit Load t
LD
che c
Switches
s 100 PV CV h
C1.Q e
StoreEmpty
Switches
s
Switches Switches
UP / Down counters can be considered as two counters (up counter and down counter)
sharing the same preset value input variable PV and current value output variable CV. The
up counting part has its own unshared terminals or variables represented by the triggering
input CU, reset input R, and the output QU. The down counter unshared variables are
the triggering input CD, the load input LD, and the output variable QD. The upper and
lower counting levels for these counters depend upon the instruction used type. Table 3 list
down these limits.
Table 3: MAXIMUM /Minimum counting values of up/down counting instructions
Example 3: Draw ladder diagram for Parking Garage Controller with N car capacity
Start
LT
Switches IN ENO
CarInside SpaceOK
Swit IN1
OUT
che Switches Switches
Capacity IN2 GarageFull
S
s
Switches w
Switches
h wi
NS PV
e tc
wi
s he
S
tc
wi s
he
tc
Figure 5: Parking Garage Controller
s
he
s
Ring Counter
Ring counter CTR is an up counting instruction with inherent reset strobe facility. Here
the current value CV increases as the rung connected to CD experiences a transition from
zero to one and CV is less than PV. When CV equals PV the Q output becomes "1". The
next positive transition on CD ( after CV=PV) resets the Q output and forces CV to take a
value of one and new cycle starts. The ring counter supports only integer data types for its
CV and PV variables. Figure 6 displays the ladder symbol and the timing chart of the ring
counter.
RST
CTR1
CTR CD
CD Q
PV Q
PV CV
RST CV
Example 4: Y is one dimensional array. It consists of 10 word type elements. Write PLC
Program segment to continuously copy the contents of this array one after the other to the
PLC output terminals. Let the copy process time span equals to 30sec.
tch MOVE es
Switches EN ENO
es
Pattern[J] IN OUT Lamp
Swit
che s
s
The shift designated array elements ( SHIFT_A) shifts the sub array elements starting at
the start shifting location(Start) and terminating at the end shifting location(End). Each time
the instruction enable bit (EN) experiences a positive transition, the sub array elements are
shifted N times. The sub array first N elements ( from the Start position) are filled by the
data stored in the IN input variable. The data leaving the end position ( over flowing data ) is
shifted to the output variable OUT. The direction of shifting is determined by
the comparison state of Start and End. For Start>End, the shift direction is from the
upper positions to the lower ones and vice versa. The source array (SRC) data type can be
any type except the string type. Figure 1 shows the ladder symbol of the instruction
under investigation and also the shifting movement for one positive transition of IN .
Using SHIFT_A instruction, write ladder program to generate the following repeated
sequence [ 0,1,4,8,16,32,64,128].
MOVE
BooksSensors
_1ON
EN ENO
Switches
Switch
ResetC1
es
1 IN OUT %QW0.0.0
Switches
Sw
itc
_T20s SHFT_A
he
P
Switche
EN ENO
s
Swis
%QW0.0.0 IN OUT %QW0.0.0
tch
es
A SRC SRC A
C
6 START
0 END
1 N
The shift with carry instruction (SHIFT_C) behaves the same way the SHIFT_A
instruction does. It can be considered as SHIFT_A with Boolean data type but SRC is not an
array data type. Here SCR may be Byte, Word, Dword, or Lword. So to treat SHIFT_ C as
SHIFT_A, the byte type data should be treated as if it were an array of 8 Boolean type
elements, word type data as an array of 16 Boolean type elements, dword as an array of
32 Boolean type elements, and lword as an array of 64 Boolean type elements . Figure 3
shows the ladder symbol of this instruction and also the shifting movement for one
positive transition of IN .
UINT N
Using SHIFT_C instruction, write ladder program to generate the following repeated
sequence [ 0,1,2,4,8,16,32,64,128].
Solution : The solution is as drawn in figure 9.3 with an initial value of %mw2
equals 1.
MOVE
BooksSensors
_1ON
EN ENO
Switches
Switch
ResetC1
es
1 IN OUT %MW2
Switches
Sw
Shift Right.
The shift right instruction ( SHR) shifts the image of the bit string ( Byte, Word, Dword,
Lword ) assigned to IN ( instruction data input) as N ( instruction shifting times ) bits
number and stores the shifted result in the instruction output variable OUT. As compared to
SHIFT_C, this one has one shift direction ( from left to right), the shifting process is
executed over the whole string image, the overflow data is lost, and there is no specific
inlet to substitute the left end bit or bits. Figure 5 highlights the ladder symbol used and
illustrates is operation for different N values.
SHR IN N OUT
BOOL EN ENO BOOL 1 64
{ Byte,Word, IN { Byte,Word, 2 32
OUT
Dword,Lword 3 16
Dword,Lword}
4 8
INT } N 5 4
6 2
7 1
8 0
Example 3:
Draw ladder diagram to copy the upper byte of %MW4 to the lower byte of %QW0.0.0.
without affecting the content of the upper part of %QW0.0.0.
Solution:
Copy
SHR
P EN ENO
Switche
%MW4
Swi s IN OUT X
tch 8 N
es
AND
BooksSensors
EN ENO
%QW0.0.0
Switches IN1
ResetC1 %QW0.0.0
OUT
16#FF00 IN2
Switches
OR
EN ENO
%QW0.0.0 IN1
OUT %QW0.0.0
X IN2
The shift let instruction ( SHL) does the reverse done by its predecessor SHR. SHR
does the integer division by two, but SHL does the multiplication by 2. It shifts the image
of the bit string IN as N times from the least significant bit towards the most significant one.
Figure 7 displays the ladder symbol used and illustrates the instruction operation for
different N values.
SHL IN N OUT
BOOL EN ENO BOOL 1 2
{ Byte,Word, IN OUT { Byte,Word, 2 4
Dword,Lword Dword,Lword} 3 8
4 16
INT } N 5 32
6 64
7 128
8 256
Figure 7: SHL ladder symbol and shifting Process as function of N
Example 4:
Draw ladder diagram to copy the lower byte of %MW4 to the upper byte of %QW0.0.0.
without affecting the content of the lower part of %QW0.0.0..
Solution:
Copy
SHL
EN ENO
Switches
%MW4 IN OUT X
8 N
AND
BooksSensors
EN ENO
%QW0.0.0
Switches IN1
ResetC1 %QW0.0.0
OUT
16#00FF IN2
Switches
OR
EN ENO
%QW0.0.0 IN1
OUT %QW0.0.0
X IN2
The Rotate designated array elements ( ROTATE_A) shifts the sub array elements
starting from the start shifting location (Start) and terminating at the end shifting location
(End). Each time the instruction enable bit (EN) experiences a positive transition, the sub
array elements are shifted N times. The sub array first N elements ( from the Start position)
are filled with the data coming from the end location. The data leaving the end position
( over flowing data ) is stored in the output variable OUT. The direction of shifting is
determined by the comparison state of Start and End. For start>End, the shift direction is
from the upper positions to the lower ones and vice versa. The source array (SRC) data
type can be any type except the string type. Figure 9 shows the ladder symbol of the
instruction under investigation and also the shifting movement for three different
configurations.
ROTATE_A
BOOL EN ENO BOOL
Figure 9: ROTATE_A ladder symbol and behavior for Three different Configuration.
Example 5:
Propose ladder diagram to control the ON/OFF switching of eight lamps according to
the data listed in figure 10. Assume the step rhythm to be 20 sec.
Figure 11 details the solution in which the array Y is initialized with the hexa decimal
values { 18,24,42,81,42,24,18,00,FF,00,FF,00,FF}.
T1
Start
TMR_FLK
EN Q
Switches
T#10S ON
T#10S OFF ET
0 RST
T1.Q
ROTATE_A
PSwitches EN ENO
Y SRC SRC
12 START
OUT %QB0.0.0
0 END
1 N
The rotate with carry instruction (ROTATE_C) shifts the sub bit string SRC ( SRC may
be Byte, Word, Sword, Lword) bits starting from the start shifting location (start) and
terminating at the end shifting location(END). Each time the instruction enable bit (EN)
experiences a positive transition, the sub string bits are shifted N times. The sub string
first N bits ( from the Start position) are filled with the data coming from the end
location. The data leaving the end position ( over flowing data ) is stored in the Boolean
output variable OUT. The direction of shifting is determined by the comparison state
of Start and End. For start > End, the shift direction is from the upper positions to the
lower ones and vice versa. Figure 12 shows the ladder symbol of this shifting instruction
and its behavior under different configurations..
ROTATE_C
BOOL EN ENO BOOL
{ Byte, Word, SRC SRC { Byte, Word,
Dword, Lword} C Dword, Lword}
UINT START
OUT BOOL
UINT END
UINT N
Figure 12: ROTATE_C ladder symbol and behavior for four different Configuration.
Example 6:
The water circulation for cooling tower is to be 24 hours. Propose a three water pump
system in which each pump runs one hour and rests two.
Solution:
Run
MOVE
P EN ENO
Switches
S 1 IN OUT %QX0.0.0
wi
tc
he
T1
Run
s TMR_FLK
Switches
EN Q
T#30M ON
T#30M OFF ET
0 RST
T1.Q Run
ROTATE_C
N
Switches
EN ENO
Switch
SRC %QW0.0.0
%QW0.0.0
S es SRC
wi 0 START
tc
2 END OUT
he
s 1 N
The rotate right instruction ( ROR) shifts the image of the input bit string IN ( Byte,
Word, Dword, Lword ) as N ( shifting times ) bits number, fills the leftmost locations
with the values shifted out of the right most locations such that for M bits string, the least
significant bit B0 of IN is rounded to image B(M-N) bit. The modified ( shifted and
rounded) version of the input bit string is stored in the output variable OUT. Figure 14
shows the ladder symbol and enhances the aforementioned explanation.
ROR
BOOL EN ENO BOOL
{ Byte, Word, IN { Byte, Word,
Dword, Lword} OUT Dword, Lword}
INT N
IN vale {2#10101010}
Bit IN OUT (N=1) OUT (N=2) OUT (N=3)
7 1 OUTB7=INB0=0 OUTB7=INB1=1 OUTB7=INB2=0
6 0 OUTB6=INB7=1 OUTB6=INB0=0 OUTB6=INB1=1
5 1 OUTB5=INB6=0 OUTB5=INB7=1 OUTB5=INB0=0
4 0 OUTB4=INB5=1 OUTB4=INB6=0 OUTB46=INB7=1
3 1 OUTB3=INB4=0 OUTB3=INB5=1 OUTB3=INB6=0
2 0 OUTB2=INB3=1 OUTB2=INB4=0 OUTB2=INB5=1
1 1 OUTB1=INB2=0 OUTB1=INB3=1 OUTB1=INB4=0
0 0 OUTB0=INB1=1 OUTB0=INB2=0 OUTB0=INB3=1
Figure 14: ROR ladder symbol and its behavior under different values of N
Example 7: Using ROR instruction, write ladder program to generate the following
repeated sequence [ 16,8,4,2,1].
Solution :
C1
_T#10s
CTR
P CD Q
Switches
S 5 PV
w
i
0 RST CV N
t
h
Start
e ROR
P EN ENO
s Switches
S 32 IN
w
i
N N OUT %QB0.0.
t 0
c
s
Figure 15: Ladder diagram of example 7
Rotate Left.
The rotate left instruction ( ROL) shifts the image of the input bit string IN ( Byte,
Word, Dword, Lword ) as N bits number, fills the rightmost locations with the values
shifted out of the left most locations such that for M bits string, the most significant bit BM-1
of IN is rounded to image BN-1 bit. The modified version of the input bit string is stored
in the output variable OUT. Figure 16 shows the ladder symbol and tabulates the left
rotation of %MB3 for different values of N.
IN vale=%MB3= {2#10101010}
Bit IN OUT (N=1) OUT (N=2) OUT (N=3)
7 1 OUTB7=INB6=0 OUTB7=INB5=1 OUTB7=INB4=0
6 0 OUTB6=INB5=1 OUTB6=INB4=0 OUTB6=INB3=1
5 1 OUTB5=INB4=0 OUTB5=INB3=1 OUTB5=INB2=0
4 0 OUTB4=INB3=1 OUTB4=INB2=0 OUTB46=INB1=1
3 1 OUTB3=INB2=0 OUTB3=INB1=1 OUTB3=INB0=0
2 0 OUTB2=INB1=1 OUTB2=INB0=0 OUTB2=INB7=1
1 1 OUTB1=INB0=0 OUTB1=INB7=1 OUTB1=INB6=0
0 0 OUTB0=INB7=1 OUTB0=INB6=0 OUTB0=INB5=1
Figure 16: ROL ladder symbol and its OUT value as function of N
Example 8: Using ROL instruction, write ladder program to generate the following
repeated sequence [ 1,2,4,8,16].
Solution
C1
_T#10s
CTU
P CU Q
Switches
S C1.Q R
w
i
5 PV CV N
t
h
Start
e ROL
P EN ENO
s Switches
S 1 IN
w
i
N N OUT %QB0.0.
t 0
c
The first-in-first-out (FIFO_XXXXX) is two gates controlled queue. Its inlet gate is
controlled by the input marked LOAD, its exit gate is controlled by the UNLD input. The
queue its self is an array of any type of data except the string one (XXXXX є{BOOL,
BYTE, WORD, DWORD, LWORD, SINT, INT,DINT,LINT,USINT,UINT,UDINT,ULINT,
REAL,LREAL,TIME,DATE,TOD, DT} . It has two flags and one pointer. The flags are the
empty flag (EMPTY) which rises 1 when the queue is free from any item and the full
flag (FULL) which declares there is no empty position in the queue ( the queue is full).
The pointer (PNT) points to the top of the queue, it ranges from 0 to the queue capacity.
The in and out traffic of items are controlled by the queue request input (REQ). New item
entering depends upon the states of the REQ, LOAD, the FULL, a new item is allowed to
enter only if REQ=1,LOAD=1,and Full =0. Pushing items out of the queue depends upon
UNLD and REQ states, UNLD should be "1" and also REQ should be "1". The function
block of this instruction is shown in figure 18.
FIFO_XXXXX
BOOL REQ DONE BOOL
{ Any type IN
except string } OUT { Any type
except string }
{ Array of any type
FIFO
except string }
Solution.
C1
OK_Move C1.Q
CTU
P
Switches Switches
CU Q
S Reset S R
w w
i
13 i PV ET
t t
c c
OK_Move C1.Q Get_Out
h h
P
Switches
e e
Switches Switches
OK_Move Get_In
Ss s
N
w
Switches Switches
Si FIFO_INT
wt BOOL
REQ DONE
ci
ht
X IN
ce
OUT
AofX FIFO
hs
e
Get_In LOAD PNT
s
Get_Out UNLD FULL
Figure 19:
Last IN First OUT.
The last-in-first-out (LIFO_XXXXX) is a stack in which the inlet and exit share the
same terminal ( opening) . The stack its self is an array of any type of data except the
string one (XXXXX є{BOOL, BYTE,WORD DWORD, LWORD, SINT,INT, DINT, LINT,
USINT,UINT,UDINT,ULINT, REAL,LREAL,TIME,DATE,TOD, DT} . Loading the stack
( entering new item) is done when the request is one ( REQ=1 ), the stack is not full
(FULL=0), and the load enable is active (LOAD=1). Unloading the stack( releasing the stack
top item) is ok when the request is one and the unload input is active (UNLD=1. The stack
instruction also includes an integer type pointer (PNT) to keep track of the top of the stack
( current position). The function block of this instruction is well illustrated in figure 20.
LIFO_XXXXX
BOOL REQ DONE BOOL
{ Any type IN
except string } OUT { Any type
except string }
{ Array of any type
except string } FIFO
Solution:
C1
Store
CTU
P CU Q
Switches
S Reset R
w
i
N +1 PV ET
t
c
Store C1.Q Get_In
h
P
Switch
e Switches Switches
Extract C1.Q Get_Out
Ss es
P
w
Switches Switches Switches
Si LIFO_WORD
wt BOOL
REQ DONE
ci
ht
X IN
ce
OUT
AofX FIFO
hs
e
Get_In LOAD PNT
s
Get_Out UNLD FULL
Comments
Comments are used to increase the readability of programs. They are used to mark the
beginnings and ends of program sections and also to give brief explanation to the program
instructions or parts they headed. Here we have the one line (//) comments and the multiline
or block comments {(* comments *)}.
Logical Statements
Logical statements consist of one or more logical operators (AND, OR, XOR, NOT) and
any same data type operands ( Bit, Byte, Word, Dword, Lword).
Example 1: Write ST program to develop 2-to-4 decoding circuit. Assume S1 and S0 are
the decoder inputs and Y3,Y2,Y1, and Y0 are the decoder outputs.
Solution: Y3:= S1 AND S0; Y2:= S1 AND NOT (S0); Y1:= NOT(S1) AND S0;
Y0:=NOT(S1) AND NOT( S0);
Example 4: Write program segment to invert memory bit %MW1.2 each scan if
%MW1.1 is true.
Solution:
X:=X XOR 2#0000000000000000000000000000001111000000000000000000000000000000; (*X is
LWORD bit type variable.*)
VCC +
Stop
McCoil Start
McCoil
VCC -
Solution:
(* Let the availability of national grid represented by the input %IX0.0.0 and has the label
NGOK. Also assign the label LGOK for the %IX0.0.1 to represents the availability state of
the local generator. For the changeover contactors, assign NG_C for %QX0.0.0 output bit
responsible to control the national grid interfacing power contactor and LG_C for
%QX0.0.1 for the contactor connecting the generator to the load.*)
VC +
LG -Line
NG -Line Start_Stop
LGOK
LG_C NG_C
NGOK NGOK
Solution:
Y:=Y1 OR Y2 OR Y3 OR Y4;
Example 10: Write the ST equivalent of JK flip-flop.
R_Trig(Clk:=dummy,q=>Flip);
Q:=Flip XOR Q;
Arithmetic Statements
Arithmetic statements also consist of one or more arithmetic operators and any same
num-type operands. The operators involved here are the addition (+), the subtraction (-), the
multiplication (*), the division (/),the remainder (MOD), and the exponential (**). All these
types allow any numerical data type except the exponential one is restricted to real data ones.
Example 11: Write the ST text that generates the Triangular membership function
drawn in figure10.3. μ(x)
0.5
x
a b c
Example 12, Write the ST text that generates the bell-shaped membership function
drawn in figure10.4. μ(x)
0.5
x
a b c
Figure 4: Bell-shaped membership function
U_x:=1/(1+(ABS((x-b)/a))**(2*c )// a,b,c are real type variables.
Example 13, Write the ST text that generates the sigmoid-right membership function
drawn in figure10.5.
μ(x)
0.5
x
c
Figure 5: Sigmoid-right membership function
Solution:
Example 14, Write the ST text that generates the sigmoid-left membership function
drawn in figure6.
1
0.5
x
c
Solution:
Example 10.15, Write the ST text that solves the equation of the definite minimum
inverse time over current relay.
Solution:
Solution :
END_IF;
END_IF;
Example 17, Write the ST text to test two integer type variables X and Y and assign the
value of the smallest one to Z;
Solution:
IF X<=Y THEN
Z:=X;
ELSE
Z:=Y;
END_IF:
Example 18, Write the ST text to obtain the membership function sketched in figure10.8
Solution:
μ(x)
IF X<=a THEN 1
Y:=0;
0.5
ELSIF X>=b THEN
Y:=1; x
a b
ELSE
Figure 8: S-like membership function
Y:=(X-a)/(b-a);
END_IF;
Example 19, Write the ST text to obtain the membership function sketched in figure9.
Solution: μ(x)
IF X>=a THEN 1
Y:=0; 0.5
ELSIF X<=b THEN
x
b a 0
Y:=1;
Figure 9: Z-like membership function
ELSE
Y:=(X-a)/(b-a);
END_IF;
CASE Conditional Statements
CASE is used to execute one out of many statements. The selected statement is that one
whose line starts with the current value of the integer type expression following the
reserved word "CASE". The two possible basic structures of this selection facility are
pictured in figure 10.
Example 20, Propose ST program to implement the block diagram shown in figure 11.
I0
I1
OR Q0
Switches
XOR
Swi
Switches
tch
es
I2 I3
CASE V OF
END_CASE;
Example 21, Propose ST program to output the content of the selected location in
table 1 into %QW0.0.0.
END_CASE;
FOR Statements
FOR is used to do predetermined repetition times . It takes the general form shown in
figure 12. The instruction integer data type counter has three control parameters, the start,
the end, and the increment .
Statement 1;
Statement n;
END_FOR;
Example 22, Write PLC program to sort the contents of the array Y whose elements
are stored in memory location %MW10 to %MW15 in an ascend manner;
Solution:
FOR I:= 0 TO 5 DO
FOR J:= I +1 TO 5 DO
Dummy:=Y[I];
Y[I]:=Y[J];
Y[J]:=Dummy;
END_IF;
END_FOR;
END_FOR;
Example 23, Write PLC program to sort the contents of the array Y whose elements
are stored in memory location %MW10 to %MW15 in a descendent manner;
Solution:
FOR I:= 0 TO 5 DO
FOR J:= I +1 TO 5 DO
Dummy:=Y[I];
Y[I]:=Y[J];
Y[J]:=Dummy;
END_IF;
END_FOR;
END_FOR;
WHILE Statements
WHILE is used to do repetition with unknown number of times . Here the continuity
of repetition depends upon the logical result of the expression comes immediately after the
WHILE word. That means it first examines the continuity flag and then decides to inter the
loop or goes out of it to allow the next statement to be executed. The syntax of this
statement is :
Statement 1;
Statement n;
END_WHILE;
Example 24, Write PLC program to search the contents of the array Y seeking a
given number. Assume Y to be one dimensional array of length equals 6;
Solution:
Location:=6; // the assigned value should be any number greater than Y length.
WHILE J<=5 DO
J:=J + 1;
END_WHILE;
REPEAT Statements
REPEAT is used to do repetition with unknown number of times . Here the continuity
of repetition depends upon the logical result of the expression comes immediately after the
UNTIL word. That means it first executes the loop and then decides to repeat the loop or
goes out of it to allow the next statement to be executed. With this statement. the
loop is executed at least once because the continuity flag is examined at the end of the loop.
The syntax of this statement is :
REPEAT
Statement 1;
Statement n;
END_REPEAT;
Example 25, Using Newton's method, find the root of the equation 𝑥 3 − 𝑥 − 1 = 0
Solution:
REPEAT
FX:=Xn**3- Xn -1;
Xn_1:=Xn;
UNTIL (ABS(FX)<=0.0000001)
END_REPEAT;
Human Machine Interface (HMI)
The touch panels which are also called human-machine interfaces (HMI) are
programmable devices permit the human operators to communicate with the industrial
control systems like for example the programmable logic controller (PLC), the variable
frequency drive (VFD) and the servo driver. There are large number of touch panel
manufacturers and each series of panels have their own programming software . As an
examples, XP_50TTA is LSIS product and is programmed using XP_BUILDER,
DOP_B10E615 is Delta one programmed by SCREEN_EDITOR, KTP_400 is Siemens
brand and is programmed by SIMATIC WINCC. In fact all the brands and supported
programming software shot the same birds, they provide the human operator with the
abilities to monitor the critical process variables in the way they prefer, input commands to
select the suitable control algorithm, direct the maintenance technicians to fault source (s) ,
give pictorial representation to the process under control, allow different languages
speakers to deal with the machinery, etc. Specifically one can say the programmed HMIs
have the ability to monitor and/or modify the controllers memory contents ( Input-
image register, output-image register, memory-registers) as bit, byte, word, dword, real,
and also as group of any of these types and also have the theme related display techniques.
Also here one must not forget that HMIs can be programmed with high level like
languages ( C, Basic) to implement their own tasks.
Here LSIS brand will be used to introduce the role of the HMI panels in the
industrial process control and the commonly used software programming components.
As stated before the HMI communicates with the programmable controller to read or
modifies their memory locations. The HMI itself deals with the operator through a number of
screens or pages on which the software graphical components or interfaces are positioned.
Some of these components act as a mirror to display what are going inside the
programmable controller and others as loaders responsible to load or modify the memory
locations with the desired values. The following are the most commonly used items or
components in this context.
1- Bit Switch
Bit switch is used to control the ON/OFF of the relevant PLC bit address. It can be
assigned any shape from the programming environment library or new created shapes.
It may be found in one of four modes. These are:
1- ON mode: Pressing the bit switch under this mode sets the PLC relevant bit on and
preserves the on state whether the switch is still pressed or not.
2- OFF mode : Pressing the bit switch with this mode resets the PLC relevant bit previously
set by a bit switch of on mode. The state is preserved whether the switch is still pressed or
not.
3- Momentary mode: Here the bit switch behaves as if it were normally open pushbutton. As
long as the switch is pressed the PLC relevant bit is on. The time the switch is released the
PLC bit return to its normal value.
4- Alternative mode: In this mode of operation, each time the bit switch is pressed the PLC
relevant bit is inverted that means if it was on before the pressing, after the pressing it
becomes off and if it was off it becomes on.
Example 1 , Design HMI interface screen to enable the operator to : (1): Control the
on/off state of a lamp using one bit switch. (2): To start/stop motor starter using two
pushbutton like approach. (3): To set/reset PLC memory bit %MW2.0 which controls
coil Y. Also attach the relevant PLC ladder program.
Solution:
MCCoil
%MW2.0 Y
(b)
(a)
Figure 1: a): Interface HMI page. b): PLC ladder diagram. c): Bit switches modes and
their PLC relevant
2- Bit Lamp
Bit lamp is used to display the ON/OFF state of the relevant PLC bit address. Its default
shape is lamp shape, but it can be assigned any shape from the programming environment
library or new created shapes.
Example 2 , Design HMI interface screen to enable the operator to on/off and monitor
star/delta starter. Also attach the relevant PLC ladder program.
Solution:
OFF ON Main
Main
Main T1
TON
IN Q
T#6S PT ET
(b)
Bit Device Type Mode Address
OFF Bit switch Momentary %MW1.0
ON Bit switch Momentary %MW1.1
Main Bit lamp %QX0.0.0
Star Bit lamp %QX0.0.1
Delta Bit lamp %QX0.0.2
Figure 2: a): Interface HMI page. b): PLC ladder diagram. c): Bit devices characteristics
3- Word Switch
Word switch is used to modifies the content of 16bit or 32 bit size PLC memory address.
As 16bit switch it can support Signed and Unsigned DEC PLC data types, and as 32bit size
supports Signed DEC, Unsigned DEC, and Float PLC data types. It can take any shape from
the programming environment shape's libraries or assigned new shape according to the
designer understanding. The operation margin of this switch extends to four mode of
operations. These are :
1- Set mode: Pressing the word switch under this configuration writes the direct or
indirect set value in the PLC relevant address. With direct set value ( constant) it
preserves that value whether the switch is still pressed or not. With indirect one ( content of
another device) the relevant PLC address receives that of the another at the pressing
instance.
Example 3 , In ice cream filling machine, the quantity of drawn ice cream depends upon
the time interval the outlet solenoid valve is activated. Assume there are three cone sizes,
Design PLC ladder program and HMI interface screen to enable the operator to select the
proper filling utility.
Solution:
TPFILL
Fill %QX0.0.0
TP_UNIT
Switches
P IN Q
Switches
Switches
%MW4 Swit
PT ET
Swit
ches ches
Switche Swit Swit
100 UNIT
s ches ches
Switche Switch
0 RST
s es
S Swit
w ches (b)
i
(a) t
Family Word Switch 400 %MW4 Under family size cone Transparent
Size
Medium Word Switch 200 %MW4 Under medium size cone Transparent
Size
Small Word Switch 100 %MW4 Under small size cone Transparent
Size
Fill Momentary Bit Switch %MW1.0 Under each cone Transparent
(c)
2- ADD mode: Pressing the word switch add the direct or indirect set value to the PLC
relevant address. With direct set value, each time the switch is pressed, the relevant PLC
address's value is increased by constant increment whereas with indirect one the increase
amount is function of the indirect address value at the pressing time.
3- SUB mode: Pressing the word switch subtract the direct or indirect set value from
the PLC relevant address. With direct set value, each time the switch is pressed, the
relevant PLC address's value is decreased by constant decrement whereas with
indirect one the decrement amount is function of the indirect address value at the
pressing time.
Example 4 , In plastic bottle blowing machinery, the bottle shape depends upon three
heaters running along the bottle route to the mold. These heaters are the upper, middle,
and lower heaters. Suggest an HMI screen to allow the user to fine and coarse controls these
heaters to force the ampoules to take the mold shape. Assume the heaters to be driven
by digital to analog module with four channels (channel’s input words are :
%UW0.1.3, %UW0.1.4, %UW0.1.5, %UW0.1.6).
Solution:
4- Digit ADD: Pressing the word switch increments the PLC relevant address value. The
Upper Heater Middle Heater Lower Heater
Word Set PLC Mode Set PLC Mode Set Value PLC
Switch Mode Value Address value Address Address
increment amount is function of the selected number system (HEX or BCD) and the
position of the digit to be incremented by 1. For example selecting BCD as the number
system and 2 as the digit position, each press increments the tenth position by one until
reaching 9 after which the tenth position returns to zero and new increment cycle start again.
Example 5 , Design HMI page such that the operator can set the PLC memory word
%MW4 in thumb wheel like manner.
Solution:
5- Digit SUB: Pressing the word switch decrements the PLC relevant address value. The
decrement amount is function of the selected number system (HEX or BCD) and the
position of the digit to be decremented by 1. For example selecting BCD as the number
system and 3 as the digit position, each press decrements the hundredths position by 1 until
reaching 0 after which the hundredths position returns to 9 and new decrement cycle start
again.
Example 6 , Design HMI page such that the operator can set the PLC memory word
%MW4 in thumb wheel like decreasing manner .
Solution:
Device Type Operation Mode Set Address
Value
Numeric 16 bit, BCD %MW4
display
Word Switch Digit ADD 4 %MW4
Example 7 , Give HMI utility that inverts the state of %MW1.0 each time the word
switch %HW4 is pressed;
Solution:
@[X:%MW0.0]=!@[X:%MW0.0];
Error:
4- Numeric Input
This device is used to modify and display the PLC related word or double Word.
For 16 bit size word the supported numeric formats are the unsigned DEC, signed DEC,
Octal, Hex, Bin, and BCD . For 32 bit size, the float data type is added to the previous list.
This numeric device allows the designer to modify the relevant PLC word with the scaled
version of what is entered in this device in addition to keep the entered value between the
selected minimum and maximum limits if scaling check box is marked. Masking the input
data is possible if the cipher check box is selected. Here and only
for 32 bit size word, one must understand that memory word k (%MWk) refers to the
PLC's memory double k/2 (%MD(k/2) k is positive even integer).
Example 8 , Propose HMI screen to allow the operator to modify any item of 4*4 real
data type matrix. Assume the PLC name of this matrix is Y, its start address is %MD0, the
rth raw index address is MW40, and the cth column index address is %MW41 ( MW40 and
MW41 are both of 16bit size.
Solution:
HMI Screen HMI Devices Address Map
// ST instruction
%MD1 %MD2 %MD3 %MD4
// r is integer type data with address %MW40
%MD5 %MD6 %MD7 %MD8
// c is integer type data with address %MW41
%MD9 %MD10 %MD11 %MD12
// Z is real type data with address %MD17
%MD13 %MD14 %MD15 %MD16
Z:= Y[r,c];
5- Numeric Display
This device is used to display the PLC related word or double Word according to
the required format. For 16bit size word the supported numeric formats are the unsigned
DEC, signed DEC, Octal, Hex, Bin, and BCD . For 32 bit size, the float data type is added
to the previous list. It also provides scaling facility so that the PLC related address content
can be transformed to the value the end user can well understand or in other words to
emulate the real environment.
Example 9 , Design HMI utility that displays the binary, octal, and hex equivalent of
unsigned decimal number.
Solution:
15 1111 17 F
6- Graph meter
The graph meter display device displays the value of PLC relevant word or double word
numeric data in term of the position of clock like hand moving clockwise or counter clock
wise inside one of circle, top-half circle, bottom-half circle, left-half circle, right-half circle,
top-fan, bottom-fan, left-fan, right-fan, or 3/4 fan shapes. The pointer swings between upper
and lower limits fixed during the design phase of this device. This device deals with word
and double word data types. For word (16bit size), the supported numeric formats are
the unsigned DEC, signed DEC, and BCD . For double word ( 32 bit size), unsigned
DEC, signed DEC, BCD, and float data type are supported.
Example 10 , Design clock page with three hands ( second hand, minute hand, hour
hands).
Solution: