0% found this document useful (1 vote)
71 views50 pages

Microcontroller Technology

The document discusses microcontroller technology, providing an introduction and overview. It describes what a microcontroller is and some of its core components. It also outlines several ways microcontrollers can be classified and lists some common applications that use microcontrollers.

Uploaded by

michaeldili247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
71 views50 pages

Microcontroller Technology

The document discusses microcontroller technology, providing an introduction and overview. It describes what a microcontroller is and some of its core components. It also outlines several ways microcontrollers can be classified and lists some common applications that use microcontrollers.

Uploaded by

michaeldili247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

MICROCONTROLLER TECHNOLOGY

INTRODUCTION TO MICROCONTROLLERS
Microcontrollers
A microcontroller (μC or uC) is a solitary chip microcomputer fabricated from VLSI fabrication.
The microcontroller IC contains the CPU, Memory (Program Memory and Data Memory), I/O
Ports (Input / Output Ports) and few other components integrated on a single chip.
The microcontroller technology enables the integration of a number of useful functions into a
single IC package. These functions are:
 The ability to execute a stored set of instructions to carry out user defined tasks.
 The ability to access external memory chips to both read and write data from and to the
memory.
Microcontrollers are designed to perform the specific tasks of embedded systems, in applications
that need a degree of control to be applied by the user of the system
If a device or an application involves measuring, storing, calculating, controlling or displaying
information, then device contains a Microcontroller in it.
Some of the areas where microcontrollers are used include:
 Home appliances eg Microwave Ovens, home theatre equipment,
 Office machines eg Photocopiers, printers,
 Industry in Industrial Automation, safety systems, robots
 On roads and Cars, Traffic Signals, Vehicle AC systems, Automatic braking systems etc.
 Buildings e.g elevators, security doors, etc

The differences between a Microcontroller and a Microprocessors


1. A microprocessor is used in computers performing a variety of tasks, while a Micro
Controller is used in embedded systems performing specific tasks.
2. A microprocessor doesn’t consist of RAM, ROM, I/O ports, timers, interrupts on the
microprocessors chip, while a microcontroller has all these integrated on the
microcontroller chip.
3. Microprocessor instruction sets cater to large volumes of data ie they have a higher
processing poer, while Microcontrollers have instruction sets catering to the control of
inputs and outputs, i.e. have a lower processing power

1
4. Microprocessor Systems can become bulky and expensive, while Microcontrollers Make
the system simple, economic and compact.
5. Microprocessor designing and hardware cost is high, while microcontroller designing nad
hardware cost is low.
Advantages of Microcontrollers
 Integration of all the essential components reduces the cost, design time, and area of the
product (or application).
 Usage of microcontroller is simple and easy for troubleshooting and system maintaining.
 Most of the pins are programmable by the user for performing different functions.
 Easily interface additional RAM, ROM, I/O ports.
 Low time required for performing operations.

Disadvantages of Microcontrollers
 Microcontrollers have got more complex architecture than that of microprocessors.
 Only perform limited number of executions simultaneously.
 Mostly used in micro-equipment.
 Cannot interface high power devices directly

Classification of Microcontrollers
Microcontrollers can be classified on the basis of internal bus width, architecture, memory, and
instruction set.

1. Classification based on the Internal Bus Width


(a) The 8-Bit Microcontroller
This is a microcontroller that has an ALU that performs arithmetic and
logical operations on a byte (8-bits) at an instruction. The internal bus width
of 8-bit microcontroller is of 8-bit.
2
Examples of 8-bit microcontrollers are Intel 8051 family and Motorola
MC68HC11 family.

(b) The 16-Bit Microcontroller

This is a microcontroller that has an ALU that performs arithmetic and


logical operations on a word (16-bits) at an instruction. The internal bus
width of 16-bit microcontroller is of 16-bit.

Examples of 16-bit microcontrollers are Intel 8096 family and Motorola


MC68HC12 and MC68332 families.

The performance and computing capability of 16 bit microcontrollers are


enhanced with greater precision as compared to the 8-bit microcontrollers.

(c) The 32-Bit Microcontroller


This is a microcontroller that has an ALU that performs arithmetic and
logical operations on a double word (32- bits) at an instruction. The internal
bus width of 32-bit microcontroller is of 32-bit.

Examples of 32-bit microcontrollers are Intel 80960 family and Motorola


M683xx and Intel/Atmel 251 family.

The performance and computing capability of 32 bit microcontrollers are


enhanced with greater precision as compared to the 16-bit microcontrollers.
The 8-bit is the slowest of the three types.

2. Classification Based on Memory Devices


(a) Embedded Memory Microcontrollers
These are microcontrollers that have all the functional blocks, including
program as well as data memory, available on a chip.

For example, 8051 having Program & Data Memory, I/O Ports, Serial
Communication, Counters and Timers and Interrupt Control logic on the
chip is an embedded microcontroller.

(b) External Memory Microcontrollers


These are microcontrollers in which all, or part of the memory units are
externally interfaced using an interfacing circuit called the glue circuit.

For example, 8031 which has no program memory on the chip is an external
memory microcontroller

3
3. Classification Based on Memory Architecture
(a) Von-Neumann/ Princeton Architecture
Microcontrollers based on the Von-Neumann architecture have a common
memory address for the program memory and data memory, and a single
bus that is used to fetch both instructions and data.

When such a controller addresses main memory, it first fetches an


instruction, and then it fetches the data to support the instruction. The two
separate fetches slow down the controller’s operation.

The Von-Neuman architecture’s main advantage is that it simplifies the


microcontroller design because only one memory is accessed. The Motorola
68HC11 microcontroller is Von-Neuman architecture.
(b) Harvard Architecture
Microcontrollers based on the Harvard architecture have separate memory
addresses for the program memory and data memory, and separate bus for
instructions and a bus for data. This allows execution to occur in parallel.

The Harvard Architecture executes instructions in fewer instruction cycles


than the Von-Neumann architecture.
For example, the Intel MCS-51 family of microcontrollers and PIC
microcontrollers uses Harvard Architecture.

4
4. Classification Based on Instruction set Architecture
(a) Complex Instruction Set Computer (CISC) Microcontrollers
A CISC is a computer where single instructions can perform numerous low-
level operations like all evaluating, loading, and storing operations,
CISC allows the programmer to use one instruction in place of many
simpler instructions. Thus, it is associated with such microcontroller
hardware that can deal with the execution of various serially linked
operations using a specific instruction.
It puts the whole emphasis on the way to lessen the total instructions per
program. The main idea is that a single instruction will do all loading,
evaluating, and storing operations just like a multiplication command will
do loading data, evaluating, and storing it, hence it’s complex.
The advantages of the CISC architecture are that many of the instructions
are macro-like, allowing the programmer to use one instruction in place of
many simpler instructions.
An example of CISC architecture microcontroller is Intel 8096 family.
(b) Reduced Instruction Set Computer (RISC) Microcontrollers
RISC offers the execution of computing tasks with multiple simple
instructions. The main idea behind RISC is to make hardware simpler by
using an instruction set composed of a few basic steps for loading,
evaluating, and storing operations, just like a load command will load data,
a store command will store the data.
Both approaches try to increase the CPU performance
 RISC: Reduce the cycles per instruction at the cost of the number of
instructions per program.
 CISC: The CISC approach attempts to minimize the number of
instructions per program but at the cost of an increase in the number of
cycles per instruction.

Elements of Microcontroller Architecture


The basic structure and block diagram of a microcontroller is shown in the figure below:

5
The microcontroller chip typically includes:
1. CPU (Central Processing Unit)
The CPU is the brain of a microcontroller and it administers all the activities of the system,
connecting every part of a microcontroller into a single system.

The CPU is responsible for fetching instructions, decoding, and executing them.

The CPU contains the following:

(a) Registers are a little like internal memory storage areas. These are useful for storing
interim calculation results as this reduces the number of reads/writes to external
memory which is usually slower. Some registers have special functions such
keeping track of where the next instruction is supposed to come from in memory.

