100% found this document useful (1 vote)
3K views53 pages

Unit 4 - L Notes - Introduction To Microcontroller

A microcontroller is a tiny computer chip that can be used as an embedded system. It contains a processor, memory, and input/output peripherals on a single chip. Microcontrollers are commonly used in devices like home appliances, phones, cameras, and more. They can be programmed to control various functions of the device. Common types include 8-bit, 16-bit, and 32-bit microcontrollers depending on the width of the internal data bus. Memory in a microcontroller typically includes RAM, ROM, and flash memory.

Uploaded by

AKSHANSH MATHUR
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
100% found this document useful (1 vote)
3K views53 pages

Unit 4 - L Notes - Introduction To Microcontroller

A microcontroller is a tiny computer chip that can be used as an embedded system. It contains a processor, memory, and input/output peripherals on a single chip. Microcontrollers are commonly used in devices like home appliances, phones, cameras, and more. They can be programmed to control various functions of the device. Common types include 8-bit, 16-bit, and 32-bit microcontrollers depending on the width of the internal data bus. Memory in a microcontroller typically includes RAM, ROM, and flash memory.

Uploaded by

AKSHANSH MATHUR
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 53

Chapter 1

Introduction to Microcontrollers

Introduction

A Microcontroller is a tiny, a chip that can be used as an embedded system. A


Microcontroller is a programmable digital processor with essential peripherals.

Microcontroller Vs Microprocessors

 A microprocessor is a single chip CPU (Central Processing Unit) in which the memory
and peripherals are connected externally. A microcontroller consists of processor,
peripherals include Memory (RAM and ROM), I/O ports, Timers/Counters,
Communication Interface, ADC etc.
 A microcontroller does not require additional interfacing ICs for operation and it
functions as a stand-alone system.
 The clock speed of a microcontroller varies from a few MHz to 50 MHz whereas the
microprocessors can operate clock speed above 1 GHz.

List of Terms Used in a Microcontroller


The list of frequently used terms in a microprocessor is:
 Instruction Set − It is the set of instructions that the microprocessor can understand.
 Clock Speed − It determines the number of operations per second the processor can
perform. It is expressed in megahertz (MHz) or gigahertz (GHz).
 Word Length − It depends upon the width of internal data bus, registers, ALU, etc. An
8-bit microprocessor can process 8-bit data at a time. The word length ranges from 4 bits
to 64 bits depending upon the type of the microcomputer.
 Data Types − The microprocessor has multiple data type formats like binary, BCD,
ASCII, signed and unsigned numbers.
Evolution of Microcontroller

In 1975, Intel fabricated a chip (Intel 8048) with inbuilt RAM and ROM which was widely
used in varieties of applications. The EPROM and PROM included later in the microcontrollers.
The Intel Corporation released an 8-bit version in the year 1981 called the IC8051 which became
popular and widely used for industrial applications.

`
A microcontroller can be considered a self-contained system with a processor, memory and
peripherals and can be used as an embedded system. The majority of microcontrollers in use
today are embedded in other machinery, such as automobiles, telephones, appliances, and
peripherals for computer systems.
Types of Microcontrollers
 8-bit microcontroller
When in-house bus in a MCU is 8-bit bus then the ALU carries out the logic & arithmetic
operations on a byte at an order. The MCU is 8-bit micro-controller. The illustrations of 8-bit
MCU are- Intel 8031/8051, Motorola MC68HC11 & PIC1x families.
 16-bit microcontroller
The 16 bit Microcontroller consists of a 16 bit bus and the ALU performs arithmetic and logic
operations on the 16 bit operand.
 32-bit microcontroller
When in-house bus for the data transmitting function in an MCU is 32-bit bus then the ALU
carries out logic & arithmetic functions on operand words of 32 bits at the orders. The MCU
is 32-bit micro-controller.
Different Families of Microcontroller:
Intel Family
Intel Corporation introduced the 8051 microcontroller. It is 8-bit, inbuilt RAM and ROM,
timers/Counters, Serial ports, 12 clocks per instruction etc. But the 8051 microcontroller does not
have an in built memory bus and Analog to Digital Converters (ADC).  In 1980, Intel fabricated
the single chip microcontroller 8051 with Harvard architecture.

PIC Family

 PIC (Programmable Interface Controller) microcontrollers are slightly older than 8051
microcontrollers and it offers high performance. The single chip PIC microcontroller was
introduced by Microchip technology fabricated with Harvard architecture. The programming part
is very complex and hence it is not suitable choice for beginners.

AVR Family

  In the year 1996, Atmel fabricated the single chip AVR microcontroller with a modified
Harvard Architecture. This chip is loaded with C- compiler, Free IDE (Integrated Development

`
Environment) and it has lot of features. This microcontroller is little bit difficult for the beginners
to handle.

Selection Criteria of Microcontroller

The most important selection criteria of microcontroller are:

 Maximum speed
 On-chip RAM and ROM capacity
 Cost efficient
 On-chip peripherals
 Number of I/O pins

Microcontroller has an input device in order to get the input and an output device to display the
final process output. For example, Microcontroller is used in electronic applications such as
Television. The Television has a remote control which is input device and the TV screen is the
output device. The signal sent from the remote control is captured by the microcontroller. The
microcontroller controls the channel selection, the amplifier system and picture tube adjustments
such as hue, brightness, contrast etc.

Instruction Set
Based on the instruction set configuration, the microcontroller is further divided into two
categories.

 CISC − CISC stands for Complex Instruction Set Computer. It allows the user to insert a
single instruction as an alternative to many simple instructions.
 RISC − RISC stands for Reduced Instruction Set Computers. It reduces the operational
time by shortening the clock cycle per instruction.
Programming in Microcontroller
Microcontrollers were originally programmed only in assembly language, but various high-level
programming languages, such as C, Python and JavaScript, are now also in common use to target
microcontrollers and embedded systems. These languages are either designed especially for the
purpose, or versions of general purpose languages such as the C programming language.
Recent microcontrollers are often integrated with on-chip debug circuitry that when accessed by
an in-circuit emulator (ICE) via JTAG, allow debugging of the firmware with a debugger. A

`
real-time ICE may allow viewing and/or manipulating of internal states while running. A tracing
ICE can record executed program and MCU states before/after a trigger point.
Applications of Microcontrollers
Microcontrollers are used in wide range of products which are automatically controlled. The
various products that make use of microcontrollers in our everyday life are:
 Home Appliances: - Television, DVD player, Telephone, Cellular Phones, Camera, Security
systems, Sewing machine, Musical instrument, Exercising machine, Video games,
Microwave oven, Fax machine, Printers, Security Systems, Telephones.

Memory Types

A Memory module is a physical device which is used to store user programs or data in a
temporary or permanent manner. All memory structures have an address bus and a data bus. The
various types of memories used in microcontroller are

 RAM (Random Access Memory)


 ROM (Read Only Memory)
 Flash Memory

RAM (Random Access Memory)

This is the volatile memory which means that the stored programs and data are lost when
the power is shut off. It offers fast read access times. There are different types of RAM are:
 Static RAM
 Dynamic RAM

Static RAM

The Static RAM (SRAM) uses transistor to store a single bit of data. Its structure is
complex than Dynamic RAM (DRAM). It does not need periodic refreshment to maintain data. It
is more expensive and faster than DRAM. It is used in Cache memory.

Dynamic RAM

`
The Dynamic RAM (DRAM) uses a separate capacitor to store each bit of data. It is
available in large storage capacity. It needs the data to be refreshed periodically to retain the
data. It consumes high power. It is used in Main memory.

