Microcontroller Assignment
Microcontroller Assignment
A microprocessor is a single chip of silicon that performs all of the essential functions of a
computer central processor unit (CPU) on a single silicon chip. Microprocessors are found in a
huge variety of applications including engine management systems, environmental control
systems, domestic appliances, video games, fax machines, photocopiers, etc.
The CPU performs three functions: it controls the system’s operation; it performs algebraic and
logical operations; and it stores information (or data) whilst it is processing. The CPU works in
conjunction with other chips, notably those that provide random access memory (RAM), read-
only memory (ROM), and input/output (I/O).
The first microprocessor systems were developed in the early 1970’s. These were simple and
crude by today’s standards but they found an immediate application in the automotive industry
where they were deployed in engine management and automatic braking systems. Today,
microprocessor systems are found in a huge variety of applications from personal computers to
washing machines!
The block diagram of a typical microprocessor system is shown below. To find out what each
feature does just move your mouse pointer over it!
The central processing unit (CPU) is generally the microprocessor chip itself. This device
contains the following main units:
storage locations (called registers) that can be used to hold instructions, data, and
addresses during processing
an arithmetic logic unit (ALU) that is able to perform a variety of arithmetic and logical
function (such as comparing two numbers)
a control unit which accepts and generates external control signals (such as read and
write) and provides timing signals for the entire system.
Microcontrollers are used in a wide array of systems and devices. Devices often utilize multiple
microcontrollers that work together within the device to handle their respective tasks.
For example, a car might have many microcontrollers that control various individual systems
within, such as the anti-lock braking system, traction control, fuel injection or suspension
control. All the microcontrollers communicate with each other to inform the correct actions.
Some might communicate with a more complex central computer within the car, and others
might only communicate with other microcontrollers. They send and receive data using their I/O
peripherals and process that data to perform their designated tasks.
Central Processor Unit (CPU)
As we know that the CPU is the brain of any processing device of the microcontroller. It
monitors and controls all operations that are performed on the Microcontroller units. The User
has no control over the work of the CPU directly. It reads program written in ROM memory and
executes them and do the expected task of that application.
Interrupts
As its name suggests, Interrupt is a subroutine call that interrupts of the microcontrollers main
operations or work and causes it to execute any other program, which is more important at the
time of operation. The feature of Interrupt is very useful as it helps in case of emergency
operations. An Interrupts gives us a mechanism to put on hold the ongoing operations, execute a
subroutine and then again resumes to another type of operations.
The Microcontroller 8051 can be configured in such a way that it temporarily terminates or
pause the main program at the occurrence of interrupts. When a subroutine is completed, then the
execution of main program starts. Generally five interrupt sources are there in 8051
Microcontroller. There are 5 vectored interrupts are shown in below
INTO
TFO
INT1
TF1
R1/T1
Out of these, (INT0) ̅ and (INT1) ̅ are external interrupts that could be negative edge triggered or
low level triggered. When All these interrupts are activated, set the corresponding flogs except
for serial interrupt, the interrupt flags are cleared when the processor branches to the interrupt
service routine (ISR). The external interrupt flags are cleared when the processor branches to the
interrupt service routine, provides the interrupt is a negative edge triggered whereas the timers
and serial port interrupts two of them are external interrupts, two of them are timer interrupts
and one serial port interrupt terminal in general.
Memory
Basically Bus is a collection of wires which work as a communication channel or medium for
transfer of Data. These buses consists of 8, 16 or more wires of the microcontroller. Thus, these
can carry 8 bits, 16 bits simultaneously. Hire two types of buses that are shown in below
Address Bus
Data Bus
Address Bus: Microcontroller 8051 has a 16 bit address bus for transferring the data. It is used
to address memory locations and to transfer the address from CPU to Memory of the
microcontroller. It has four addressing modes that are
Data Bus: Microcontroller 8051 has 8 bits of the data bus, which is used to carry data of
particular applications.
Oscillator
Generally, we know that the microcontroller is a device, therefore it requires clock pulses for its
operation of microcontroller applications. For this purpose, microcontroller 8051 has an on-chip
oscillator which works as a clock source for Central Processing Unit of the microcontroller. The
output pulses of oscillator are stable. Therefore, it enables synchronized work of all parts of the
8051 Microcontroller.
Input/output Port
Timers/Counters
8051 microcontroller has two 16 bit timers and counters. These counters are again divided into a
8 bit register. The timers are used for measurement of intervals to determine the pulse width of
pulses.
2. Evolution of Microprocessors
We can categorize the microprocessor according to the generations or according to the size of the
microprocessor:
The first generation microprocessors were introduced in the year 1971-1972 by Intel
Corporation. It was named Intel 4004 since it was a 4-bit processor.
It was a processor on a single chip. It could perform simple arithmetic and logical operations
such as addition, subtraction, Boolean OR and Boolean AND.
I had a control unit capable of performing control functions like fetching an instruction from
storage memory, decoding it, and then generating control pulses to execute it.
The second generation microprocessors were introduced in 1973 again by Intel. It was a first 8 -
bit microprocessor which could perform arithmetic and logic operations on 8-bit words. It was
Intel 8008, and another improved version was Intel 8088.
Third Generation (16 - bit Microprocessor)
The third generation microprocessors, introduced in 1978 were represented by Intel's 8086,
Zilog Z800 and 80286, which were 16 - bit processors with a performance like minicomputers.
Several different companies introduced the 32-bit microprocessors, but the most popular one is
the Intel 80386.
From 1995 to now we are in the fifth generation. After 80856, Intel came out with a new
processor namely Pentium processor followed by Pentium Pro CPU, which allows multiple
CPUs in a single system to achieve multiprocessing.
Other improved 64-bit processors are Celeron, Dual, Quad, Octa Core processors.
Harvard architecture
The Harvard architecture is a computer architecture with separate storage and signal pathways
for instructions and data. It contrasts with the von Neumann architecture, where program
instructions and data share the same memory and pathways.
The term originated from the Harvard Mark I relay-based computer, which stored instructions
on punched tape (24 bits wide) and data in electro-mechanical counters. These early machines
had data storage entirely contained within the central processing unit, and provided no access to
the instruction storage as data. Programs needed to be loaded by an operator; the processor could
not initialize itself.
Modern processors appear to the user to be systems with von Neumann architectures, with the
program code stored in the same main memory as the data. For performance reasons, internally
and largely invisible to the user, most designs have separate processor caches for the instructions
and data, with separate pathways into the processor for each. This is one form of what is known
as the modified H.
CISC Architecture
The term CISC stands for ‘’Complex Instruction Set Computer’’. It is a CPU design plan based
on single commands, which are skilled in executing multi-step operations.
CISC computers have small programs. It has a huge number of compound instructions, which
take a long time to perform. Here, a single set of instructions is protected in several steps; each
instruction set has an additional than 300 separate instructions. Maximum instructions are
finished in two to ten machine cycles. In CISC, instruction pipelining is not easily implemented.
CISC Architecture
The CISC machines have good acts, based on the overview of program compilers; as the range
of innovative instructions are simply obtainable in one instruction set. They design compound
instructions in a single, simple set of instructions.
They achieve low-level processes, which makes it easier to have huge addressing nodes and
additional data types in the hardware of a machine. But, CISC is considered less efficient than
RISC, because of its incompetence to eliminate codes which leads to wasting of cycles. Also,
microprocessor chips are difficult to understand and program for, because of the complexity of
the hardware.
Instruction Set: Group of instructions given to execute the program and they direct the
computer by manipulating the data. Instructions are in the form – Opcode (operational code) and
Operand. Where, the opcode is the instruction applied to load and store data, etc. The operand is
a memory register where instruction is applied.
Addressing Modes: Addressing modes are how the data is accessed. Depending upon the type
of instruction applied, addressing modes are of various types such as a direct mode where
straight data is accessed or indirect mode where the location of the data is accessed. Processors
having identical ISA may be very different in the organization. Processors with identical ISA and
nearly identical organization is still not nearly identical.
Thus, CPU performance is dependent upon Instruction Count, CPI (Cycles per instruction), and
Clock cycle time. And all three are affected by the instruction set architecture.
This underlines the importance of the instruction set architecture. There are two prevalent
instruction set architectures
IBM 370/168 – It was introduced in the year 1970. CISC design is a 32-bit processor and four
64-bit floating point registers.
VAX 11/780 – CISC design is a 32-bit processor and it supports many numbers of addressing
modes and machine instructions which is from Digital Equipment Corporation.
Intel 80486 – It was launched in the year 1989 and it is a CISC processor, which has instructions
varying lengths from 1 to 11 and it will have 235 instructions.
Characteristics
The term RISC stands for ‘’Reduced Instruction Set Computer’’. It is a CPU design plan based
on simple orders and acts fast.
This is a small or reduced set of instructions. Here, every instruction is expected to attain very
small jobs. In this machine, the instruction sets are modest and simple, which help in comprising
more complex commands. Each instruction is about a similar length; these are wound together to
get compound tasks done in a single operation. Most commands are completed in one machine
cycle. This pipelining is a crucial technique used to speed up RISC machines.
RISC Architecture
Reduced Instruction Set Computer is a microprocessor that is designed to carry out few
instructions at a similar time. Based on small commands, these chips need fewer transistors,
which makes the transistors inexpensive to design and produce. The features of RISC include the
following.
Please refer to this link to know more about Pipelining in Computer Architecture MCQs
Also, while writing a program, RISC makes it easier by letting the computer programmer
eliminate needless codes and stops wasting cycles.
Characteristics
VLIW
The intrinsic parallelism in the instruction stream, complexity, cost, and the branch instruction
issue get resolved by a higher instruction set architecture called the Very Long Instruction
Word (VLIW) or VLIW Machines.
VLIW uses Instruction Level Parallelism, i.e. it has programs to control the parallel execution
of the instructions. In other architectures, the performance of the processor is improved by
using either of the following methods: pipelining (break the instruction into subparts),
superscalar processor (independently execute the instructions in different parts of the
processor), out-of-order-execution (execute orders differently to the program) but each of these
methods add to the complexity of the hardware very much. VLIW Architecture deals with it by
depending on the compiler. The programs decide the parallel flow of the instructions and to
resolve conflicts. This increases compiler complexity but decreases hardware complexity by a
lot.
Features :
The processors in this architecture have multiple functional units, fetch from the Instruction
cache that have the Very Long Instruction Word.
Multiple independent operations are grouped together in a single VLIW Instruction. They
are initialized in the same clock cycle.
Each operation is assigned an independent functional unit.
All the functional units share a common register file.
Instruction words are typically of the length 64-1024 bits depending on the number of
execution unit and the code length required to control each unit.
Instruction scheduling and parallel dispatch of the word is done statically by the compiler.
The compiler checks for dependencies before scheduling parallel execution of the
instructions.
5. What is Memory?
Any system which processes digital data needs a facility for storing the unprocessed, partially
processed, and completely processed data. A subsystem of such digital processing system which
can store all the mentioned data is called as Memory.
But now a days we use semiconductor memory of various types and size.
In this lecture, we are going to learn about all the semiconductor memory which are used in
Microprocessor and Microcontroller. But before starting to know what are the types of memory,
we are going to know some advantages of Semiconductor Memory.
It is possible to implement the static RAM using the bipolar as well as MOS
technology.
It is possible to store data as long as power is applied to the chip.
Static AM cells are basically flip flops that can stay in a given state (i.e. store a bit) as
long as the power to the circuit is not interrupted.
Dynamic RAM (DRAM):
In the dynamic RAM, the data is stored in the form of a charge on the capacitor.
The single bit Dynamic RAM is formed using only two components, one MOSFET
and a capacitor.
Hence it needs a very small area as compared to SRAM. Hence DA consists of more
memory cells as compared to the SRAM per unit area.
One of the most disadvantage of DRAM is that the charge held by capacitor need to
be refreshed after few milliseconds. Hence DRAm needs and extra circuitry for
refreshing the charge.
These memories are designed only for reading the information which is already stored
on them. The user cannot write any new information on them.
These are similar to the prerecorded cassettes.
A manufacturer or someone else can write ROMs but the writing process is much
more complicated as compared to that of RAM.
ROM is used to store some fixed information such a look-up tables, instructions, fixed
data, etc.
It is possible to organize ROMs in such a way that the reading time required for
locations remains the same.
The ROMs are further classified into the below categories as shown in the figure:
The technologies used for ROM manufacturing are:
1. Bipolar Technology
2. MOS Technology
Bipolar ROMs are faster and have higher driving capability whereas MOS ROMs
require less area and consume less power. The improved MOS ROMs have higher
speeds.
Mask Programmable ROM:
This device is electrically programmable. Here user can program the chip. Normally
PROM is one time Programmable (OTP).
Not reprogrammable.
Normally used for production purposes.
Erasable Programmable ROM (EPROM):
These are very similar to EPROMs and use the MOS circuitry.
The chip can be electrically erased.
In this chip, it is possible to erase and program particular memory locations. This is
called selective erasing.
The main disadvantage of these ROMs is that they are very expensive and have very
low storage density.
6. Registers are a type of computer memory used to quickly accept, store, and transfer data and
instructions that are being used immediately by the CPU. The registers used by the CPU are
often termed as Processor registers.
A processor register may hold an instruction, a storage address, or any data (such as bit sequence
or individual characters).
The computer needs processor registers for manipulating data and a register for holding a
memory address. The register holding the memory location is used to calculate the address of the
next instruction after the execution of the current instruction is completed.
Following is the list of some of the most common registers used in a basic computer:
Control Unit — CU
Control unit CU is the part of CPU that helps orchestrate the execution of instructions. It tells
what to do. According to the instruction, it helps activate the wires connecting CPU to different
other parts of computer including the ALU. Control unit is the first component of CPU to receive
the instruction for processing.
There are two types of control unit:
Most logic gates take in two input and produces one output
Below is an example of half adder circuit which takes in two inputs and outputs the result. Here
A and B are the input, S is the output and C is the carry.
Memory (RAM)
Ram is a collection of register arranged and compact together in an optimized way so that it can
store a higher number of data. RAM (Random Access Memory) are volatile and its data gets lost
when we turn off the power. As RAM is a collection of register to read/write data a RAM takes
input of 8bit address, data input for the actual data to be stored and finally read and write enabler
which works as it is for the latches.