(b) The Arithmetic Logic Unit is responsible for carrying out calculations. In some
CPU's this can be quite simple; perhaps only supporting add, subtract and basic
logical operations.

(c) Control Unit coordinates and times the CPU’s functions, and it uses the program
counter to locate and retrieve the next instruction from memory. Another purpose
of control unit is, controlling the data flow between the CPU and peripheral
devices/peripheral chips.

6
2. Memory
The function of memory in a microcontroller is to store data and program. A
microcontroller usually has a certain amount of RAM and ROM (EEPROM, EPROM, etc)
or flash memories for storing program source codes.
In general, there are two types of memory:
(a) Program memory: is used to hold the application program. In most microcomputer
applications the program memory is a Read Only Memory (ROM).

(b) Data memory is used for the dynamic data which is generated by the application
program and for the stack. The stack is a portion of memory where the CPU saves
its own internal register data for calling a subroutine. Stack is a part of RAM used
for storing the current state of the program counter (address) when an interrupt
occurs

3. Input/output (I/O) ports


Microcontrollers send and receive information to the various parts of the system, using
ports. There are two main types of port namely, parallel and serial.

4. Timers/counters
A microcontroller may have more than one timer and counter. The timers and counters
provide all timing and counting functions inside the microcontroller.

The major operations of this section are to perform clock functions, modulations, pulse
generations, frequency measuring, making oscillations, counting external pulses, trigger
interrupts after a certain number of clock cycles, etc.

5. Analog to Digital Converter (ADC)


ADC converters are used for converting the analog signal to digital form. This device
accepts an analogue input and translates this to a digital number whose size is proportional
to the magnitude of the analogue signal. Each Analogue to Digital Converter has an
associated input voltage range and an output numeric range.

6. Digital to Analog Converter (DAC)


DAC perform reversal operation of ADC conversion. DAC converts the digital signal into
analog format. It is usually used for controlling analog devices like DC motors, various
drives, etc.

7. Interrupt control
The interrupt control used for providing interrupt (delay) for a working program. interrupts
are signals that cause the CPU to suspend its current activity and perform some other task.

7
The interrupt may be external, activated by using interrupt pin, or internal, by using
interrupt instruction during programming.

The main difference between internal and external interrupts is that the internal interrupt is
synchronous, initiated by some exceptional condition caused by the program itself rather
than by an external event, while external interrupts are asynchronous, coming from input-
output devices through the interrupt pins, depending on external conditions that are
independent of the program being executed at the time.

8. Special functioning block


This is found in some microcontrollers used for some special applications (e.g. space
systems and robotics). These controllers contain additional ports to perform such special
operations, considered as special functioning block.

Microcontroller Series/ Families


Microcontroller series/families are classification of microcontrollers manufactured by various
companies, based on instruction set, or pinout, or a variety of other parameters.
The members of a family/series are a collection of microcontrollers that have similar instruction
sets, but the differences between the individual microcontrollers are essentially performance.
The microcontroller series are as listed below:
1. Intel 8048 microcontroller Series
The 8048 microcontroller, also called MCS-48, was originally released by Intel in 1976. It
was manufactured into the 1990s to support older designs that still used it.

The 8048 series has a modified Harvard architecture, with internal or external
program ROM and 64–256 bytes of internal (on-chip) RAM. The I/O is mapped into its
own address space, separate from programs and data.

Though the 8048 series was eventually replaced by the very successful 8051 series, it
remained quite popular even by the year 2000 due to its low cost, wide availability,
memory-efficient one-byte instruction set, and mature development tools. Because of this,
it is used in high-volume, cost-sensitive consumer electronics devices such as TV remotes,
computer keyboards, and toys.

2. Intel 8051 Microcontroller Series


The 8051 microcontroller is an 8-bit microcontroller designed by Intel in 1981.

It is built with 40 pins DIP (dual inline package), 4kb of ROM storage and 128 bytes of
RAM storage, 2 16-bit timers. It consists of are four parallel 8-bit ports, which are
programmable as well as addressable as per the requirement. An on-chip crystal oscillator

8
is integrated in the microcontroller having crystal frequency of 12 MHz. It is possible to
add two external memory chips with capacity of 64Kb each

The 8051 became widely popular after intel allowed other manufacturers to make and
market any variants of the 8051 they please, with the condition that they remain code
compatible with the 8051. This has led to many versions of the 8051 with different speeds
and amounts of on-chip ROM marketed by more than half a dozen manufacturers.
Though there are different versions of the 8051 in terms of speed and amount of on-chip
ROM, they are all compatible with the original 8051 as far as the instructions are
concerned. This means that a program written for one, will run on any of them regardless
of the manufacturer.

Summary of the Features of the 8051


Feature Quantity
ROM (on-chip) 4 K bytes
RAM (on-chip) 128 bytes
Timer 2
I/O pins 32
Serial port 1
Interrupt sources 6
External memory capacity 2 chips of 64 kB each

Intel no longer manufactures the 8051 microcontroller family however, variants of the 8051
from numerous manufacturers remain popular today eg, the Atmel Corp. has a wide
selection of 8051 chips such as the AT89C51, the AT89C52, and the AT89LV2 among
others.
8051 Microcontroller Family Members
There are two other members of the 8051 family of microcontrollers by Intel. They are the
8052 and the 8031.
(a) The 8052 Microcontroller
The 8052 has all the standard features of the 8051 as well as an extra 128 bytes of
RAM and an extra timer. It also has 8k bytes of on-chip program ROM instead of
4k bytes.
(b) The 8031 Microcontroller
This chip is often referred to as a ROM-less 8051 since it has 0 k bytes of on-chip
ROM. To use this chip, you must add an external ROM to it, which must contain
the program that the 8031 will fetch and execute.
Comparison of 8051 family members

9
Feature 8051 8052 8031
ROM (on-chip program space in bytes) 4 K 8K 0
RAM (in bytes) 128 256 128
Timers 2 3 2
I/O ports 32 32 32
Serial ports 1 1 1
Interrupt sources 6 8 6

Architecture and Programing of the Intel 8051 Microcontroller


The intel 8051 microcontroller block diagram and pin assignment

Intel 8051 Pin descriptions


 Pin 9 (RST) − It is a RESET pin, which is used to reset the microcontroller to its initial
values. A logic one on pin 9 disables the microcontroller and clears the contents of
registers. A logic zero to pin 9 the program starts execution from the beginning
In other words, a positive voltage pulse on this pin resets the microcontroller. Upon
applying a high pulse to this pin, the microcontroller will reset and terminate all activities.

10
This is often referred to as a power-on reset. Activating a power-on reset will cause all
values in the registers to be lost. It will set program counter to all 0s.
 Pins 18 & 19 (XTAL2 & XTAL1) − These pins are used for interfacing an external crystal
to get the system clock.
The 8051 has an on-chip oscillator but requires an external clock to run it. Most often a
quartz crystal oscillator is connected to inputs XTALI (pin 19) and XTAL2 (pin 18)
 Pin 20 (GND) − This is the ground terminal.
 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used to read a
signal from the external program memory.
 Pin 30 − This is ALE pin which stands for Address Latch Enable. It is used to demultiplex
the address-data signal of port.
 Pin 31 − This is EA pin which stands for External Access input. It is used to enable/disable
the external memory interfacing.
 Pin 40 − This pin is used to provide power supply to the circuit.
Intel 8051 Input/ Output Ports (I/O Ports)
Intel 8051 microcontrollers have 4 I/O ports each using 8 pins, making them 8-bit ports, which can
be configured as inputs or outputs. In total of 32 input/output pins enabling the microcontroller to
be connected to peripheral devices are available for use.
The following is a summary of features of PO - P3.
 Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port.
In 8051-based systems with external memory connections, Port 0 also serves the additional
function of multiplexing both address and data signals.
P0 is configured as address output (A0-A7) when the ALE pin is driven high (1) or as data
output (Data Bus) when the ALE pin is driven low (0).
 Pins 1 to 8 − These pins are known as Port 1. Each of these pins can be configured as an
input or an output, so that Port 1 functions as an 8-bit input/output port.
P1 is a true I/O port, because it doesn't have any alternative functions as is the case with
P0, but can be configured as general I/O only.
 Pins 21 to 28 − These pins are known as Port 2. It serves as an I/O port.