ROM (Read Only Memory)

It is a non-volatile memory which means that the stored programs are retained even if the
power is shut off. Data stored in ROM neither be erased nor replaced. The instructions are
written in ROM at the time of manufacturing and it is used to execute on start-up of computer
and makes the system ready for work. It contains a set of start-up instructions to check that
memory is functioning well and check for other hardware devices. These instructions also check
for an operating system and load its necessary part to RAM.

The different types of ROM are:

 PROM (Programmable ROM)


 EPROM (Erasable Programmable ROM)
 EEPROM (Electrically Erasable Programmable ROM)

PROM (Programmable ROM)

It is a memory chip in which the data is written only once. Once the data is written, it
cannot be altered. It can be executed at a very high speed and it is used for converting critical and
lengthy operations into micro-programs that are fused into a chip. The fuse is existed for every
bit of the PROM and it is programmed by blowing the fuses. If any error occurs, it cannot be
removed and it is unusable. It is also referred to as OTP (One Time Programmable).

EPROM (Erasable Programmable ROM)

It is initially blank and the user can write programs and data on it using special ultraviolet
rays. The data written on EPROM can be erased and reprogrammed with the help of electrical
pulses.

EEPROM (Electrically Erasable Programmable ROM)

It can be erased and reprogrammed by exposing it to an electrical charge. It retains its


contents even if the power is switched off. It can be erased single byte at a time, rather than
erasing the entire chip with ultraviolet light.

`
Flash Memory

It is a non-volatile memory chip used for storage and for transferring data between a
personal computer (PC) and digital devices. Devices uses flash memory erases data at the block
level and rewrite data at the byte level. It is used in a wide range of consumer devices include
USB (Universal Serial Bus) flash drives, smart phones, tablet computers, digital cameras and
embedded controllers.

The architecture of flash memory consists of a memory array stacked with a large number
of flash cells. It has a grid of columns and rows with a cell that has two transistors at each
intersection. It consists of a floating-gate transistor which based on complementary metal-oxide
semiconductor (CMOS) technology used to hold an electrical charge in a memory to store data.

Flash memory devices operates on two different technologies which are NAND and NOR
to map the data. NOR flash provides high-speed random access, reading and storing data in
specific memory locations. NAND flash is used to read and write data sequentially at high speed.
It handles data in tiny blocks called pages. It is used in digital cameras, audio and video players,
solid-state and USB flash drives, and TV set-top boxes. The time taken to read the contents is
faster than to write the data.

`
Chapter 2

Peripheral Devices
Peripherals

The microcontroller includes CPU, memory and peripheral devices. The various
peripheral devices are:

 Input /Output ports


 Timers/Counters
 ADC (Analog to Digital Converter)
 DAC (Digital to Analog Converter)
 Interrupt Controller
 Real-Time Clock (RTC)
 UART (Universal Asynchronous Receiver Transmitter)

Input /Output ports

It is used to facilitate the flow of signal between the CPU and the external devices. There
are 32 I/O pins in microcontroller which are configured as either input or output ports.

