LECTURE
3
INTRODUCTION
TO MICRO-PROCESSORS AND MICRO-CONTROLLERS
1. Introduction
Programmable Logic Devices
(PLD) are programmable systems and are generally used in manufacturing automation
to perform different control functions, according to the programs written in
its memory, using low level languages of commands. There are following three
types of PLDs are being employed in mechatronics
systems.
•
Microprocessor
It is a digital integrated circuit which carries out necessary digital functions to
process the information obtained from measurement system.
•
Microcomputer
It uses microprocessor as its
central processing unit and contains all functions of a computer.
•
Programmable Logic Controller (PLC)
It is used to control the
operations of electro-mechanical devices especially in tough and hazardous industrial environments.
A typical programmable machine has basic three components as shown in Figure 3.
1:
•
Processor, which processes the
information collected from measurement system and takes logical decisions based
on the information. Then it sends this information to actuators or output
devices.
•
Memory, it stores the input data
collected from sensors the programs to process the information and to take
necessary decisions or actions. Program is a set of instructions written for
the processor to perform a task. A group of programs is
called software.
•
Input/output devices: these are used to communicate with the outside world/operator.
Figure 3.1
Components of a programmable logic device
2. Microprocessor
It is a multi-purpose, programmable device that reads binary
instructions from a storage device called memory, processes the data according
to the instructions, and then provides results as output. In common practice it
is also known as CPU (central processing unit). CPU can be referred as complete
computational engine on a single chip. First Microcontroller, Intel 4004 was
launched in 1971. It was able to process just 4 bits. It started a new era in
electronics engineering. Microprocessor chip was one of the important
inventions of the 20th century. Table 3.1.1 shows the history of
micro-processors.
Table 3. 1
History of Micro-Processors
Name |
Date |
No. of |
Width of |
Clock |
Data |
Millions of |
|
|
Transistors |
smallest |
Speed |
Width |
Instructions |
|
|
|
wire on |
|
(In Bits) |
per |
|
|
|
chip |
|
|
second(MIPS) |
|
|
|
|
|
|
|
8080 |
1974 |
6000 |
6 |
2MHz |
8 |
0.64 |
8088 |
1979 |
29000 |
3 |
5 MHz |
16 |
0.33 |
80286 |
1982 |
134000 |
1.5 |
6MHz |
16 |
1 |
80386 |
1985 |
275000 |
1.5 |
16 |
32 |
5 |
80486 |
1989 |
1200000 |
1 |
25 |
32 |
20 |
Pentium |
1993 |
3100000 |
0.8 |
60 |
32 |
100 |
Pentium |
1997 |
7500000 |
0.35 |
233 |
32 |
300 |
II |
|
|
|
|
|
|
|
|
|
|
|
|
|
Pentium |
1999 |
9500000 |
0.25 |
450 |
32 |
510 |
III |
|
|
|
|
|
|
|
|
|
|
|
|
|
Pentium 4 |
2000 |
42000000 |
0.18 |
1.5 GHz |
32 |
1700 |
Pentium |
2004 |
125000000 |
0.09 |
3.6 GHz |
32 |
7000 |
4P |
|
|
|
|
|
|
|
|
|
|
|
|
|
Applications of
microprocessors are classified primarily in two categories:
•
Reprogrammable Systems : Micro computers
•
Embedded Systems : photocopying machine, Digital camera
Microprocessor works
or operates in binary digits i.e. 0 and 1, bits. These bits are nothing but
electrical voltages in the machine, generally 0 - low voltage level, and 1 -
high voltage level. A group of bits form a ‘word’. In general, the word length
is about 8 bits. This is called as a ‘byte’. A word with a length of 4 bits is
called as a ‘Nibble’
Microprocessor
processes the ‘commands in binary form’ to accomplish a task. These are called
as ‘instructions’. Instructions are
generally entered through input devices and can be stored in a storage device
called memory.
Figure 3.2 Schematic of configuration of a micro
processor
Figure 3.2 and 3.3
show the configuration and basic blocks of a microprocessor.
The functions of each
element are as follows.
Figure 3. 3 Working of a microprocessor
1. ALU: ALU stands
for Arithmetical Logical Unit. As name indicates it has two parts:
a.
Arithmetical unit which is responsible for mathematical operations
like addition, subtraction, multiplication and division,
b.
Logical unit which is dedicated to take logical
decisions like greater than, less than, equal to, not equal to etc. (Basically
AND/OR/NOT Operations)
2. Register Array: Registers are
small storage devices that are available to CPU or processors. They act as temporary storage for processing of
intermediate data by mathematical or logical operations.
3. Control: This part of CPU
is dedicated to coordinate data flow and signal flow through various types of buses i.e. Data Bus, Control Bus, and
Address Bus etc. It directs data flow between CPU and storage and I/O devices.
4. Memory: There are two
different types of memory segments being used by the CPU. First is the ROM which stands for Read Only Memory while
other is R/W which stands for Read and Write Memory or Random Access Memory
(RAM).
a.
ROM: From this memory unit, CPU can only read the stored data. No
writing operations can be done in
this part of memory. Thus it is used to store the programs that need no
alteration or changes like Monitor Program or Keyboard driver etc.
b.
R/W: As name indicates it is opposite to ROM and used for both
reading and writing operations. In
general User’s program and instruction are stored in this segment of memory
unit.
5. Input Devices: Input devices
are used to enter input data to microprocessor from Keyboard or from ADC which receives data from sensors/signal
conditioning systems.
6. Output Devices: These devices
display the results/conclusions coming out from ALUs either in soft copy (Monitor) or in Hard Copy (Printer).
2.1 Functions of microprocessor
Various
functions of microprocessor are as follows:
•
Microprocessor performs a variety of logical and mathematical
operations using its ALU.
•
It controls data flow in a system and hence can transfer data
from one location to another based on the instructions given to it.
•
A microprocessor can take necessary decisions and jump to a new
set of instructions based on those decisions.
2.2 Elements of microprocessor
A simple microprocessor
consists of following basic elements (see Figure 3.1.3):
•
Data Bus: Through data bus, the data flow between
a.
various storage units
b.
ALU and memory units
•
Address Bus: It controls the flow of memory addresses between
ALU and memory unit.
•
RD (read) and WR (write) lines set or obtain the addressed
locations in the memory.
•
Clock line transfers the clock pulse sequence to the processor.
•
Reset Line is used to restart execution and reset the processor
to zero.
•
Address Latch is a register which stores the addresses in the
memory.
•
Program Counter: It is a register which can increment its value
by 1 and keeps the record of number of instructions executed. It can be set to
zero when instructed.
•
Test Register: It is a register which stores intermediate or
in-process data of ALU operations. For example it is required to hold the
‘carry’ while ALU is performing ‘addition’ operation. It also stores the data
which can be accessed by Instruction decoder to make any decision.
•
3-State Buffers: These are tri-state buffers. A tri-state buffer
can go to a third state in addition to the states of 1 and 0.
•
The instruction register and instruction decoder are responsible
for controlling the operations of all other components of a microprocessor.
There are
following control lines present in a microprocessor, which are used to
communicate instructions and data with the instruction decoder.
•
Instruct the A register to latch the value currently on the data
bus.
•
Instruct the B register to latch the value currently on the data
bus.
•
Instruct the C register to latch the value currently output by
the ALU.
•
Instruct the program counter register to latch the value currently
on the data bus.
•
Instruct the address register to latch the value currently on
the data bus.
•
Instruct the instruction register to latch the value currently
on the data bus.
•
Instruct the program counter to increment.
•
Instruct the program counter to reset to zero.
•
Activate any of the six tri-state buffers (six separate lines).
•
Instruct the ALU what operation to perform.
•
Instruct the test register to latch the ALU's test bits.
•
Activate the RD line.
•
Activate the WR line
2.
Microcomputer
Microcomputer is
a microprocessor based system. It is a data processing system that employs a
microprocessor as its central unit. Based on the input it takes decisions.
These decisions are further used to control a system or to actuate an action or
operation.
3.1 Microprocessor based
programmable controller
Figure 3.4 Schematic of microcontroller.
It is a
microprocessor-based system. It implements the functions of a computer and a
controller on a single chip. Generally microcontroller is programmed for one specific
application and it is dedicated to a specific control function.
Microcontrollers find applications in automobiles, aircraft, medical
electronics and home appliances. They are small in size and can be embedded in
an electromechanical system without taking up much space.