In 8051-based systems with external memory connections Port 2 also serves the additional
function of being used along with P0, to provide the l6-bit address for the external memory.
Since an 8051 is capable of accessing 64K bytes of external memory, it needs a path for
the 16 bits of the address. While P0 provides the lower 8 bits via A0 - A7, it is the job of

11
P2 to provide bits A8 - A I6 of the address. In other words, when the 8051 is connected to
external memory, P2 is used for the upper 8 bits of the 16-bit address, and it cannot be used
for 1/O.
As shown in Figure (b), port 2 is also designated as A8 - A 15, indicating its dual function.
 Pins 10 to 17 − These pins are known as Port 3. Similar to port 1, it can be used as input
or output.
Port 3 also has some additional functions of providing important signals such as interrupts,
timer input, control signals, serial communication signals etc.
The additional functions of Port 3 are carried out by pins 10 to 17 as outlined below:
o Pin 10 (RXD): Serial asynchronous communication input or Serial synchronous
communication output.
o Pin 11 (TXD): Serial asynchronous communication output or Serial synchronous
communication clock output.
o Pin 12 (INT0): Interrupt 0 input
o Pin 13 (INT1): Interrupt 1 input
o Pin 14 (T0): Counter 0 clock input
o Pin 15 (T1): Counter 1 clock input
o Pin 16 (WR): Signal for writing to external (additional) RAM
o Pin 17 (RD): Signal for reading from external RAM

Intel 8051 Interrupts


The 8051 microcontroller can recognize five different events that cause the main program to
interrupt from the normal execution. These five sources of interrupts in 8051are:
1. Timer 0 interrupt- TF0
2. Timer 1 interrupt- TF1
3. Interrupt 0- INT0
4. Interrupt 1- INT1
5. Serial interrupt- RI/TI
The Timer and Serial interrupts are internally generated by the microcontroller, whereas Interrupts
0 and 1 are generated by additional interfacing devices or switches, that are externally connected
to the microcontroller.
When an interrupt occurs, the microcontroller executes the interrupt service routine so that
memory location corresponds to the interrupt that enables it.
The Interrupt corresponding to the memory location is given in the interrupt vector table below:

12
The main difference between internal and external interrupts is that the internal interrupt is
synchronous, initiated by some exceptional condition caused by the program itself rather than by
an external event, while external interrupts are asynchronous, coming from input-output devices
through the interrupt pins, depending on external conditions that are independent of the program
being executed at the time.

Intel 8051 Memory Organization


Intel 8051 has two types of memory:
(i) Program Memory (ROM): Used to permanently save the program being executed.
(j) Data Memory (RAM): Used for temporarily storing data and intermediate results created
and used during the operation of the microcontroller.
Intel 8051 RAM Memory Space Allocation
The 128 bytes of RAM inside the 8051 are assigned the address 00 to 7FH. They can be accessed
directly as memory locations and are divided into three different groups as follows:
 32 bytes from 00H to 1FH locations are set aside for register banks and the stack.
 16 bytes from 20H to 2FH locations are set aside for bit-addressable read/write memory.
 80 bytes from 30H to 7FH locations are used for read and write storage; it is called
as scratch pad. These 80 locations RAM are widely used for the purpose of storing data
and parameters by 8051 programmers.

13
Intel 8051 Register Banks
A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are
divided into four register banks in which each bank has 8 registers, R0–R7. RAM locations from
0 to 7 are set aside for bank 0 of R0–R7 where R0 is RAM location 0, R1 is RAM location 1, R2
is location 2, and so on, until the memory location 7, which belongs to R7 of bank 0.
The second bank of registers R0–R7 starts at RAM location 08 and goes to locations OFH. The
third bank of R0–R7 starts at memory location 10H and goes to location to 17H. Finally, RAM
locations 18H to 1FH are set aside for the fourth bank of R0–R7.

 Register Bank 0. Address range (00H to 07H)


14
 Register Bank 1. Address range (08H to 0FH)
 Register Bank 2. Address range (10H to 17H)
 Register Bank 3. Address range (18H to 1FH)

Intel 8051 Memory expansion


It is possible to add two external memory chips with capacity of 64Kb each. P2 and P3 I/O ports
are used for their addressing and data transmission. The first one is used for reading data from
external data memory (RAM) while the other is used for reading data from external program
memory (ROM).

Intel 8051 Registers


Registers are used in the CPU to store information on temporary basis which could be data to be
processed, or an address pointing to the data which is to be fetched
Registers are the main part of microcontrollers, that provide a fast way to collect and store data. If
we want to manipulate data with a microcontroller by performing addition, subtraction, and so on,
we cannot do that directly in the memory, but it needs registers to process and store the data.
The most widely used registers of the 8051 are A (accumulator), B, R0-R7, DPTR (Data Pointer
Register), and PC (Program Counter). All these registers are of 8-bits, except DPTR and PC which
are 16-bits.
1. Register A/ Accumulator
The accumulator/ register A, is also known as ACC.
If the accumulator is not present, then every result of each calculation (addition,
multiplication, shift, etc.) is to be stored into the main memory. Access to main memory is
slower than access to a register, like the accumulator, because the technology used for the
large main memory is slower (but cheaper) than that used for a register.

Functions:
 Used to hold the results of all arithmetic and logic operations
 The accumulator is also used in data moving, as data to be moved from one register
to another must go through the accumulator.

2. The "B" Register


Functions:
 The major purpose of this register is in executing multiplication and division.
 Used as yet another temporary storage register, much like a ninth R register.

The 8051 micro controller has a single instruction for multiplication (MUL) and
division (DIV). To quickly and easily multiply or divide “A” by another number, you
may store the other number in "B" and make use of these two instructions (MUL and

15
DIV). Multiplication and division can be performed only upon numbers stored in A and
B registers.

3. The "R" Registers


The "R" registers are a set of eight registers, namely, R0, R1 to R7.

Function:
 These registers function as auxiliary or temporary storage registers in many
operations.

Consider an example of the sum of 10 and 20. Store a variable 10 in an accumulator and
another variable 20 in, say, register R4. To process the addition operation, execute the
following command:

ADD A, R4

After executing this instruction, the accumulator will contain the value 30. Thus "R"
registers are very important auxiliary or helper registers. The Accumulator alone would
not be very useful if it were not for these "R" registers. The "R" registers are meant for
temporarily storage of values.

Let us take another example. We will add the values in R1 and R2 together and then
subtract the values of R3 and R4 from the result.

MOV A, R3 ; Move the value of R3 into the accumulator


ADD A, R4 ; Add the value of R4
MOV R5, A ; Store the resulting value temporarily in
R5
MOV A, R1 ; Move the value of R1 into the accumulator
ADD A, R2 ; Add the value of R2
SUBB A, R5 ;Subtract the value of R5 (which now
contains R3 + R4)

As you can see, we used R5 to temporarily hold the sum of R3 and R4. Of course, this is
not the most efficient way to calculate (R1 + R2) – (R3 + R4), but it does illustrate the use
of the "R" registers as a way to store values temporarily.

4. The Data Pointer Register (DPTR)


The Data Pointer (DPTR) is the 8051’s only user-accessible 16-bit (2-byte) register. The
Accumulator, R0–R7 registers and B register are 1-byte value registers.

Functions:

16
 DPTR is meant for pointing to data. It is used by the 8051 to access external
memory using the address indicated by DPTR.
 It is also used for storing data and intermediate results.

5. The Program Counter


Function:
 The Program Counter (PC) is a 2-byte address which tells the 8051 where the next
instruction to execute can be found in the memory.
PC starts at 0000h when the 8051 initializes and is incremented every time after an
instruction is executed. PC is not always incremented by 1. Some instructions may require
2 or 3 bytes; in such cases, the PC will be incremented by 2 or 3.
BRANCH, JUMP, and INTERRUPT operations load the Program Counter with an address
other than the next sequential location. Activating a power-on reset will cause all values in
the register to be lost. It means the value of the PC is 0 upon reset, forcing the CPU to fetch
the first opcode from the ROM location 0000. It means we must place the first byte of
upcode in ROM location 0000 because that is where the CPU expects to find the first
instruction.