I/O port is the physical port that connects to communicate other hardware devices. I/O
interface is the software interfaces that allow the Operating System (OS) to communicate with
hardware devices. An I/O port generally refers to the physical port (e.g., DB-9, USB connector,
DB-25 connector, etc.

I/O Ports and Connectors:-


1 ICMB connectors
2 Video connector
3 Serial port B
4 Keyboard connector
5 Mouse connector
6 Serial port A
7 Parallel port connector
8 USB connectors 0 and 1

Intelligent Chassis Management Bus [ICMB]


is a multi-drop, multi-master, 2-wire, half-duplex, differential drive bus, using RS-

`
485 transceivers.

Timers/Counters

Embedded systems often require mechanisms for counting the occurrence of events and for
performing tasks at regular intervals. A timer is a specialized type of clock which is used to
measure time intervals. A timer that counts from zero upwards for measuring time elapsed is
often called a stopwatch. It is a device that counts down from a specified time interval and used
to generate a time delay.
Timers are used to generate timings of internal or external events, scheduling events, measuring
the width of a pulse, speed control of motors (PWM), generation of complex waveforms and
frequency generation.

A counter is a device that stores (and sometimes displays) the number of times a particular event
or process occurred, with respect to a clock signal. It is used to count the events happening
outside the microcontroller. 

Difference between a Timer and a Counter

Timer Counter
The register incremented for every The register is incremented considering 1 to 0
machine cycle. transitions at its corresponding to an external
input pin (T0, T1).
Maximum count rate is 1/12 of the Maximum count rate is 1/24 of the oscillator
oscillator frequency. frequency.
A timer uses the frequency of the A counter uses an external signal to count pulses.
internal clock, and generates delay.

Analog to Digital Converter (ADC)

The ADC is used to convert analog input signal into digital output signal. Analog signals
are generated from the transducers and it is processed by the microcontroller in digital signal.
The data processing in digital signal reduces the effects of noise and increases the accuracy.

Analog-to-Digital converters (ADC) translate analog real world signals like temperature,
pressure, voltage, current, distance, or light intensity, into its equivalent digital signal. 

`
Applications of ADC

 Digital Voltmeter – It measures voltage in analog form and converts it into equivalent
digital form.
 Voice Recorder – It uses ADC to convert analog voice information to the digital
information.
 Scanner – It uses ADC to convert analog information provided by the picture into digital
information.
 Mobile Phone –The voice in analog form is converted into digital form for speech
compression, encoding etc.

Digital to Analog Converter (DAC)

The DAC is used to convert digital input signal into analog output signal. It is used in
digital systems to provide interface with analog sensors. The digital data may be produced from a
microprocessor, Application Specific Integrated Circuit (ASIC), or Field Programmable Gate
Array (FPGA), but ultimately the data requires the conversion to an analog signal in order to
interact with the real world.

Applications of DAC

 MODEMS – It uses DAC to convert the digital data to analog form in order to carry the
analog signal over telephone lines.
 Digital Motor Control
 Sound Systems
 Function Generators
 Oscilloscopes
 Digital Audio Systems
 Video adapters

Interrupt Control

It is a signal to the microcontroller generated by hardware or software indicating an event


that needs immediate attention. The microcontroller responds to an interrupt by temporarily
suspending its current activities, saving its state and executing a function called an interrupt

`
handler to deal with the event. After servicing the interrupt, the microcontroller continues to
perform the normal activities.

Real Time Clock (RTC)

It is used to enable accurate time measurements for microcontroller operation. It is an


electronic device in the form of Integrated Chip (IC) available in different packing options.

UART (Universal Asynchronous Receiver Transmitter)

It is a hardware component that can transmit and receive digital data. It is used to perform
communications over the serial ports through an RS-232 serial interface standard. UART devices
can operate at various clock speeds.

It is a microchip which performs serial to parallel conversion of data received from


peripheral devices and parallel to serial conversion of data from the microcontroller to peripheral
devices.

`
Chapter 3

IC8051 Microcontrollers

IC8051 Microcontroller

An 8-bit microcontroller performs arithmetic and logical operations with 8-bits. The
examples of 8-bit microcontroller are IC8051 andIC8031. The IC8051 microcontroller is
launched in the year 1980 by Intel Corporation. The IC8031 is a member of the IC8051 family.
IC8031 has no on-chip ROM as compared to IC8051.

Features of IC8051 Microcontroller

 8-bit Microcontroller
 4Kilobytes on-chip program memory (ROM)
 128 bytes on-chip data memory (RAM)
 128 user defined software flags
 Four register banks
 40-pin DIP IC
 8-bit bi-directional data bus
 16-bit unidirectional address bus
 32 general purpose registers each of 8-bit
 Two 16-bit Timers
 Three internal and two external interrupts
 Four 8-bit I/O ports
 8-bit Stack Pointer
 16-bit Program Counter and Data Pointer
 Operating frequency is 24MHz – 33MHz
 One Microsecond instruction cycle with 12 MHz crystal
 Operates on +5V Regulated DC Power Supply
 Full duplex UART
 It has 21 Special Function Registers (SFRs)
 Bit and Byte addressable

`
Block Diagram of Microcontroller

The fig.1 shows the basic layout of a microcontroller. The microcontroller includes
Processor Core, Memory (RAM and EEPROM), Timer/Counter module, Digital I/O module,
Analog module and Interrupt Controller.
The system bus connects all the support devices to the CPU. The system bus consists of an 8-bit
data bus, a 16-bit address bus and bus control signals. All other devices like program memory,
ports, data memory, serial interface, interrupt control, timers, and the CPU are all interfaced
together through the system bus.
Processor Core

It is the CPU of the microcontroller. It contains the Arithmetic Logic Unit (ALU), the
control unit, and the registers include program counter, stack pointer, accumulator, register file
etc.

Memory

The memory of the microcontroller is divided into program memory and data memory.
The program memory is used for storing of permanent programs and the data memory is used for
storing temporary storage of data. The EEPROM acts as program memory and the RAM acts as
data memory. A Direct Memory Access (DMA) controller is used to transfer data between
memory and peripheral components in larger microcontrollers.

Timer/Counter

A Timer/Counter module allows the microcontroller to perform tasks for certain time
periods. The 8051 microcontroller consists of two 16-bit timers and counters such as timer 0 and
timer 1. Both the timers consist of a 16-bit register in which the lower byte is stored in the TL
and the higher byte is stored in the TH. The Timer can be used as a counter as well as for timing
operation that depends on the source of the clock pulses to the counters. This module is used in
operations which include clock functions, frequency generation and measurement, modulation
and pulse generation.

The Timers and Counters in IC8051 microcontrollers contain two special function registers
which are TMOD (Timer Mode) register and TCON (Timer Control) register.

`
Fig. 1 Block diagram of Microcontroller-8051

Digital I/O Module

The important features of microcontroller are parallel digital I/O ports. The I/O ports are
multiplexed with alternate functions for the peripheral devices on the microcontroller. They are
used to interface peripherals such as printers, external memories, LEDs and LCDs to the
microcontroller. There are serial ports in microcontroller which is used to interface serially
connected peripherals with the microcontroller.

Analog Module

Microcontroller can read the analog voltage from the output of sensors and convert it into
digital by using Analog to Digital Converter (ADC). This digital signal is processed by the
microcontroller and converts it back into analog voltage as output by using Digital to Analog
Converter (DAC).

Serial Interface Module

It is used to interface the microcontroller with the peripheral devices. Serial communication is
the process of transmitting or receiving single bit at a time between the microcontroller and the
peripheral devices. The rate of serial data transmission is expressed in baud rate. The serial
communication is performed using UART (Universal Asynchronous Receiver and Transmitter).

`
Asynchronous indicates that data is transferred without the need of external clock signal. A
microcontrollers UART device has separate signals for transmitting and receiving serial data.
Asynchronous communication requires start bit, data bits, synchronization bits, parity bits and
stop bit.

Interrupt Controller: -

Interrupt is an event that suspends the main program temporarily and transfers the control to a
special routine which executes the event-related function. After the completion of event, the
program control returns back to the main program where the interrupt is called. Interrupt Service
Routine (ISR) is a code that tells the microcontroller what to do when the interrupt occurs.

Interrupts are classified as hardware and software interrupts. Hardware interrupts are
generated by the inbuilt devices of the microcontroller such as timer or by the interfacing
devices. Software interrupts are generated through the program.

8051 Interrupts

The various interrupts in 8051 microcontroller are

 Two External interrupt (INT0 and INT1)


 Two Timer interrupt (T0 and T1)
 Serial interrupt (Transmit Interrupt-TI/Receive interrupt-RI)

The external interrupt flags are cleared when the processor branches to the interrupt service
routine, provides the interrupt is a negative edge triggered.

IE (Interrupt Enable) Register


This register is responsible for enabling and disabling the interrupt. EA register is set to one for
enabling interrupts and set to 0 for disabling the interrupts. 
IP (Interrupt Priority) Register
The priority levels of the interrupts can be changed by changing the corresponding bit in the
Interrupt Priority (IP) register.
Registers in 8051:- A register is a tiny part in a CPU that can store small amount of data
during arithmetic or logical operations and loads the output on the memory. Registers contain the
address of the memory location where the data is to be stored.

`
Types of Registers

The IC8051 contains two types of registers


 General Purpose Registers (Byte addressable)
 Special Function Registers (Bit addressable)
The IC8051 microcontroller consists of 256 bytes of RAM memory which is divided into two
parts.
 128 bytes for general purpose
 128 bytes for special purpose registers
The RAM memory is used for general purpose which stores the data during the execution of the
program. The special function registers contain all the peripheral related registers like
Accumulator(A), ‘B’ register, Timers/Counters and interrupt related registers. The memory
location of RAM is divided into three areas include Banks, bit-addressable area and scratch-pad
area. The various general purpose registers of banks are R0-R7, and all these registers are byte-
addressable registers that store only single byte of data.

Accumulator (A)

It is an 8-bit addressable used for arithmetic operations. It is an essential register associated


with the ALU.It holds the result of arithmetic and logic operations.

B register

It is both a bit and byte-addressable register. It is used for multiply and divide operations. It can
also be used for general purpose operations.

Program Status Word (PSW) register

`
The flag register in the IC8051 is called the Program Status Word (PSW) register. It is an 8-bit
register. The four flags in IC8051 are Carry flag, Auxiliary Carry flag, Overflow flag, Parity flag.

Carry Flag

After the execution of arithmetic or logic operations, if there is a carry out of D 7th bit, this flag is
set. Otherwise, it is reset.

Auxiliary Carry Flag

This flag is set when there is a carry from digit D 3 to D4after performing arithmetic operations.
Otherwise, it is reset. It is used in BCD operations.

Parity Flag

After the execution of arithmetic or logic operations, if the accumulator contains odd number
of 1’s, then the parity flag will be set. If the accumulator contains even number of 1’s, then the
parity flag will be reset.

Overflow flag

This flag is set whenever the result of a signed number operation is too large, causing the high-
order bit to overflow into the sign bit. It is used to detect errors in signed arithmetic operations.

RS1 and RS0

These two bits RS1 and RSO in PSW register are used to select various memory locations
(Bank0 to Bank3) in the RAM memory location.

`
Stack Pointer (SP)

Stack is used to store the data temporarily in RAM locations. It is 8-bit register, indicates the
address of the top of the stack. The operation of stack is Last-In First-Out.

Program Counter (PC)

The PC in the 8051 is 16-bits wide. It tells the microcontroller where the next instruction to
execute is found in memory. When the IC8051 is initialized, PC usually starts at 0000h and is
incremented each time an instruction is executed.

I/O Ports
8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input or
output. Hence, total 32 input/output pins allow the microcontroller to be connected with the
peripheral devices. The I/O pins can be configured as 1 for input and 0 for output as per the
logic state.
Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e. the input has
unlimited input resistance and in-determined potential.
Output Configuration
When the pin is configured as an output, then it acts as an “open drain”. By applying logic 0
to a port bit, the appropriate pin will be connected to ground (0V), and applying logic 1, the
external output will keep on “floating”. In order to apply logic 1 (5V) on this output pin, it is
necessary to build an external pull-up resistor.
Port 0 
The P0 (zero) port is characterized by two functions.
 When the external memory is used then the lower address byte (addresses A0A7) is
applied on it, else all bits of this port are configured as input/output.
 When P0 port is configured as an output then other ports consisting of pins with built-in
pull-up resistor connected by its end to 5V power supply, the pins of this port have this
resistor left out.

`
Port 1
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but this port can be
configured as general I/O only. It has a built-in pull-up resistor and is completely compatible
with TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy addresses
intended for the external memory chip. This port can be used for higher address byte with
addresses A8-A15. When no memory is added then this port can be used as a general
input/output port similar to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be applied to
appropriate bit of the P3 register.

Programming of IC8051
The program is a sequence of instructions that are executed by the microcontroller in a
particular order to perform a predefined task. Programming also involves debugging and
troubleshooting of instructions and instruction sequence to make sure that the desired task is
performed.
Structure of the 8051 Microcontroller Assembly Language

Each line or statement of the assembly language program of 8051 Microcontroller consists of
four fields. The arrangement of these fields is shown below.
Addres Label Mnemonics Comments
s

Address
It is the first field in the program format. Each program should be entered with the address
location. The starting address is used during the execution of the program. The address is also
required for branch instructions. The program counter keeps track of the address of the program.

`
Label
The Label is programmer chosen name for a Memory Location or a statement in a program.
The Label part of the statement is optional and if present, the Label must be terminated with a
Colon (:)
Mnemonics
The Mnemonics is the main part of the 8051 Microcontroller Assembly Language
Programming as it is responsible for the task performed by the Microcontroller. Any Instruction
in the Assembly Language consists of two parts: Op-code and Operand(s).
The first part of the Instruction is the Op-code, which is short for Operation Code, specifies
the operation to be performed by the microcontroller. Op-codes in Assembly Language are called
as Mnemonics. 
Comments
The last part of the Structure of 8051 Assembly Language is the Comments. Comments are
statements included by the developer for easier understanding of the code and are used for proper
documentation of the Program. Comments are optional and if used, they must begin with a
semicolon (;) or double slash (//) depending on the Assembler.
Abbreviations used in IC8051 Instructions
Rn Register R7-R0 of the currently selected Register Bank
direct 8-bit internal data location’s address. This could be an Internal Data RAM location or a
Special Function Register [i.e., I/O port, control register, status register, etc.]
@Ri 8-bit internal data RAM location (0-255) addressed indirectly through register R 1or R0.
#data 8-bit constant included in instruction.
#data 16 16-bit constant included in instruction
addr 16 16-bit destination address. Used by LCALL and LJMP. A branch can be anywhere within the
64K byte Program Memory address space.
bit Direct Addressed bit in Internal Data RAM or Special Function Register.

The various types of 8051 instructions along with commands are listed below.
Data transfer instructions – MOV, MOVC, MOVX, PUSH, POP, XCH, XCHD
Arithmetic instructions – ADD, ADDC, SUBB, MUL, DIV, INC, DEC, DA A
Branching and Subroutines instructions– LJMP, LCALL, JZ, JNZ, JMP, NOP, RET, RETI
Instructions for Logical Instructions – ANL, ORL, XRL, CLR, CPL, RLC, RRC, SWAP
Instructions for Boolean Variable Instrutions – SETB, MOV, CLR, JB, JBC, ANL, ORL.
Special Purpose Instructions – MOVC, MOVX, SWAP, XCH, XCHD, JBC, RETI, DAA

`
General Format: MOV Rd, Rs – It copies the content of source register (R s) into the destination
register (Rd).
Examples: MOV A, R0 – It copies the contents of R0 into the Accumulator register.
ADD A, R7 – It add the contents of Accumulator and register R7 and stores the sum in the
Accumulator.
Applications of 8051 Microcontroller
The applications of IC8051 are:
 Industrial Process Control
 Communication Systems (Mobile Phones, Intercoms, Paging devices etc.)
 Consumer electronics (Remote Controls, Computers, TV Tuners, etc.)
 Medical Equipment

Graphics Processing Unit (GPU)

It is a processor designed to perform graphics operations. The purpose of GPU is to provide


3D graphics, which are comprised of polygons. GPUs are designed to perform floating point
operations. It is used to manage and increase the performance of video and graphics. GPU is
widely used in smart phones, workstations, display adapters etc. The GPU is connected to the
CPU and is completely separate from the motherboard. A GPU is a heterogeneous chip multi-
processor.

GPU is made to process and output both 2D and 3D computer graphics. GPU implements
the graphics pipeline consisting of:

 Vertex transformations
 Geometry processing
 Rasterizing polygons to pixels
 Processing the pixels
 Writing to the frame buffer

GPU have faster and more advanced memory interfaces. It enables to run high definition
graphics on Personal Computer. It works as both a programmable graphics processor and a

`
scalable parallel computing platform. GPUs are an essential part of chipsets equipped with
modern smartphones.

The first GPU was developed by NVidia in 1999 and called the GeForce 256. This GPU
model could process 10 million polygons per second and had more than 22 million transistors.
The GeForce 256 was a single-chip processor with integrated transform, lighting effects, triangle
setup/clipping and rendering engines. The GPU is connected to the CPU and is completely
separate from the motherboard. The random access memory (RAM) is connected through the
accelerated graphics port (AGP) or the peripheral component interconnect express (PCI-Express)
bus.

Floating Point Unit (FPU)

An FPU is a processor that performs floating point calculations. It supports the real, integer
and BCD integer data types. It greatly improves the efficiency of Intel Architecture processors in
handling the high precision floating point processing operations. It can be defined as a
specialized coprocessor that can manipulate data faster than the basic microprocessor. It is
difficult to implement in hardware and it can be part of the CPU since it can be implemented as a
micro-program within the CPU.

`
Chapter 4

IC8051 Interfacing

Interfacing of Digital I/O with IC8051

Interfacing can be defined as transmitting data between microcontrollers and peripherals


include keyboard, ADC, sensors, LCD displays, motors etc. It is essential to interface the
microcontroller with the I/O devices include keyboard, mouse, printer etc. The IC8051
microcontroller has four I/O ports each comprising 8-bits which can be configured as input or
output.

The ports are classified as two types.

 Serial Port
 Parallel Port

Serial Port

It requires single cable for data transmission. The 8051 has two signals for serial
communication which are TxD (Transmit Data) and RxD (Receive Data). The TXD line is pin
11 of the microcontroller (P3.1) while the RXD line is on pin 10 (P3.0). The 8051 includes an
on-chip serial port that can be programmed to operate in one of four different modes and at a
range of frequencies. In serial communication the data is rate is known as the baud rate, which
simply means the number of bits transmitted per second. The 8051 serial port is full duplex. In
other words, it can transmit and receive data at the same time.

The different types of Serial ports are

 Synchronous Serial Input


 Synchronous Serial Output
 Asynchronous Serial UART input
 Asynchronous Serial UART output

Parallel Port

It requires multiple wires through which the data bits are transmitted in parallel. The
parallel port was designed to be used with the printers. In the parallel I/O mode, devices can be

`
interfaced using two techniques: peripheral mapped I/O and memory-mapped I/O. In peripheral-
mapped I/O, a device is identified with an 8-bit address and enabled by I/O-related control
signals. In memory-mapped I/O, a device is identified with a 16-bit address and enabled by
memory-related control signals.

The various types of parallel ports are

 Parallel Port one bit Input


 Parallel Port one bit Output
 Parallel Port multi-bit Input
 Parallel Port multi-bit Output

DAC IC0808 Interfacing with IC8051

The Digital to Analog Converter (DAC) is used to interface the IC8051 with the external
devices to get the output in analog form. The output of DAC is analog signal which is used to
control the process.

Features of DAC IC0808

 8-bit DAC
 Fast settling time: 150 ns
 TTL and CMOS compatible
 Power Supply: 4.5 to 18 V (Positive or Negative)
 Low Power Consumption: 33 mW
 Accuracy: 0.19 (Positive or Negative)

Interfacing Diagram

Port 1 of IC8051 is connected to the data lines D7-D0 of Digital to Analog Converter (DAC)
IC0808. The output of DAC is connected to the inverting terminal of the operational amplifier
IC741. The analog output is generated from the 8-bit digital input.

`
Fig. 1 Interfacing DAC with IC8051 microcontroller

Interfacing Analog I/O with IC8051

Analog signals have infinite number of data like a sine wave. ADC converts analog data into
particular states, which can be measured in numbers as a physical quantity. It converts data in
periodical manner, which is known a sampling rate. The benefit of converting analog to digital is
that the noise can be eliminated from the original signal and digital signal can be represented
more accurately.

ADC IC0808

It is an 8-bit ADC. It has 8-channels IN0-IN7. It has three address lines which are represented by
A, B and C. These address lines are used to select the analog channels.

A B C Channel
0 0 0 IN0
0 0 1 IN1
0 1 0 IN2

`
0 1 1 IN3
1 0 0 IN4
1 0 1 IN5
1 1 0 IN6
1 1 1 IN7

The ADC IC0808 has three control signals which are

 SOC (Start of Conversion) – When this signal goes from High to Low state, ADC
initiates conversion of analog to digital.
 EOC (End of Conversion) – ADC sends this High EOC signal to Microcontroller to
indicate conversion is completed.
 OE (Output Enable) – When it is High, the output latch of ADC get enables and the
converted data is then available to microcontroller.

The reference voltage determines the range of analog input voltage. 

Features of ADC 0808 

 8-analog channels with multiplexer


 0 to 5V input voltage range with a single polarity 5V supply
 High speed
 Low conversion time (100 micro-second)
 8-bit resolution
 Low power consumption (less than 15mW)

Interfacing Diagram

The analog input signal from sensors is read through one of eight input channels by using
three selection lines A, B and C. Port 2 in IC8051 is used to select the channel, initiates start of
conversion and to receive the end of conversion signal. Once the end of conversion signal is
enabled, then the IC8051 reads 8-bit data using Port 1 through data bus.

`
Fig. 2 Interfacing Analog I/O with IC8051 Microcontroller

Display

Interfacing Seven-Segment Display with IC8051

A seven-segment display device is an electronic device used to display digital data and it is
made up of seven LED (Light Emitting Diode) segments. The seven segments are represented as
A, B, C, D, E, F and G. The common signal is grounded. DP denotes decimal point.

LED is made up of PN junction in which the current conduction takes place only in forward
bias. The current doesn’t flow in reverse bias. Each LED has two pins which are anode and
cathode. Anode is a positive terminal and the cathode is the negative terminal. Seven segment
displays is used to display numbers 0 to 9. The seven LEDs are used to form the seven segments
and a dot point. It is used in variety of devices include clocks, weight lift, home appliances,
traffic light control etc.

`
Fig. 3 Seven Segment Display

The seven segment displays are connected either in common cathode or common anode.
Depending upon the decimal digit to be displayed, the particular set of LEDs is forward biased.
For instance, to display the numerical digit 0, we will need to light up six of the LED segments
corresponding to A, B, C, D, E and F.

Common Anode

In this type, all the anode terminals are made to common and tied to Vcc (5v). The segments A
to G require a logic LOW signal (GND) in order to glow.

Fig. 4 Common Anode Connection

Common Cathode

In this type, all the cathode terminals are made common and tied to GND. The
segments A to G require a logic High signal (5v) in order to glow. 

`
Fig. 5 Common Cathode Connection

Fig. shows the interfacing seven segment display with IC8051. Port 1 of IC8051 is connected
to the seven segment and a decimal point.

Fig. 6 Interfacing Seven Segment display with IC8051 Microcontroller

`
Chapter 5
Programmable Logic Controller

Introduction to PLC (Programmable Logic Controller)


Programmable Logic Controllers were discovered by the automotive industry to substitute
the re-wiring of the machine’s control panel. Before the invention of PLC, automobiles were
manufactured using plenty of relays, cam timers, and closed loop controllers. The electricians
had to re-wire every part of the machine daily which was time consuming and highly expensive
on the financial front.
 In the year 1968, a request for an electronic device for the hard-wired relay systems was made
by GM hydramatic. Dick Morley worked on this project and is being considered as the Father of
PLC. In the year 1977, the brand invented by Modicon was sold to Gould Electronics.

PLC stands for Programmable Logic Controller. It is introduced in the late 1960’s. It is a
specialized computer used to control the industrial processes. It is developed to replace hard
wired logic relays at a large scale. It performs many functions, providing an interface between
analog and digital input and output.

A PLC interfaces numerous types of external electrical and electronic signals. These
signals can be AC or DC currents or voltages. Typically, they range from 4 to 20 milli-amperes
(mA) or 0 to 120VAC, and 0 to 48VDC. These signals are referred to as I/O (input/output)
points. 

Hard Wired Control

The variety of control tasks were performed by contactors, relays and other
electromechanical devices prior to PLCs. This is referred to as hard-wired control.

Basic Operation of PLC

The functions of a PLC input circuit are to convert the input signals provided by sensors and
switches into logic signals that can be used by the CPU. The program instructions are written
onto the programming device through mnemonics and stored in the user memory. The CPU
fetches these instructions from the memory and executes the input signals by manipulating,
computing, processing them to control the output.

Block Diagram of PLC

`
Fig. 1 Block Diagram of PLC
The block diagram of PLC includes

 Central Processing Unit (CPU)


 Programming device
 Input and Output module

Central Processing Unit (CPU)

It is the heart of the PLC system. It reads input data from various sensing devices, executes the
user program from the memory and sends appropriate output commands to control devices. A
DC power source is required to produce the low-level voltage used by the processor and I/O
modules.

Programming Device

The control logic or the program is written using the programming device. The data is entered
into the PLC processor through the keyboard. The methods of programming in PLC are Ladder
diagram, Instruction list and block diagram.

Input and Output Module

It is used to interface the input devices with the processor and to interface the processor with
the output devices. The I/O module provides the isolation between processor and I/O devices.

`
Input module
The input module has two functions: reception of an external signal and status display of that
input point. The input to an input module is in either a discrete or analog form. If the input is an
ON-OFF type, such as with a push button or limit switch, the signal is considered to be of a
discrete nature. If, on the other hand, the input varies, such as with temperature, pressure, or
level, the signal is analog in nature.
Peripheral devices sending signals to input modules that describe external conditions can be
switches (limit, proximity, pressure, or temperature), push buttons, or logic, binary coded
decimal (BCD) or analog-to-digital (A/D) circuits. These input signal points are scanned, and
their status is communicated through the interface module or circuitry within each individual
PLC and I/O base.
The various input modules of PLC are:
 DC voltage (110, 220, 14, 24, 48, 15-30V) or current (4-20 mA).
 AC voltage (110, 240, 24, 48V) or current (4-20 mA).
 Analog input (12-bit).
 Thermocouple input.
 Resistance temperature detector.
 PID (proportional, integral, differentiation) input.
Output module
The output module transmits discrete or analog signals to activate various devices such as
hydraulic actuators, solenoids, motor starters, and displays the status (through the use of LEDs)
of the connected output points. Signal conditioning, termination, and isolation are also part of the
output module's functions. The output module is treated in the same manner as the input module
by the processor.
The various output modules of PLC include:
 DC voltage (24, 48,110V) or current (4-20 mA).
 AC voltage (110, 240v) or current (4-20 mA).
 Isolated (24V DC).
 Analog output (12-bit).

Memory

`
The memory is divided into two types which are data memory and program memory. The
program information or the control logic is stored in the user memory or the program memory
from where the CPU fetches the program instructions.

The memory section stores retrievable digital information in three dedicated locations of the
memory. These memory locations are routinely scanned by the processor. The memory will
receive ("write" mode) digital information or have digital information accessed ("read" mode) by
the processor. This read/write (R/W) capability provides an easy way to make program changes.

Power Supply

The Power Supply section gets its input power from an external 120V AC or 240V AC source
line voltage. This line voltage is then stepped-down, rectified, filtered, regulated, voltage- and
current-protected, and status-monitored, with status indication displayed.

System Busses
The internal paths along which the digital signals flow within the PLC are called busses.
The system has four busses:

The CPU uses the data bus for sending data between the different elements
 The address bus to send the addresses of locations for accessing stored data
 The control bus for signals relating to internal control actions
 The system bus is used for communications between the I/O ports and the I/O
unit.

Input Devices

It is the computer hardware equipment used to provide data, and control signals to an
information processing system. The various input devices are

 Switches and Push buttons


 Sensing devices
 Proximity sensors
 Photoelectric sensors
 Temperature switches

Output Devices

`
It is hardware equipment used to communicate the processor output into an understandable
form. The various output devices are

 Valves
 Motors
 Pumps

PLC Programming
A CPU of the PLC executes two different programs:
 The Operating System
 The User Program
The Operating System
The operating system organizes all the functions, operations and sequences of the CPU that are
not associated with a control task. The OS tasks include
 Handling a hot restart and warm restart
 Updating and outputting the process image tables of input and outputs
 Executing the user program
 Detecting and calling the interrupts
 Managing the memory areas
 Establishing communication with programmable devices
The User Program
It is a combination of various functions which are required to process an automated task. This
must be created by the users and need to be downloaded to the CPU of the PLC. Some of the
tasks of the user program include:
 Initiating all the conditions for starting the specified task
 Reading and evaluating all binary and analog input signals
 Specifying output signals to all binary and analog output signals
 Executing interrupts and handling errors
In present industrial automation sector, there are several leading PLC manufactures that develop
typical PLC’s ranging from small to high-end PLC’s. Each and every PLC manufacturer has its
own dedicated software to program and configure the PLC hardware. But the PLC programming
language is varied depending on the manufacturers. Some manufacturers have common

`
programming languages and some others have dissimilar. Some of the standard programming
languages of PLC are basically of two types, which are further sub-divided into several types,
which are as follows:
1. Textual language
 Instructions List (IL)
 Structured Text (ST)
2. Graphical language
 Ladder Diagrams (LD)
 Function Block Diagram (FBD)
 Sequential Function Chart (SFC)
Compared with text based languages, graphical languages are preferred by many users to
program a PLC due to their simple and convenient programming features. All the necessary
functions and functional blocks are available in the standard library of each PLC software. These
function blocks include timers, counters, strings, comparators, numeric, arithmetic, bit-shift,
calling functions, and so on.
• Ladder Diagrams (LD) PLC Programming
Among several programming languages ladder logic
diagram is the most basic and simplest form of
programming the PLC. Before going to program the PLC
with this language, one should know some basic
information about it. The below figure shows the
hardwired-ladder diagram wherein the same lamp load is
controlled by two push button switches, In case if any one Figure 1 Ladder Logic PLC Programming

of the switches gets closed, the lamp glows. Here two


horizontal lines are called rungs which are connected between two vertical lines called rails.
Each rung establishes the electrical continuity between positive (L) and negative rails (N) so that
the current flows from the input to output devices. 

Advantages of PLC

 Rugged and designed to withstand vibrations, temperature, noise and humidity


 Faster response
 Better reliability

`
 Handles complicated systems
 Smaller physical size than hard-wire solutions
 Interface for Input and Output readily available

Disadvantages of PLC

 Requires skilled engineers to detect the errors


 Designed by semi-conductors, which are depends on thermal characteristics

Chapter 6
PID Controller

Introduction

PID stands for Proportional Integral Derivative Controller. It is a feedback control mechanism
used in control system. PID controller maintains the output such that there is zero error between
process variable and set point by closed loop operations.

Block Diagram of Open Loop Control System

`
An open-loop control system takes input under consideration and doesn’t react on the
feedback to obtain the output. An open loop control system works on fixed operation conditions
and there are no disturbances. The structure of open loop control system is easy to construct and
implement.

Fig.1 Block Diagram of Open Loop Control System

Examples of Open Loop Control System


 Electric Hand Drier - Hot air (output) comes out as long as you keep your hand under
the machine, irrespective of how much your hand is dried.
 Automatic Washing Machine - This machine runs according to the pre-set time
irrespective of washing is completed or not.
 Bread Toaster - This machine runs as per adjusted time irrespective of toasting is
completed or not.
Advantages of Open Loop Control System
 Simple in construction and design.
 Economical.
 Easy to maintain.
Disadvantages of Open Loop Control System
 They are inaccurate.
 They are unreliable.
 Any change in output cannot be corrected automatically.

Block Diagram of Closed Loop Control System

Fig.1 shows the block diagram of closed loop control system. The output is given feedback to
the input for correction. The closed loop control systems are complex in design and very
expensive. It produces accurate output.

`
Fig. 2 Block Diagram of Closed Loop Control System
The tuning of PID controller is based on the error signal which is the difference between the
setpoint and process variable. The output of PID controller is given to the process in order to
maintain the steady state. The process output is measured by suitable sensor which is feedback to
the input to generate the error signal. The disturbance enters the process which is to be measured
and eliminated.

Examples of Closed Loop Control System


 Water Level Controller - Input water is controlled by water level of the reservoir.
 Missile Launched and Auto Tracked by Radar - The direction of missile is controlled
by comparing the target and position of the missile.
 An Air Conditioner - An air conditioner functions depending upon the temperature of
the room.
Advantages of Closed Loop Control System
 Closed loop control systems are more accurate even in the presence of non-linearity.
 Highly accurate as any error arising is corrected due to presence of feedback signal.
 The sensitivity of system may be made small to make system more stable.
Disadvantages of Closed Loop Control System
 They are complicated to design.
 Feedback leads to oscillatory response.
 Stability is the major problem and more care is needed to design a stable closed loop
system.

`
Proportional Controller
The output of the proportional controller is the product of gain and measured error. It is the
most common of all industrial process control action. It calculates the difference between the
process variable signal and the set point signal, which is called as an error. It provides an
immediate reaction to a change in the process variable. The higher gain value of proportional
control causes repeatedly overshoot the setpoint, leading to oscillation.
If the error is high, then the controller output is also high. As the error is zero, it produces
zero output. In proportional control, the correction factor is determined by the size of the
difference between set point and the measured value. It provides stable operation but always
maintains the steady state error.  When the proportional constant increases, the speed of response
is increased. It can be used to obtain fast response systems with a large transmission coefficient.
A high proportional gain results in a large change in the output for a given change in the error. A
small gain results in a small output response to a large input error, and a less responsive or less
sensitive controller.
Proportional band is the percentage change in the process variable needed to cause a 100 percent
change in controller output.

The output of the proportional controller is given by

CO=K p∗e+ Bias

Where KP – Proportional gain, e – Error

Bias is the 50% of the controller output.

Advantages of Proportional Controller

 It reduces rise time


 It reduces peak error

Disadvantages of Proportional Controller

 It produces steady state error


 It increases the maximum overshoot of the system

Integral Controller

`
It overcomes the drawback of proportional controller. It is the process of accumulating the
process variable value as the time progress. Integral action decides how fast to move the output.It
eliminates the steady state error by the process of integration. It integrates the error over a period
of time until error value reaches to zero. When the negative error occurs, the output of the
integral control will decrease. It limits the speed of response and affects stability of the system.
By reducing the integral gain, the speed of the response can be increased. The controller output
depends on the integral of error signal over time. It doesn’t be used alone, but mostly it is used
along with proportional control. If there is any deviation between set point and process variable,
an addition corrective signal is supplied by the integral control mode function till steady state
error becomes zero.

The output of the integral controller is given by

CO=K p ( T1 ∫ e dt )+ Bias
i

where Ti – Integral time

Advantages of Integral Controller

 It eliminates offset
 It reduces integrated error

Disadvantages of Integral Controller

 It produces overshoot
 It has integral wind-up problem

Derivative Controller

Integral controller does not have the capability to predict the future behavior of error.
Derivative controller overcomes this problem be anticipating future behavior of the error. It
provides an output which is proportional to the rate of change of the error with respect to time. It
is used to prevent overshoot and undershoot of the setpoint and to restore the process value
rapidly to the setpoint.

`
It is also called as anticipatory controller because it moves the control valve in such a direction
as to counteract the rapid change of process variable. The output of derivative action is the
product of derivative constant and the rate of change of error with respect to time. It must not be
used alone because of rapid start of control output that can result extremely large rate of change
of output, even for a small error change. It is used along with proportional plus integral control
or with only proportional control. 

Advantages

 It improves the transient response of the system


 It makes the loop more stable
 It reduces rise time
 It reduces peak error
 It is used to make the control action faster
 Output is proportional to rate of change of deviation

6.6.2 Disadvantages

 It amplifies the noise

Proportional Integral Controller

It eliminates the offset and produces quick response. PI controller can be used to avoid large
disturbances and noise presents during operation process. Whereas PID controller can be used It
is widely used in process industries for controlling parameters like pressure, level, flow etc. The
drawback of PI controller is it produces slow response to disturbance.

The PI controller output is given by

1
(
CO=K p e+
Ti ∫ )
e dt + Bias

Where Ti - Integral time

Advantages

 It eliminates the steady state error

Disadvantages

`
 It doesn’t predict the future error
 It increases the overshoot
 Slow response

Proportional Derivative Controller

It is a combination of proportional and a derivative controller. The output is equals to the


summation of proportional and derivative of the error signal. It is effective for systems having
large number of time constants. The output of the PD controller is

de
CO=K p∗e+ K d + Bias
dt

Where Kd – Derivative gain

Proportional Integral Derivative Controller

A PID controller removes steady-state error and decreases settling time while


maintaining a reasonable transient response. PID control is combined with logic, sequential
functions, selectors, and simple function blocks to build the complicated automation systems
used for energy production, transportation, and manufacturing applications.

The output of the PID controller output is given by

de
CO=K p∗e+ K i∫ e dt+ K d + Bias
dt

Where Kp – Proportional gain


Ki – Integral gain
Kd – Derivative gain
e – Error signal

Advantages
 It produces fast response
 It eliminates steady state error
 It decreases the overshoot
Disadvantages
 It is difficult to tune proportional, integral and derivative gains for a particular process

`
Response Curve of PID Controller

NPTEL Notes Link

http://nptel.ac.in/courses/117104072/

http://nptel.ac.in/courses/Webcourse-contents/IIT
KANPUR/microcontrollers/micro/ui/Course_home1_1.htm

`
Additional reading

1.1.5 Classification of Microprocessors


A microprocessor can be classified into three categories which are:
 RISC processors
 CISC processors
 Special processors

1.1.6 RISC Processor


RISC stands for Reduced Instruction Set Computer. It is designed to reduce the execution time
by simplifying the instruction set of the computer. Using RISC processors, each instruction
requires only one clock cycle to execute results in uniform execution time. This reduces the
efficiency as there are more lines of code, hence more RAM is needed to store the instructions.
The compiler also has to work more to convert high-level language instructions into machine
code.
Some of the RISC processors are:
 Power PC: 601, 604, 615, 620

`
 DEC Alpha: 210642, 211066, 21068, 21164
 MIPS: TS (R10000) RISC Processor
 PA-RISC: HP 7100LC
1.1.7Characteristics of RISC
The major characteristics of a RISC processor are as follows.
 It consists of simple instructions.
 It supports various data-type formats.
 It utilizes simple addressing modes and fixed length instructions for pipelining.
 It supports register to use in any context.
 One cycle execution time.
 “LOAD” and “STORE” instructions are used to access the memory location.
 It consists of larger number of registers.
 It consists of less number of transistors.
1.1.8 CISC Processor
CISC stands for Complex Instruction Set Computer. It is designed to minimize the number of
instructions per program, ignoring the number of cycles per instruction. The emphasis is on
building complex instructions directly into the hardware.
The compiler has to do very little work to translate a high-level language into assembly level
language/machine code because the length of the code is relatively short, so very little RAM is
required to store the instructions.
Some of the CISC Processors are −
 IBM 370/168
 VAX 11/780
 Intel 80486
1.1.9Characteristics of CISC
 Variety of addressing modes.
 Larger number of instructions.
 Variable length of instruction formats.
 Several cycles may be required to execute one instruction.
 Instruction-decoding logic is complex.
 One instruction is required to support multiple addressing modes.

`
1.1.10 Special Processors
These are the processors which are designed for some special purposes. Few of the special
processors are given below.
1.1.11 Coprocessor
A coprocessor is a specially designed microprocessor, which can handle its particular function
many times faster than the ordinary microprocessor.
Example:
Math Coprocessor.
Some Intel math-coprocessors are −
 8087-used with 8086
 80287-used with 80286
 80387-used with 80386
1.1.12Input/Output Processor
It is a specially designed microprocessor having a local memory of its own, which is used to
control I/O devices with minimum CPU involvement.
Example:
 DMA (direct Memory Access) controller
 Keyboard/mouse controller
 Graphic display controller
 SCSI port controller
1.1.13DSP (Digital Signal Processor)
This processor is specially designed to process the analog signals into a digital form. This is
done by sampling the voltage level at regular time intervals and converting the voltage at that
instant into a digital form. This process is performed by a circuit called an analogue to digital
converter, A to D converter or ADC.
A DSP contains the following components.
 Program Memory − It stores the programs that DSP will use to process data.
 Data Memory − It stores the information to be processed.
 Compute Engine − It performs the mathematical processing, accessing the program from
the program memory and the data from the data memory.
 Input/Output − It connects to the outside world.

`
The applications of DSP are
 Sound and music synthesis
 Audio and video compression
 Video signal processing
 2D and 3d graphics acceleration.
Example:
Texas Instrument’s TMS 320 series, e.g., TMS 320C40, TMS320C50.

Instruction Set of IC8051

8051 instructions are classified into following groups

 Data transfer instructions


 Arithmetic instructions
 Logical instructions
 Boolean variable manipulation instructions
 Branch instructions

Abbreviations of Instruction set

Rn Register R7-R0 of the currently selected Register Bank


direct 8-bit internal data location’s address. This could be an Internal Data RAM
location or a Special Function Register [i.e., I/O port, control register, status
register, etc.]
@Ri 8-bit internal data RAM location (0-255) addressed indirectly through register
R1or R0.
#data 8-bit constant included in instruction.
#data 16 16-bit constant included in instruction
addr 16 16-bit destination address. Used by LCALL and LJMP. A branch can be
anywhere within the 64K byte Program Memory address space.
addr 11 11-bit destination address. Used by ACALL and AJMP. The branch will be
within the same 2K byte page of program memory as the first byte of the
following instruction.
rel Signed (two’s complement) 8-bit offset byte. Used by SJMP and all conditional
jumps. Range is -128 to +127 bytes relative to first byte of the following
instruction.

`
bit Direct Addressed bit in Internal Data RAM or Special Function Register.

IC8051 Pin Diagram

The IC8051 is a 40-pin IC available in Dual-In line package (DIP). It requires a single +5V
power supply. The maximum internal clock frequency is 12 MHz.

`
`
Fig. 1 Pin Diagram of IC8051

PLC Installation & Commissioning


Typical installation
 Typical installation (enclosure, disconnect device, fused isolation transformer, master
control relay, terminal blocks and wiring ducts, suppression devices).
 Spacing controllers – follow the recommended minimum spacing to allow the convection
cooling.
 Preventing excessive heat (0–60?) C
 Grounding guidelines.
 Power considerations.
 Safety considerations.
 Preventive maintenance considerations.
Commissioning and testing of a PLC system
 Checking that all cable connections between the PLC and the plant are complete, safe,
and to the required specification and meeting local standards.
 Checking that all the incoming power supply matches the voltage setting for which the
PLC is set.
 Checking that all protective devices are set to their appropriate trip settings.
 Checking that emergency stop button work.
 Checking that all input/output devices are connected to the correct input/output points
and giving the correct signals.
 Loading and testing the software.
Testing inputs and outputs
Input devices can be manipulated to give the open and closed contact conditions and the
corresponding LED on the input module observed. Forcing also can be used to test inputs and
outputs. This involves software, rather than mechanical switching on or off, being used with
instructions to turn off or on inputs/outputs.
Testing Software
Most PLCs contain some software checking program. This checks through the installed
program and provides a list on a screen or as printout with any errors detected.

`
PID Tuning Method
The determination of corresponding PID parameter values for getting the optimum
performance from the process is called tuning. This is obviously a crucial part in case of all
closed loop control systems. There are number of tuning methods have been introduced to obtain
fast and acceptable performance.
The steps involved in these methods include experimental determination of the dynamic
characteristics of the control loop and estimating the controller tuning parameters that produce a
desired performance for the dynamic characteristics determined. The various tuning methods are
discussed below.
Trial and Error Method
This is the simple method of tuning a PID controller. Once we get the clear understanding of
PID parameters, the trial and error method become relatively easy.
 Set integral and derivative terms to zero first and then increase the proportional gain until
the output of the control loop oscillates at a constant rate. This increase of proportional
gain should be in such that response the system becomes faster provided it should not
make system unstable.
 Once the P-response is fast enough, set the integral term, so that the oscillations will be
gradually reduced. Change this I-value until the steady state error is reduced, but it may
increase overshoot.
 Once P and I parameters have been set to a desired values with minimal steady state
error, increase the derivative gain until the system reacts quickly to its set point. Increasing
derivative term decreases the overshoot of the controller response.
Zeigler-Nichols Method
It is another popular method for tuning PID controllers. Ziegler and Nichols presented two
classical methods for determining values of proportional gain, integral time and derivative time
based on transient response characteristics of a given plant or system.
First Method
 Obtain a unit step response of the plant experimentally and it may look‘s’ shaped curve
as shown in figure below. This method applies, if obtained response exhibit s-shaped curve
for unit step input otherwise it cannot be applied. 
 Obtain two constants, delay time L and time constant T by drawing a tangent line at the
inflection point of the s-shaped curve.

`
 Set the parameters of Kp, Ti, and Td values from the table given below for three types of
controllers.

Second Method
 It is very similar to the trial and error method where integral and derivative terms are set
to the zero, i.e., making Ti infinity and Td zero.
 Increase the proportional gain such that the output exhibits sustained oscillations. If the
system does not produce sustained oscillations then this method cannot be applied. The
gain at which sustained oscillations produced is called as critical gain.

 Once the sustain oscillations are produced, set the values of Ti and Td as per the given
table for P, PI and PID controllers based on critical gain and critical period.

`
Internal Model Control (IMC)

• A more comprehensive model-based design method, Internal Model Control (IMC), was
developed by Morari and coworkers (Garcia and Morari, 1982; Rivera et al., 1986).

• The IMC method, like the DS method, is based on an assumed process model and leads
to analytical expressions for the controller settings.

• These two design methods are closely related and produce identical controllers if the
design parameters are specified in a consistent manner.

`
• The model response is subtracted from the actual response Y, and the difference, is used
as the input signal to the IMC controller.
• In general, due to modeling errors and unknown disturbances that is not accounted for in
the model.
• The IMC method can be used to derive PID controller settings for a variety of transfer
function models.
Tuning Relations Based on Integral Error Criteria

• Controller tuning relations have been developed that optimize the closed-loop response
for a simple process model and a specified disturbance or set-point change.

• The optimum settings minimize an integral error criterion.

The three popular integral error criteria are:

 Integral of the absolute value of the error (IAE)


 Integral of the squared error (ISE)
 Integral of the time-weighted absolute error (ITAE)

Integral of the Absolute value


∞ of the Error (IAE)
IAE=∫|e(t )|dt
0
where the error signal e(t) is the difference between the set point and the measurement.

Integral of Square Error (ISE)



2
ISE=∫ [ e(t ) ] dt
0
Integral of the time weighted absolute error (ITAE)

ITAE=∫ t|e(t )|dt
0

You might also like