6. The Stack Pointer (SP)


Stack pointer is an 8-bit register, the direct address of SP is 81H and it is only byte
addressable, which means you can’t access individual bits of stack pointer.
Function:
 The Stack Pointer is an 8-bit register, and used to tell the location from where the
next value is to be removed from the stack.

7. Program Status Word (PSW) Register


The program status word (PSW) register is an 8-bit register, also known as flag register.
It is of 8-bit wide but only 6-bit of it is used. The two unused bits are user-defined flags.
Four of the flags are called conditional flags, which means that they indicate a condition
which results after an instruction is executed. These four are CY (Carry), AC (auxiliary
carry), P (parity), and OV (overflow).
Functions:
 The bits RS0 and RS1 are used to change the bank registers.
 The PSW Register contains that status bits that reflect the current status of the CPU.

17
Intel 8051 Instruction Set
MOV Instruction
Simply stated, the MOV instruction copies data from one location to another, It has the following
format:
MOV destination, source ; copy source to dest.
This instruction tells the CPU to move (in reality, copy) the source operand to the destination
operand.
For example, the instruction "MOV A, R0" copies the contents of register R0 to register A.
After this instruction is executed, register A will have the same value as register R0. The MOV
instruction does not affect the source operand. The following program first loads register A with
value 55H (that is 55 in hex), then moves this value around to various registers inside the CPU,
Notice the "#" in the instruction, this signifies that it is a value. The importance of this will be
discussed later, when talking about the 8051 address modes.
MOV A, #55H ; load value 55H into reg. A
MOV R0, A ; copy contents of A into R0
; (now A = R0 = 55H)
MOV Rl, A ; copy contents of A into Rl
; (now A = R0 = Rl = 55H)
MOV R2, A ; copy contents of A into R2
; (now A = R0 = Rl = R2 = 5SH)
MOV R3, #95H ; load value 95H into R3
; (now R3 = 95H)
MOV A, R3 ; copy contents of R3 into A
; (now A = R3 = 95H)

Trace table
A R0 R1 R2 R3
MOV A, # 55H 55H - - - -
MOV R0, A 55H 55H - - -
MOV R1, A 55H 55H 55H - -

18
MOV R2, A 55H 55H 55H 55H -
MOV R3, # 95 H 55H 55H 55H 55H 95H
MOV A, R3 95H 55H 55H 55H 95H

ADD Instruction
The ADD instruction has the following format:
ADD A, source ; ADD the Source operand; to the accumulator
The ADD instruction tells the CPU to add the Source byte to register A and put the result in register
A. To add two numbers such as 25H and 34H, each can be moved to a register and then added
together:
MOV A, #25H ; load 25H into A
MOV R2, #34H ; load 34H into R2
ADD A, R2 ; add R2 to accumulator
; (A = A + R2)
Trace table
A R2
MOV A, # 25 25H -
MOV R2, #34H 25H 34H
ADD A, R2 59H 34H

Executing the program above results in A = 59H (25H + 34H = 59H) and R2 = 34H. Notice that
the Content of R2 does not change. The program above can be written in many ways depending
on the registers used. Another way might be:
MOV R5, #25H ; load 25H into R5 (R5 = 25H)
MOV R7, #34H ; load 34H into R7 (R7 = 34H)
MOV A, #0 ; load 0 into A (A = 0, clear A)
ADD A, R5 ; add to A content of R5
; where A = A + R5
ADD A, R7 ; add to A content of R7
; where A = A + R7
19
Trace table
R5 R7 A
MOV R5, #25H 25H - -
MOV R7, #34H 25H 34H -
MOV A, #0 25H 34H 0
ADD A, R5 25H 34H 25H
ADD A, R7 25H 34H 59H

The program above results in A = 59H. There are always many ways to write the same program
One question that might come into mind, after looking at the above program, is whether it is
necessary to move both data items into registers before adding them together. The answer is no; it
is not necessary. Look at the following variation of the same program:
MOV A, #25H ; load one operand into A (A = 25H)
ADD A, #34H ; add the second operand 34H to A

In the above case, while one register contained one value, the second value followed the instruction
as an operand. This is called an immediate operand.
The examples shown so far for the ADD instruction indicate that the source operand can be either
a register or immediate data, but the destination must always be register A, the accumulator.
In other words, an instruction such as "ADD R2, #12H" is invalid since register A (accumulator)
must be involved in any arithmetic operation.
Notice that "ADD R4, A" is also invalid for the reason that A must be the destination of any
arithmetic operation. To put it simply: In the 8051, register A must be involved and be the
destination for all arithmetic operations. The foregoing discussion explains why register A is
referred to as the accumulator.

Intel 8051 Addressing Modes


The CPU can access data in various ways. The data could be in a register, or in memory, or be
provided as an immediate value. These various ways of accessing data are called addressing
modes.

20
The various addressing modes of a microcontroller are determined when it is designed, and
therefore cannot be changed by the programmer. Intel 8051 provides a total of five distinct
addressing modes:
 Immediate Addressing Mode
In this addressing mode, the source operand is a constant. In immediate addressing mode,
as the name implies, when the instruction is assembled, the operand comes Immediately
after the opcode. Notice that the immediate data must be preceded by the sign "#". This
addressing mode can be used to load information into any of the registers, including the
DPTR register.
Examples:
MOV A, #25H ; load 25H into A
MOV R4, #62 ; load the decimal value 62 into R4
MOV B, #40H ; load 40H into B
MOV DPTR, #4521H ; DPTR = 4512H

 Register Addressing Mode


Register addressing mode involves the use of registers to hold the data to be manipulated.
Examples:
MOV A, R0 ; copy the contents of R0 into A
MOV R2, A ; copy the contents of A into R2
ADD A, R5 ; add the contents of R5 to contents of A
ADD A, R7 ; add the contents of R7 to contents of A
MOV R6, A ; save accumulator in R6
Notice that we can move data between the accumulator and Rn (for n = 0 to 7) but
movement of data between Rn registers is not allowed. For example, the instruction "MOV
R4, R 7" is invalid.

 Direct Addressing Mode


In the direct addressing mode, the data is in a RAM memory location whose address is
known, and this address is given as a part of the instruction.
Contrast this with immediate addressing mode, in which the operand itself is provided with
the instruction. The "#" sign distinguishes between the two modes.

21
See the examples below, and note the absence of "#" sign
MOV R0, 40H ; save content of RAM location 40H in R0
MOV 56H, A ; save content of A in RAM location 56H
MOV R4, 7FH ; move contents of RAM location 7FH to R4
As discussed earlier, RAM locations 0 to 7 are allocated to bank 0 registers R0 - R7. These
registers can be accessed in two ways, as shown below:
MOV A, 4 ; is same as
MOV A, R4 ; which means copy R4 into A

MOV A, 7 ; is same as
MOV A, R7 ; which means copy R7 into A

MOV A, 2 ; is the same as


MOV A, R2 ; which means copy R2 into A

MOV A, O ; is the same as


MOV A, RO ; which means copy RO into A
The above examples should reinforce the importance of the "#" sign in 8051 instructions.
See the following code.
MOV R2, #5 ; R2 with value 5
MOV A, 2 ; copy R2 to A (A = R2 = 05)
MOV B, 2 ; copy R2 to B (B = R2 = 05)
MOV 7, 2 ; copy R2 to R7
; since "MOV R7,R2" is invalid
Although it is easier to use the names R0 - R7 than their memory addresses, RAM locations
30H to 7FH cannot be accessed in any way other than by their addresses since they have
no names.

 Register Indirect Addressing Mode

22
In the register indirect addressing mode, a register is used as a pointer to the data. If the
data is inside the CPU, only registers R0 and R1 are used for this purpose. In other words,
R2 - R7 cannot be used to hold the address of an operand located in RAM when using this
addressing mode. When R0 and R1 are used as pointers, that is, when they hold the
addresses of RAM locations, they must be preceded by the "@" sign, as shown below:
MOV A, @R0 ; move contents of RAM location whose
; address is held by R0 into A
MOV @R1, B ; move contents of B into RAM location
; whose address is held by R1
Notice that R0 (as well as R1) is preceded by the "@" sign. In the absence of the "@" sign,
MOV will be interpreted as an instruction moving the contents of register R0 to A, instead
of the contents of the memory location pointed to by RO.
 Indexed Addressing Mode
Indexed addressing mode is widely used in accessing data elements of look-up table entries
located in the program ROM space of the 8051. The instruction used for this purpose is
"MOVC A, @A+DPTR". The 16-bit register DPTR and register A are used to form the
address of the data clement stored in on-chip ROM. Because the data Elements are stored
in the program (code) space ROM of the 8051, the instruction MOVC is used instead of
MOV. The "C" means code. In this instruction the contents of A are added to the 16-bit
register DPTR to form the 16- bit address of the needed data.
Examples:
MOVC A, @A+DPTR
The source operand is @A+DPTR and we know we will get the source data (to
transfer) from this location. It is nothing but adding contents of DPTR with present
content of accumulator. This addition will result a new data which is taken as the
address of source data (to transfer). The data at this address is then transferred to
accumulator.

MOVC A, @A+PC
This example works the same way as the first example. The only difference is,
instead of adding DPTR with accumulator, here data inside program counter (PC)
is added with accumulator to obtain the target address.

23
PROCESS CONTROL SYSTEMS
Introduction
Process control systems, sometimes called industrial control systems, are systems of equipment
along the production line during manufacturing, that test the process in a variety of ways, and
return data for monitoring and troubleshooting.
Process Control Systems in industrial/ manufacturing/ production processes involve the regulation
of all aspects of the process, such as precise control of level of temperature, pressure, and flow.
They consist of monitoring the state of a critical parameter, detecting when it varies from desired
state, and taking action to restore it. Process control systems involve the process variable, set points
and manipulated variable.

The need for process control


Manufacturers need process control systems, to control the production process, for the following
reasons:
(i) Safety
Process control systems help to ensure that adverse effects will not be caused by some
agent under defined conditions, and nobody will be injured or damage caused, in the
course of the production process.

(ii) Quality
Process control systems are central to maintaining product quality, such as in
maintaining the proper ratio of ingredients to deliver a consistent product, or tightly
regulating the temperatures, to ensure the required quality standard of a product is
achieved and maintained. Without this type of control, products would vary, and
undermine quality.

(iii) Environment
Process control systems helps to reduce environmental hazards as a result of industrial
processes, by ensuring that the industrial wastes are treated properly, before being
released to the environment, or recycled for other use.

(iv) Economics
Process control systems helps to minimize production costs while producing products
that meet certain specifications.

Better process automation and control allows processes to operate closer to “optimum”
conditions, minimize wastage, and produce products that meet the quality
specifications, helping manufacturers to save money by minimizing the resources
required to produce the end product.

24
Process control terms
(i) Lag time
This is the amount of time after the dead time that the process variable takes to move
63.3% of its final value after a step change in valve position.

It is the delay time it takes the controlled variable to respond to a change in the
controller output signal.

In such a case, the error signal persists for some time before the process can return to
the set point

(ii) Dead time


Dead time is the amount of time it takes for the process variable to start changing after
changing output, such as a control valve. It is the interval between the application of a
control effort, and its first discernible effect on the process variable

Dead time is often the result of transportation delays, between the actuators and the
sensors, although sensors and final control elements may add to process dead time.

An example is, if you were taking a shower, the dead time is the amount of time it
would take for you (the controller) to feel the first discernible change in temperature
after you have adjusted the hot or cold water.

(iii) Dead band


Dead band is a range of values near the set point within which the controller will not
initiate a corrective response.

(iv) Set point


The set point is the desired value of the process variable.

For example, if a process temperature needs to kept within 5 °C of 100 °C, then the set
point is 100 °C. A temperature sensor can be used to help maintain the temperature at
set point. The sensor is inserted into the process, and a controller compares the
temperature reading from the sensor to the set point.

(v) Error signal


This is the deviation of the process variable from the Set Point and is defined
mathematically as; E = SP - PV.

In the temperature control loop example, the error is the difference between the 110°C
measured variable and the 100 °C set point—that is, the error is +10°C. The objective
of any control scheme is to minimize or eliminate error

25
(vi) Transient
A short-lived oscillation or signal in a system caused by a sudden change of voltage or
current or load.

(vii) Measured variable


The measured variable, also called the process variable, is the condition of the process
that must be kept at the designated set point e.g temperature, pressure, flow, pH,

In the temperature control loop example, the measured variable is temperature, which
must be held close to 100 °C.

(viii) Controlled variable


These are the variables which quantify the performance or quality of the final product,
which are also called output variables

(ix) Variable range


Range is from the lowest to the highest values controlled.

(x) Control parameter range


It is the possible range of values of final control element, expressed as a percentage,
where minimum controller output is 0% and maximum controller is 100%.

(xi) Offset
This is a sustained deviation of the process variable from the set point.

In the temperature control example, if the control system held the process fluid at 100.5
°C consistently, even though the set point is 100 °C, then an offset of 0.5 °C exists.

(xii) Process load


This is the amount of control agent needed to keep the process in a balanced condition.
E.g. in milk pasteurization process, a certain amount of steam is needed to keep the
milk at a certain temperature.

Block diagram of process control

26
Process
This refers to some manufacturing sequence, and is an important element of the process control
system, in which the variable of the process is to be controlled. It has one variable or multivariable
output.
Feedback element or Sensor
The feedback element or sensor is the device which converts the output variable into another
suitable variable which can acceptable by error detector.
Error detector
The error detector compares between actual signal and reference input i.e. set point . The error
detector has subtracting/summing points whose output is an error signal to controller for
comparison and for the corrective action.
Automatic controller
The controller detects the actuating error signal, which is usually at a very low power level,
and amplifies it to a sufficiently high level i.e. the automatic controller comprises an error detector
and amplifier.
Actuator or control element
The actuator is a pneumatic or valve, a hydraulic motor or an electric motor, which produces an
input to the plant according to the control signal getting from controller.

Control modes
Control mode refers to the method used by a process control system, to correct an error in a process
variable from the set point.

27
In process control, there are several control modes used to control a parameter such as temperature,
or pressure, and the method of control mode to be used, is selected according to the process, so
that a control strategy is selected that suites the process.
The four most popular control modes are:
(i) On/off
On /off control, also called a two-position control, is whereby the output is either On
or Off, with no middle ground.

This control mode would only switch when the process variable is beyond the set point,
and activates an output until the measured variable reaches the set point.

A common example is the thermostat. No control action takes place until the measured
value deviates from the set point by a minimum amount (dead band). The output then
goes from full off to full on, turning off again when the set point is reached.

Since the temperature crosses the set-point to change the output state, the process
temperature will be cycling continually, going from below set-point to above, and back
below.

While simple and low cost, this mode of control has a tendency to overshoot the desired
value
.
(ii) Proportional (P)
Proportional control is where the controller produces an action that is proportional to
the error. Here the difference between the set point and measured value generates a
continuous, linear control output, and the control sets the system response as a function
of time.

Proportional Control opens and closes a control valve by an amount which is


proportional to the error in the measured variable, i.e., the magnitude of the deviation
from the set point, thereby eliminating the cycling associated with on-off control.

28
In the example of temperature control, a proportional controller decreases the average
power supplied to the heater as the temperature approaches set-point. This has the effect
of slowing down the heater so that it will not overshoot the set-point, but will approach
the set-point and maintain a stable temperature.

This proportioning action can be accomplished by turning the output on and off for
short intervals. This “time proportioning” varies the ratio of “on” time to “off” time to
control the temperature. The proportioning action occurs within a “proportional band”
around the set-point temperature. Proportional Band is another term for controller
sensitivity. Outside this band, the controller functions as an on-off unit, with the output
either fully on (below the band) or fully off (above the band). Within the band, the
output is turned on and off in the ratio of the measurement difference from the set-
point. At the set-point (the midpoint of the proportional band), the output ON: OFF
ratio is 1:1; that is, the on-time and off-time are equal. if the temperature is further from
the set-point, the on- and off-times vary in proportion to the temperature difference.

(iii) Integral (I)


In integral control (Reset control) the output is directly proportional to the integral of
the error signal. An integral mode controller responds to the integral of the difference
between the set point and measured value. The adjustable parameter for integral control
is the integral time T, or the reset rate 1/T.

The integral mode is sometimes used as a single mode of control but is more commonly
used with proportional control.

(iv) Derivative (D)


The derivative mode is also called rate control mode because its output is based on the
rate of change of the measured variable.

In case of a sudden and large process load change, the rate control adds a signal to the
control valve, increasing the controller’s output signal in addition to the proportional

29
and integral signals. However, as the rate of change of the measured variable slows
down, the derivative signal reduces, and the valve opening is decreased.

D-control anticipates the process conditions by analyzing the change in error. It


functions to minimize the change of error, thus keeping the system at a consistent
setting.

Effects of the derivative controller are:


1. The primary benefit of D controllers is to resist change in the system, the most
important of these being oscillations. The control output is calculated based on
the rate of change of the error with time. The larger the rate of the change in
error, the more pronounced the controller response will be. Derivative control
anticipates changes to reduce overshoot, increasing system stability.
2. The derivative control mode gives a controller additional control action when
the error changes consistently.
3. It never improves the error and amplifies the noise signals and produces
saturation effects

(v) Proportional + Integral (PI)


This is a combination of proportional and an integral control, and the output (the
actuating signal) is equal to the summation of proportional and integral of the error
signal.

It provides a faster response time than I-only control due to the addition of the
proportional action. PI control stops the system from fluctuating, and it is also able to
return the system to its set point. Although the response time for PI-control is faster
than I-only control, it is still up to 50% slower than P-only control. Therefore, in order
to increase response time, PI control is often combined with D-only control.

(vi) Proportional + Derivative (PD)


In PD-control, the control output is a linear combination of the error signal and its
derivative. PD-control contains the proportional control’s damping of the fluctuation,
and the derivative control’s prediction of process error, and is used when prediction of
the error can improve control or when it is necessary to stabilize the system.

The mathematical expression for proportional derivative controller combining the


action of proportional and derivative controller is given as:

On eliminating the proportionality sign, the constant of proportionality gets added with
the error signal as well as the derivative of the error signal. Thus:

30
Where: m(t) = output of the controller
e(t) = the error signal (difference between the desired set point and the actual
process variable)
Kp = the constant of proportionality of error signal/ proportional gain
KD is the constant of proportionality of derivative of the error signal/
derivative gain

In order to have the transfer function of the PD controller, we need to consider the
Laplace transform of the above equation. Therefore,

Further:

We know transfer function is given as output by input and for controllers the input is
error signal and output is controller output.
So, on transposing E(s), we will have

Further, on taking KP as common from the RHS, we will get

Therefore, we can write it as:

TD = KD/KP = derivative action time constant

The effects of PD controller are:


1. Improves damping and maximum overshoot.
2. Reduces rise time & settling time.
3. Increases Bandwidth.
4. May attenuate high frequency noise1.

31
(vii) Proportional + Integral + Differential (PID)
PID controllers are the most widely used automatic industrial controllers, that provide
a proportional with integral, and derivative control, that helps the unit to automatically
compensate for changes in the system.

It provides the most accurate and stable control of the three controller types, and
practically, most of modern PID controllers are designed based on microcontroller
technology.

Tuning of PID controllers


Tuning is the adjustment of control parameters to the optimum values, for the desired control
response.
A properly tuned control loop will have the following characteristics:
(i) Operate within safe limits of the process.
(ii) Eliminate offset from Set Point.
(iii)Be stable over the normal operating range.
(iv) Avoid excessive control action (not overstress the final control element)
(v) Minimize the effect of known disturbances:

Zeigler-Nichols Closed Loop Method


The Ziegler–Nichols tuning method is a practical, experimental method, of tuning a PID
controller, that was developed by John G. Ziegler and Nathaniel B. Nichols.
The Ziegler-Nichols closed-loop tuning method allows you to use the ultimate gain value, Ku,
and the ultimate period of oscillation, Tu, to calculate Kc, Ki, and Kd
It is performed by setting the I (integral) and D (derivative) gains to zero. The P (proportional)
gain, Kp is then increased from zero until it reaches the ultimate gain, Ku , at which the output of
the control loop has stable and consistent oscillations. Ku and period of oscillation at this point,
Tu are then used to set the P, I, and D gains depending on the type of controller used and behaviour
desired.

32
To find the values of Kc, Ki, and Kd, and to calculate the tuning constants, the values of Ku, and Tu
are plugged into the Ziegler-Nichols closed loop equations to determine the necessary settings for
the controller.
Closed-Loop Calculations of Kc, Ki, and Kd

N/B: Gain is the parameter that determines how fast the system responds, and adjusting this
tuning parameter higher may cause more sensitive, less stable loops.
Advantages
1. Easy experiment; only need to change the P controller
2. Includes dynamics of whole process, which gives a more accurate picture of how the
system is behaving
Disadvantages
1. Experiment can be time consuming
2. Can venture into unstable regions while testing the P controller, which could cause the
system to become out of control

33
Zeigler-Nichols Closed Loop Method (The Process Reaction Method)
The Ziegler-Nichols open-loop method is also referred to as a process reaction method, because it
tests the open-loop reaction of the process to a change in the control variable output.
This basic test requires that the response of the system be recorded, preferably by a plotter or
computer. Once certain process response values are found, they can be plugged into the Ziegler-
Nichols equation with specific multiplier constants for the gains of a controller with either P, PI,
or PID actions.

The process parameters that may be obtained from this process reaction curve are as follows:
 L = Lag time in minutes
 T = Time constant estimate in minutes
 ΔPV = change in PV in response to step disturbance (% rise)
 N = ΔPV/ T = reaction rate in % min-1
The reaction rate and lag time values, are plugged in to the Ziegler-Nichols open-loop tuning
equations for the appropriate controller—P, PI, or PID—to calculate the controller constants. Use
the table below.
Closed-Loop Calculations of Kc, Ki, and Kd
Control Mode Kc Ki Kd
P P/ NL
PI 0.9P/ NL 1/ 1.33L
PID 1.2P/ NL 1/2L 0.5L

Implementation of Controllers
Implementation of the control loops can be achieved using pneumatic devices, analogue
electronics, or digital electronics.

34
The first process controllers were pneumatic. However, these have largely been replaced by
electronic systems, because of improved reliability, less maintenance, easier installation, easier
adjustment, higher accuracy, lower cost, can be used with multiple variables, and have higher
speed operation.
The most popular control implementation devices are:
(i) Pneumatic controllers
A pneumatic controller receives a process variable (PV) signal as a variable air pressure,
compares that signal against a desired set point (SP) value, and then mechanically generates
another air pressure signal as the output, driving a final control element.

The power supply and output of a pneumatic controller is compressed air. The input signal to
the controller is mechanical movement provided by the sensing element that is being used to
sense the process.

Pneumatic controllers are used in automatic control systems for flow rate, pressure,
temperature, level, and other parameters of industrial processes.

(a) Pneumatic On/Off controllers


These are applied in processes which are characterized by stable load conditions which
can be controlled using on/off control with a “quick-opening” control valve, providing
a full corrective response to a minimal change in the measured variable

The controller mechanically compares the signal against a predetermined set point and
sends a corrective air signal to a pneumatic control valve, which modulates process flow,
thereby returning the application to the desired condition.

(b) Pneumatic P, PI, and PID controllers


Many pneumatic P, PI, and PID controllers use the force-balance principle. One or more
input signals (in the form of pneumatic pressures) exert a force on a beam by acting
through diaphragms, bellows, and/or tubes, which is then counter-acted by the force
exerted on the same beam by an output air pressure acting through a diaphragm, bellows,
or tubes. The self-balancing mechanical system “tries” to keep the beam motionless
through an exact balancing of forces, the beam’s position precisely detected by a
nozzle/baffle mechanism:

35
The action of this particular controller is direct, since an increase in process variable
signal (pressure) results in an increase in output signal (pressure). Increasing process
variable (PV) pressure attempts to push the right-hand end of the beam up, causing the
baffle to approach the nozzle. This blockage of the nozzle causes the nozzle’s pneumatic
backpressure to increase, thus increasing the amount of force applied by the output
feedback bellows on the left-hand end of the beam and returning the flapper (very
nearly) to its original position.

It is possible to have a pneumatic controller that is proportional-only (P), proportional


plus integral (PI), or full PID. Since each control mode requires additional components
to implement, a P-only pneumatic controller costs less than a PI pneumatic controller,
which in turn costs less than a full PID pneumatic controller. This explains the relative
scarcity of full PID pneumatic controllers in industry, because paying for additional
functionality is not sensible, if less will suffice for the task at hand.

Merits of Pneumatic Controllers


1. Pneumatic systems are cheap since the fluid used in pneumatic control systems is air which
is easy to collect and the used air can be returned back to the atmosphere.
2. Pneumatic systems generally have long operating lives and require little maintenance.
3. Pneumatic systems are easily designed using standard cylinders and other components,
and operate via simple on-off control.

Demerits of Pneumatic Controllers

36
1. Pneumatic systems are noisy and there are often leaks in the system.
2. They are always prone to dust and contaminants.
3. Pneumatic systems are suitable only for low-pressure applications.
4. Slow response makes control and speed in pneumatic systems to be more difficult because
of the compressed air, compared to electrical or hydraulic systems.

(ii) Electrical controllers


Electronic controllers can use analog semiconductor components, or digital communication
to effect control logic and optimize system efficiency.

Electronic PID controllers use operational amplifiers and passive components like resistors
and capacitors, with the gains and control actions of the control system, being decided by the
ratios of various resistors and capacitors, according to the circuit arrangement.

(iii) Computer or PLC controllers


Modern process facilities will use a computer or PLC controllers as the heart of the control
system. The system is able to control analog loops, digital loops, and will have a foundation
fieldbus for communication with smart sensors. Several processors may also be connected to
a mainframe computer for complex control functions.
Actuators
An actuator is a component of process control system that is responsible for bringing about the
mechanical movements required for any industrial process, for example by opening a valve.
It converts the command signal from controllers, or higher-level components into physical
adjustments, moving and controlling an adjustable process variable. In simple terms, it is a
"mover".
An actuator requires a control device (controlled by control signal) and a source of energy. The
control signal is relatively low energy and may be electric voltage or current, pneumatic,
or hydraulic fluid pressure, or even human power. Its main energy source may be an electric
current, hydraulic pressure, or pneumatic pressure. The control device is usually a valve. When it
receives a control signal, an actuator responds by converting the source's energy into mechanical
motion.

37
Types of Actuators
(i) Solenoid
Solenoids are the most common actuator components. The basic principle of operation is that,
there is a moving ferrous core (a piston) that will move inside wire coil.

Normally the piston is held outside the coil by a spring. When a voltage is applied to the coil
and current flows, the coil builds up a magnetic field that attracts the piston and pulls it into
the center of the coil. The piston can be used to supply a linear force.

Solenoids can be used to electrically open door latches, open or shut valves, move robotic
limbs, and even actuate electric switch mechanisms. However, if a solenoid is used to actuate
a set of switch contacts, then it is termed a relay.
(ii) Stepper motor drives
A stepper motor is a type of electric motor that operates on a pulsed current. The full rotation
of the motor is divided into a number of discrete “Steps” or “Increments”, with the angle of
each rotational movement or step dependent upon the number of stator poles and rotor teeth
the stepper motor has.

Stepper motors are much more precise than standard electric motors as they can be
commanded to turn and stop at any of the steps around its rotation. Because of this, they are
particularly well suited to applications that require accurate positioning and repeatability with
a fast response to starting, stopping, reversing and speed control.

Stepper motors require sufficient and controlled energy for phases in a precise sequence. Due
to this, stepper motors are controlled by a driver consisting of a controller, and the stepper
motor’s connections.

38
All the coils with the same letter are connected together so that energizing, say coils marked
A, will cause the magnetic rotor to align itself with that set of coils.
By applying power to each set of coils in turn, the rotor can be made to rotate or "step" from
one position to the next, by an angle determined by its step angle construction, and by
energizing the coils in sequence, the rotor will produce a rotary motion.
Step Angle
The angle through which the motor shaft rotates for each command pulse is called the step
angle (β). The smaller the step angle, the greater the number of steps per revolution, and higher
the resolution or accuracy of positioning obtained. The step angles can be as small as 0.72º or
as large as 90º. But the most common step sizes are 1.8º, 2.5º, 7.5º and 15º.
The value of step angle can be expressed either in terms of the rotor and stator poles (teeth)
Nr and Ns respectively, or in terms of the number of stator phases (m) and the number of rotor
teeth.

Resolution is given by the number of steps needed to complete one revolution of the rotor
shaft. The higher the resolution, greater the accuracy of positioning of objects by the motor
Resolution = No. of steps / revolution = 360º / β

39
There are three basic types of stepper motors; Variable Reluctance, Permanent Magnet, and
Hybrid (a sort of combination of both).

Merits of using a stepper motor as an actuator


 They are economical because they require no additional cabling or a position feedback
sensor.
 The motor is well-known for its repeatability and high-accuracy of 3-5%.
 These motors are compact-sized, and easily fulfill the requirement for small sized
components to be fitted within the actuators.
 The high pole count of the motor enables them to generate a high torque at zero speed.

(iii) Pneumatic
They convert air pressure into mechanical motion. There are two basic types: Linear actuators
(cylinder/piston or diaphragm types) and rotary actuators.

Piston and rotary actuators are functionally similar to their hydraulic counterparts.

Pneumatic cylinder consists of a piston in a cylinder in one of two basic internal


configurations.

The double acting cylinder connects to the valve with two tubes and can be driven in either
direction.

The single acting cylinder can only be driven in one direction with air pressure and is returned
by a spring.

Rotary actuators convert air pressure into rotary mechanical motion. One common design is
the vane motor.

40
The motor consists of a rotor that is offset in housing. Protruding from the rotor are spring-
loaded vanes that seal against the housing and slide in and out of the rotor as it turns.

Motion is achieved because the vanes on the top have more exposed surface area than on the
bottom and hence receive more force, causing the rotor to turn clockwise.

In most cases rotary actuators are not chosen for their efficiencies, but for their power, speed
and torque

Advantages of Pneumatic Actuators:


The advantages of Pneumatic actuators are as follows,
1. Control is simple.
2. High reliability of work
3. It is the cheapest form of all actuators
4. Pneumatic actuators have very quick action and response time, thus allowing for fast
work cycles.

Disadvantages of Pneumatic Actuators:


1. More noise and vibration.
2. Since air is compressible, pneumatic cylinders are not typically used for applications
requiring accurate motion between two well-defined endpoints.
3. Pneumatics are not suitable for heavy loads.
4. If mechanical stops are used, resetting the system can be slow.

(iv) Hydraulic
The most common type of hydraulic actuator is the hydraulic cylinder. A cylinder uses
pressurized fluid to create a linear force/motion.

Single acting cylinders apply force when extending and typically use a spring to retract the
cylinder. Double acting cylinders apply force in both directions.

41
In the figure below, a fluid is pumped into one side of the cylinder under pressure causing that
side of the cylinder to expand, and advancing the piston.

The fluid on the other side of the piston must be allowed to escape freely - if the
incompressible fluid was trapped the cylinder could not advance. The force the cylinder can
exert is proportional to the cross sectional area of the cylinder.

Under normal operating conditions, both ends of the cylinder are filled with fluid. If additional
fluid enters port A, the piston will move toward the right, but the fluid must be able to escape
through port B.

Some actuators can create rotary motion and are very similar to the pump designs. The figure
below shows a gear motor rotary actuator.

42
For the motor, fluid is pumped in the left side of the case, putting that area under pressure.
Within the pressurized area, all surfaces receive a force, but only those three surfaces indicated
with arrow will effect rotation.

The pressure on the teeth next to the case will case the gears to rotate. The pressure on the
meshing teeth in the center would cause the gears to turn in the opposite direction, but this
torque is overpowered because two teeth are pushing the other way.

Advantages of hydraulic actuators:


1. It has the advantage of generating extremely large force from a very compact
actuator.
2. It can also provide precise control at low speeds
3. robust.
4. self-lubricating.
5. Due to the presence of an accumulator that acts as a storage device the system can
meet sudden demand in power.
6. No mechanical linkages are required.
7. High efficiency and high power to size ratio.

Disadvantages of hydraulic actuators:


1. The hydraulic system is required for a large infrastructure is high-pressure pump, tank,
distribution lines.
2. Leakage can occur causing a loss in performance.
3. High maintenance.
4. Not suitable for a clean environment.

43
SEQUENTIAL CONTROL SYSTEMS
Sequence control
A sequential control system is a type of control system that involves the sequential execution of
well-defined operations, that are performed in a prescribed order. Each operation or activity is
called a step.
It is a control system that manages a process defined by a series of tasks to be performed i.e. a
sequence of operations, one after the other. Each operation in the sequence is performed either for
a certain period of time (in which case, it is time-driven), or until the task is finished e.g. as
indicated by a limit switch (in which case it is event-driven).
A time-driven sequence is open loop because there is no feedback, while an event-driven task is
closed loop because feedback signal is required to specify when the task is finished.
A typical example of a sequentially controlled system is the automatic washing machine. The first
event in the wash cycle is to fill the tub with water. This is an event-driven task because the water
is admitted till it gets to the proper level, as indicated by a float and limit switch (i.e. a closed loop).
The next two tasks, wash and spin drain, are each done for a specified period of time and are time-
driven events i.e. open loop.
Other examples of systems that use sequential control systems include elevators, and other systems
with interrelated operations, where an automatic sequential control system may trigger a series of
mechanical actuators in the correct sequence to perform a task. For example, various electric and
pneumatic transducers may fold and glue a cardboard box, fill it with the product, and then seal it
in an automatic packaging machine.

Time delay units


In sequential control systems, time delays are units that cause a time-shift in the input signal but
do not affect the signal characteristics.
An ideal delay is a delay system that does not affect the signal characteristics at all, and delays the
signal for an exact amount of time.
While some delays, like processing delays or transmission delays, are unintentional, other delays
however, such as synchronization delays, are an integral part of a system.
Time delay can be accomplished in the following ways:
(i) Control relays
(ii) Digital relays
(iii)Analogue relays

Application of Decoders/ Encoders in Sequential Control

44
In sequential control, encoders and decoders are used to convert data from one format to another.
In natural language processing, encoder-decoder models are used to convert input sequences into
a single-dimensional vector (hidden vector). The decoder will convert the hidden vector into the
output sequence.
Encoder-Decoder models are jointly set to maximize the conditional probabilities of the target
sequence, given the input sequence.

Practical interlock systems


An interlock is a feature that makes the state of two mechanisms or functions mutually dependent.
It may be used to prevent undesired states in a machine, and may consist of any electrical, or
mechanical devices or systems.
In most applications, an interlock is used to help prevent any damage to the machine, or to the
operator handling the machine, by stopping the machine when tripped.
Examples of interlock systems include:
 Elevators are equipped with an interlock that prevents the moving elevator from opening
its doors, and prevents the stationary elevator (with open doors) from moving.
 Household microwave ovens are equipped with interlock switches which disable the
magnetron if the door is opened.
 Household washing machines will interrupt the spin cycle when the lid is open
 Interlocks also serve as important safety devices in industrial settings, where they protect
employees from devices such as robots, presses, and hammers.
While interlocks may include elements such as photodetectors, a computer containing an
interlocking computer program, with digital or analogue electronics, simple switches, and locks.

Manual vs. Automatic Operation of Interlock Systems


Operation of an interlock system may take place either through manual or automatic trip.
In a manual trip, the interlock system is manually actuated from a switch or pushbutton, which
may be located on a local panel in the field or in the control room.
A manual trip allows an operator to trip the system independently of the interlock system in the
event of a hazardous situation developing.
An automatic trip, as the name implies, is automatically activated when a hazardous situation is
detected. A common example is the de-energizing of a solenoid valve that fails a control valve to
its safe position.

45
Manual vs. Automatic Reset of Interlocks
A tripped component (e.g. a solenoid valve) needs to be reset after a trip had been initiated. The
reset may be done either automatically or manually.
Self-Canceling Interlock has automatic reset that returns the interlock system to normal operation,
when the usual process conditions have been re-established, or when the offending situation has
been effectively dealt with.
Manual Reset Interlock requires the operator to re-initiate the process before continuing the
operation of the equipment involved. This method is generally preferable over automatic reset
because it requires an investigation of the possible causes for the trip. Positive action by the
operating personnel to return the operating conditions to normal is required before the interlock
can be cancelled.
Manual reset on a solenoid valve is most commonly carried out by the use of a latching lever that
locks the valve when a trip occurs. Unlatch of the lever is required to return the solenoid valve to
its normal operation. Alternatively, a solenoid valve can simply be reset by the use of a pushbutton
that energizes the valve.
Practical interlock systems can be implanted through:
(i) Solenoid
(ii) Limit switches
(iii)Control relays
(iv) Digital
(v) Analogue
Programmable Logic Controllers
A programmable logic controller or PLC is an industrial-grade digital computer, designed to
perform control functions, applicable to many different types of process control cases.
The word “programmable” in its name reveals just why PLCs are so useful: the end-user is able to
program, or instruct, the PLC to do virtually any control function imaginable.
Unlike PID loop controllers, which are special-purpose devices intended to perform a single type
of control function, a PLC may be instructed to do almost anything with the signals it receives
from input devices.
PLCs can range from small modular devices with tens of inputs and outputs (I/O), in a housing
integral with the processor, to large rack-mounted modular devices with thousands of I/O, and
which are often networked to other PLC and SCADA systems.

Internal architecture of Programmable Logic Controllers (PLC)


PLC architecture refers to the design specification of the various PLC hardware and software
components, and the how they interact with one another to form the overall PLC system.

46
The architecture of a PLC is based on the same principles of that used in a standard computer
architecture. However, PLC architecture does differ because the design is based around providing
high reliability, immunity to harsh industrial environment, ease of maintenance, and access to large
amounts of peripheral inputs and outputs.
A PLC consists of:
 A processor unit (CPU) which interprets inputs, executes the control program stored in
memory and sends output signals,
 A power supply unit which converts AC voltage to DC,
 A memory unit storing data from inputs and program to be executed by the processor,
 An input and output interface, where the controller receives and sends data from/to external
devices,
 A communications interface to receive and transmit data on communication networks
from/to remote PLCs.
 A programming terminal used to formulate the PLC program (eg ladder logic), load the
program into the controller and monitor/control the PLC and its program.
The block diagram below shows the basic architecture of a PLC

47
PLCs require programming device which is used to develop and later download the created
program into the memory of the controller.

Types of timers in PLC programming.


(i) Pulse timers: These timers generate a single pulse of a specified duration when the input
condition is true.
(ii) On-delay timers: These timers delay the output from turning on until the input condition
has been true for a specified time.
(iii)Retentive on-delay timers: These timers are similar to on-delay timers, but they retain the
accumulated time when the input condition is false.
(iv) Off-delay timers: These timers delay the output from turning off until the input condition
has been false for a specified time.

Flowchart and Ladder Diagram Programming Methods


PLC Ladder Logic Symbols

48
Advantages of PLCs over control relay circuits.
 Ability to interface/communicate with computers
 Flexibility in programming and reprogramming
 Supervisory control capability
 Easier and cheaper to modify or expand the control system at a later date.
 Reduced design, installation and component costs.
 Solid-state components tend to last longer than the moving parts of electromechanical
relays

49
50

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy