1
CHAPTER ONE
INTRODUCTION TO MICROCONTROLLER
Outline
• Introduction
• A Brief History of Microprocessor and microcontroller
• Microprocessors and Microcontroller comparison
• Structure of a basic computer system
• The microcontroller architecture
• CPU families used in microcontrollers
• Types of Memories
• Memory organization Registers and Clock concept
2
3
Introduction
• A microcontroller (MCU) is a small computer on a single
integrated circuit consisting of a relatively simple central
processing unit (CPU) combined with peripheral devices.
• Microcontroller is an Integrated electronic computing
device that includes three major components on a single
chip.
– processor .
– Memory.
– I/O (Input/output) ports.
4
5
• The purpose of the microprocessor is to control
memory.
• Microprocessor is the heart of the computer and it
perform all the computational tasks.
6
Block Diagram of Microcontrollers
7
• A microprocessor is a programmable electronics chip that
has computing and decision making capabilities similar to
central processing unit of a computer.
• Any microprocessor- based systems having limited number
of resources are called microcomputers.
• Nowadays, microprocessor can be seen in almost all types
of electronics devices like mobile phones, printers, washing
machines etc.
• Microprocessors are also used in advanced applications
like radars, satellites and flights.
8
9
Block Diagram of Microprocessors
Microprocessors
• Read instructions
• Process binary data
10
• A typical microprocessor consists of arithmetic and logic unit
(ALU) in association with control unit to process the instruction
execution.
• Almost all the microprocessors are based on the principle of
store-program concept.
• In store-program concept, programs or instructions are
sequentially stored in the memory locations that are to be
executed.
• To do any task using a microprocessor, it is to be programmed by
the user.
11
• So the programmer must have idea about its internal
resources, features and supported instructions.
• Each microprocessor has a set of instructions, a list
which is provided by the microprocessor manufacturer.
• The instruction set of a microprocessor is provided in
two forms:
– binary machine code and
– mnemonics.
12
• Microprocessor communicates and operates in binary
numbers 0 and 1.
• The set of instructions in the form of binary patterns is called
a machine language and it is difficult for us to understand.
• Therefore, the binary patterns are given abbreviated names,
called mnemonics, which forms the assembly language.
• The conversion of assembly-level language into binary
machine-level language is done by using an application
called assembler.
13
• An assembler is a software that converts an assembly
language code to machine code.
• It takes the basic commands and operations from
assembly code and converts them into binary code that
can be recognized by a specific type of processor.
– E.g. java, c, c++, keil uVision and etc.
• Bit: A bit is a single binary digit.
• Word: A word refers to the basic data size or bit size that can be processed by
the arithmetic and logic unit of the processor.
– A 16-bit binary number is called a word in a 16-bit processor.
14
• Bus: A bus is a group of wires/lines that carry similar
information.
15
• System Bus: The system bus is a group of wires/lines used
for communication between the microprocessor and
peripherals.
16
• Memory Word: The number of bits that can be stored in
a register or memory element is called a memory word.
• Address Bus: It carries the address, which is a unique
binary pattern used to identify a memory location or an
I/O port.
– For example, an eight bit address bus has eight lines and thus it
can address 28
= 256 different locations.
– The locations in hexadecimal format can be written as 00H –
FFH.
17
18
• Data Bus: The data bus is used to transfer data between
memory and processor or between I/O device and
processor.
– For example, an 8-bit processor will generally have an 8-bit data bus and a
16-bit processor will have 16-bit data bus.
• Control Bus: The control bus carry control signals, which
consists of signals for selection of memory or I/O device
from the given address, direction of data transfer and
synchronization of data transfer in case of slow devices.
19
20
A Brief History of Microprocessor and microcontroller
• The invention of the transistor in 1947 was a significant
development in the world of technology.
• It could perform the function of a large component used
in a computer in the early years.
• Shockley, Brattain and Bardeen are credited with this
invention and were awarded the Nobel prize for the
same.
21
• Soon it was found that the function this large component was easily
performed by a group of transistors arranged on a single platform.
• This platform, known as the integrated chip (IC), turned out to be a
very crucial achievement and brought along a revolution in the use
of computers.
• A person named Jack Kilby of Texas Instruments was honoured with
the Nobel Prize for the invention of IC, which laid the foundation on
which microprocessors were developed.
• At the same time, Robert Noyce of Fairchild made a parallel
development in IC technology for which he was awarded the patent.
22
• Fairchild Semiconductors (founded in 1957) invented
the first IC in 1959.
• The semiconductor manufacturing technologies used
for chips are:
– Transistor-Transistor Logic (TTL)
– Emitter Coupled Logic (ECL)
– Complementary Metal-Oxide Semiconductor (CMOS)
• In 1968, Robert Noyce, Gordan Moore, Andrew Grovere
signed from Fairchild Semiconductors.
23
• They founded their own company Int-el (Integrated
Electronics).
• The design could integrate a number of functions on a
single chip making it feasible for providing the required
functionality.
• This led to the design of Intel 4004, the world's first
microprocessor.
Intel 4004
24
Evolution of Microprocessor
• It can be classified as following types;
– First generation of processor: 4-bit Microprocessor
• introduced in 1971 by Intel Corp.
• It was named Intel 4004
• Intel introduced the enhanced version of 4004, the 4040
• Some other 4 bit processors are International’s PPS4 and
Toshiba’s T3472.
Intel 4040
25
– Second generation of processor: 8-bit Microprocessor
• The first 8 bit microprocessor which could perform arithmetic
and logic operations on 8 bit words was introduced in 1973
again by Intel.
• This was Intel 8008 and was later followed by an improved
version, Intel 8088.
• Some other 8 bit processors are Zilog-80 and Motorola M6800.
Intel 8008
• Its clock speed was 500 KHz.
• Could execute 50,000 instructions per second.
26
• Introduced in 1974.
• It was also 8-bit µP.
• Its clock speed was 2 MHz
• It had 6,000 transistors.
• Was 10 times faster than 8008.
• Could execute 5,00,000 instructions per second.
Intel 8085
Intel 8085
• Introduced in 1976.
• It was also 8-bit µP.
• Its clock speed was 3 MHz
• Its data bus is 8-bit and address bus is 16-bit.
• It had 6,500 transistors.
• Could execute 7,69,230 instructions per second.
• It could access 64 KB of memory.
• It had 246 instructions.
• Over 100 million copies were sold.
27
– Third generation of processor: 16-bit Microprocessor
• The 8-bit processors were followed by 16 bit processors.
• They are Intel 8086 and 80286.
• The 16 bit microprocessors started becoming a commercial sell-out
in the 1980s with the first popular one being the TMS9900 of Texas
Instruments.
• Intel developed the 8086 which still serves as the base model for all
latest advancements in the microprocessor family.
• The Intel 8086 microprocessor is a 16 bit processor.
• The microprocessor can read/write 16 bit data from or to memory
• It was largely a complete processor integrating all the required
features in it.
28
Intel 8086
• Introduced in 1978.
• It was first 16-bit µP.
• Its clock speed is 4.77 MHz, 8 MHz and 10 MHz,
depending on the version.
• Its data bus is 16-bit and address bus is 20-bit.
• It had 29,000 transistors.
• Could execute 2.5 million instructions per
second.
• It could access 1 MB of memory.
• It had 22,000 instructions.
• It had Multiply and Divide instructions.
29
Intel 8088 Intel 80186
Intel 80188 Intel 80286
30
– Fourth generation of processor: 32-bit Microprocessor
• The 32 bit microprocessors were introduced by several
companies but the most popular one is Intel 80386.
Intel 80386
• Introduced in 1986.
• It was first 32-bit µP.
• Its data bus is 32-bit and address bus is 32-bit.
• It could address 4 GB of memory.
• It had 275,000 transistors.
• Its clock speed varied from 16 MHz to 33 MHz
depending upon the various versions.
•Intel 80386 became the best selling microprocessor in
history.
Intel 80486
Intel Pentium
Intel Pentium Pro
Intel Pentium II
32
Intel Pentium IV
Intel Dual Core
Intel Pentium III
Intel Pentium II Xeon
33
– Fifth generation of processor: Pentium Series
• Instead of 80586, Intel came out with a new processor
namely Pentium processor.
• Its performance is closer to Reduced Instruction Set
Computer (RISC) performance.
34
• Pentium was followed by Pentium Pro CPU.
– Pentium Pro allows allow multiple CPUs in a single system in order to achieve
multiprocessing.
• The MMX extension was added to Pentium Pro and the
result was Pentium II.
– The low cost version of Pentium II is Celeron.
• The Pentium III provided high performance floating point
operations for certain types of computations by using the
SIMD extensions to the instruction set.
– These new instructions make the Pentium III faster than high-end
RISC CPUs.
35
64-bit Microprocessors
• Introduced in 2006.
• It is a 64-bit µP.
• Its clock speed is from 1.2 GHz to 3 GHz.
• It has 291 million transistors.
• It has 64 KB of L1 cache per core and 4 MB of L2
cache.
• It is launched in three different versions:
• Intel Core 2 Duo
• Intel Core 2 Quad
• Intel Core 2 Extreme
Intel Core 2
36
Intel Core i7
Intel Core i5
Intel Core i3
Introduced in 2010.
Its clock speed is from 2.93 GHz to 3.33 GHz.
It has 781 million transistors.
Introduced in 2009.
Its clock speed is from 2.4 GHz to 3.6 GHz.
It has 781 million transistors.
Introduced in 2008.
Its clock speed is from 2.66 GHz to 3.33 GHz.
It has 781 million transistors.
37
Classification of Microprocessors
• Based on their specification, application and architecture
microprocessors are classified.
 Based on size of data bus:
– 4-bit microprocessor
– 8-bit microprocessor
– 16-bit microprocessor
– 32-bit microprocessor
 Based on architecture:
– Reduced Instruction Set Computer (RISC) processors
– Complex Instruction Set Computer (CISC) processors
38
 Based on application:
– General-purpose microprocessor- used in general computer
system and can be used by programmer for any application.
• Examples, 8085 to Intel Pentium.
– Microcontroller- microprocessor with built-in memory and ports
and can be programmed for any generic control application.
• Example, 8051.
– Special-purpose processors- designed to handle special functions
required for an application.
• Examples, digital signal processors and application-specific integrated
circuit (ASIC) chips.
39
Types of Microcontrollers
40
• A microcontroller differs from a microprocessor in many
ways.
– The first and most important difference is its functionality.
– In order that the microprocessor may be used, other
components such as memory must be added to it.
– Even though the microprocessors are considered to be
powerful computing machines, their weak point is that they are
not adjusted to communicating to peripheral equipment.
Microprocessors and Microcontroller comparison
41
42
• Simply, in order to communicate with peripheral
environment, the microprocessor must use specialized
circuits added as external chips.
• In short microprocessors are the pure heart of the
computers.
• This is how it was in the beginning and remains the same
today.
• On the other hand, the microcontroller is designed to be
all of that in one.
43
44
• Most of the pins in the microcontroller chip can be made
programmable by the user.
45
46
• The basic structure of computer system consists mainly of
three parts which are;
– central processing unit (CPU),
– Input devices, and
– output devices.
• Further, the Central processing unit can be divided into
two more parts
– i.e. control unit (CU) and arithmetic logic unit (ALU).
Structure of a basic computer system
47
48
• The basic structure of the computer describes a simple
concept that the data is entered into the central processing
unit with the help of input devices such as a keyboard,
mouse, joystick, scanner, secondary storage devices, etc and
then when the central processing unit receives the data from
the input devices it has a pre-programmed set of instruction
to follow and the result of instruction execution will lead to
output and these output produce are mostly for the user
which requires output devices such as a monitor, speaker,
etc to understand the processed output data.
49
• Computer architecture can be classified into two types
based on the instruction sets,
– Reduced instruction set computer (RISC) machines and
– Complex Instruction Set Computer (CISC) machines.
50
• CISC-based computers have many instructions and occupy
almost 1,200 pages.
• However, RISC-based computers have a reduced number
of instructions usually less than 100 simple and less number
of instructions making even the hardware less complicated.
51
The CISC Approach
• The primary goal of CISC architecture is to complete a
task in as few lines of assembly as possible.
• This is achieved by building processor hardware that is
capable of understanding and executing a series of
operations.
• Transistors used for storing complex instructions.
• For this particular task, a CISC processor would come
prepared with a specific instruction (we'll call it "MULT").
52
• When executed, this instruction loads the two values into
separate registers, multiplies the operands in the
execution unit, and then stores the product in the
appropriate register.
• Thus, the entire task of multiplying two numbers can be
completed with one instruction:
MULT 2:3, 5:2
• MULT is what is known as a "complex instruction."
53
• It operates directly on the computer's memory banks
and does not require the programmer to explicitly call
any loading or storing functions.
• It closely resembles a command in a higher level
language.
• For instance, if we let "a" represent the value of 2:3 and
"b" represent the value of 5:2, then this command is
identical to the C statement "a = a * b."
54
• Some examples of CISC processors are;
– Motorola 68k
– x86 from int-el
• Intel 8051
– PC and data center servers
55
56
The RISC Approach
• RISC processors only use simple instructions that can be
executed within one clock cycle.
• Thus, the "MULT" command described above could be
divided into three separate commands:
– "LOAD," which moves data from the memory bank to a register,
– "PROD," which finds the product of two operands located within
the registers, and
– "STORE," which moves data from a register to the memory
banks.
57
• In order to perform the exact series of steps described in
the CISC approach, a programmer would need to code
four lines of assembly:
LOAD A, 2:3
LOAD B, 5:2
PROD A, B
STORE 2:3, A
• Spends more transistors on memory registers.
58
• Separating the "LOAD" and "STORE" instructions actually
reduces the amount of work that the computer must
perform.
• After a CISC-style "MULT" command is executed, the
processor automatically erases the registers.
• If one of the operands needs to be used for another
computation, the processor must re-load the data from the
memory bank into a register.
• In RISC, the operand will remain in the register until another
value is loaded in its place.
59
• Some of the examples of RISC architecture are;
– Sun’s
– SPARC
– ARM
– AVR
– Microchip PIC 18F87X
60
The microcontroller architecture
• The architecture of a typical microcontroller which
integrates on a single chip
– CPU,
– Memory (ROM, RAM)
– I/O Ports (digital and A/D, pulse, serial/parallel commands
and etc),
– I/O interrupt control,
– Timers and
– Internal buses to connect the components.
61
62
• All components are connected via an internal bus and are all
integrated on one chip.
• The modules are connected to the outside world via I/O pins.
63
• The following list contains the modules typically found in
a microcontroller.
– Processor Core: The CPU of the controller.
• CPU is responsible for fetching the instruction, decodes it,
then finally executed.
• CPU connects every part of a microcontroller into a single
system.
• The primary function of CPU is fetching and decoding
instructions.
• The instruction fetched from program memory must be
decoded by the CPU.
64
– Memory: The memory is sometimes split into
program memory and data memory.
• The function of memory in a microcontroller is the
same as a microprocessor.
• It is used to store data and program.
• A microcontroller usually has a certain amount of
RAM and ROM (EEPROM, EPROM, etc) or flash
memories for storing program source codes.
65
– Interrupt Controller: Interrupts are useful for
interrupting the normal program flow in case of
(important) external or internal events.
• In conjunction with sleep modes, they help to conserve
power.
– e.g: Vectored Interrupts on 8-Bit MCU
• Vectored interrupts (available on some of the latest PIC18F
devices) improve the response time by using hardware.
66
67
• Each sensor shows a way the microcontroller may
process sensor data.
• Sensor 1's analog value is compared to a fixed voltage
reference.
• The comparator triggers an interrupt if the sensor puts
out a signal above the reference value.
• Sensor 2 needs to share data with the CPU, but only if
the ADCC reads an incoming value.
68
• Finally, Sensor 3 reads a lot of data, and Timer 0 counts
the sensor readings, reporting after reading a defined
number of sensor outputs within a period of time.
• Finally, certain output peripherals may also use
interrupts after certain events have occurred.
• Sensor 2 may be a capacitive touch button or some
other type of analog sensor, and when the user-defined
conditions are met, the ADCC interrupt flag goes HIGH.
69
• When this occurs, the interrupt controller first
recognizes whether the ADCC interrupt is set to Low or
High Priority.
• Once the priority is determined, the controller uses the
vector table to point to the first memory address where
the interrupt service routine (ISR) for the ADCC is
located, and the ISR is executed before either
processing other flagged interrupts or returning to the
main program.
70
– Timer/Counter: Most controllers have at least one
and more likely 2-3 Timer/Counters, which can be
used to timestamp events, measure intervals or count
events.
• Many controllers also contain PWM (pulse width
modulation) outputs, which can be used to drive motors or
for safe breaking (antilock brake system, ABS).
71
72
– Digital I/O: Parallel digital I/O ports are one of the main features
of microcontrollers.
• The number of I/O pins varies from 3-4 to over 90, depending on
the controller family and the controller type.
– Analog I/O: Apart from a few small controllers, most
microcontrollers have integrated analog/digital converters,
which differ in the number of channels (2-16) and their
resolution (8-12 bits).
• The analog module also generally features an analog comparator.
In some cases, the microcontroller includes digital/analog
converters.
73
– Parallel input/output ports
• Parallel input/output ports are mainly used to
drive/interface various devices such as LCD’S,
LED’S, printers, memories, etc to a microcontroller.
74
– Interfaces: Controllers generally have at least one serial
interface which can be used to download the program and
for communication with the development PC in general.
• Since serial interfaces can also be used to communicate with
external peripheral devices, most controllers offer several and
varied interfaces like SPI and SCI.
• Many microcontrollers also contain integrated bus controllers
for the most common (field) busses.
• Larger microcontrollers may also contain PCI, USB or Ethernet
interfaces.
75
– Watchdog Timer: Since safety-critical systems form a major
application area of microcontrollers, it is important to
guard against errors in the program and/or the hardware.
• The watchdog timer is used to reset the controller in case of
software “crashes”.
76
• Generally speaking, a watchdog timer is based on a
counter that counts down from some initial value to
zero.
• The embedded software selects the counter’s initial
value and periodically restarts it.
• If the counter ever reaches zero before the software
restarts it, the software is presumed to be
malfunctioning and the processor’s reset signal is
asserted.
• The processor (and the embedded software it’s running)
will be restarted as if a human operator had cycled the
power.
77
– Debugging Unit: Some controllers are equipped with
additional hardware to allow remote debugging of
the chip from the PC.
• So there is no need to download special debugging
software, which has the distinct advantage that erroneous
application code cannot overwrite the debugger.
78
- Analog to Digital Converter (ADC)
• ADC converters are used for converting the analog
signal to digital form.
• The input signal in this converter should be in analog
form (e.g. sensor output) and the output from this unit
is in digital form.
• The digital output can be used for various digital
applications (e.g. measurement devices).
79
80
- Digital to Analog Converter (DAC)
• DAC perform reversal operation of ADC conversion.
• DAC converts the digital signal into analog format.
It usually used for controlling analog devices like DC
motors, various drives, etc.
81
82
Architecture
83
Figure: Basic CPU architecture.
84
• A basic CPU architecture consists of the data path, which
executes instructions and of the control unit, which
basically tells the data path what to do.
ARITHMETIC LOGIC UNIT (ALU): At the core of the CPU is
the arithmetic logic unit (ALU), which is used to perform
computations (AND, ADD, INC, . . . ).
– Several control lines select which operation the ALU should
perform on the input data.
– The ALU takes two inputs and returns the result of the operation
as its output.
85
86
– Source and destination are taken from registers or from
memory.
87
• Program Status Word register in 8051 Microcontroller
88
– In addition, the ALU stores some information about
the nature of the result in the status register (also
called condition code register):
• Z (Zero): The result of the operation is zero.
• N (Negative): The result of the operation is negative, that is,
the most significant bit (MSB) of the result is set (1).
• O (Overflow): The operation produced an overflow, that is,
there was a change of sign in a two’s complement
operation.
• C (Carry): The operation produced a carry.
89
REGISTER FILE: The register file contains the working
registers of the CPU.
– It may either consist of a set of general purpose registers
(generally 16–32, but there can also be more), each of
which can be the source or destination of an operation, or
it consists of some dedicated registers.
90
4-bit Shift Register
91
Stack Pointer: The stack is a portion of consecutive
memory in the data space which is used by the CPU to
store return addresses and possibly register contents
during subroutine and interrupt service routine calls.
– It is accessed with the commands PUSH (put
something on the stack) and POP (remove
something from the stack).
92
• To store the current fill level of the stack, the CPU contains a special
register called the stack pointer (SP), which points to the top of the
stack.
• Stacks typically grow “down”, that is, from the higher memory
addresses to the lower addresses.
93
94
– So the SP generally starts at the end of the data
memory and is decremented with every push and
incremented with every pop.
– The reason for placing the stack pointer at the end of
the data memory is that your variables are generally
at the start of the data memory, so by putting the
stack at the end of the memory it takes longest for the
two to collide.
95
•Unfortunately, there are two ways to interpret the memory location to
which the SP points:
96
• It can either be seen as the first free address, so a PUSH
should store data there and then decrement the stack
pointer or
• It can be seen as the last used address, so a PUSH first
decrements the SP and then stores the data at the new
address.
– Since the SP must be initialized by the programmer, you must look
up how your controller handles the stack and either initialize the SP
to the last address in memory (if a push stores first and decrements
afterwards) or to the last address + 1 (if the push decrements first).
97
98
99
– Accumulator is a Special Function Register (SFR)
closely related to the operation of the ALU.
• It is a kind of working desk used for storing all data upon
which some operation should be performed (addition,
shift/move etc.).
• It also stores the results ready for use in further processing.
• One of the SFRs, called a Status Register (PSW), is closely
related to the accumulator.
• It shows at any given moment the “status” of a number
stored in the accumulator (number is greater or less than
zero etc.).
100
101
Types of Memories
• Memory: Stores information such as instructions and
data in binary format (0 and 1).
• Memory is part of the microcontroller used for data
storage.
– The easiest way to explain it is to compare it with a
filing cabinet with many drawers.
– Suppose, the drawers are clearly marked so that it is
easy to access any of them.
102
• It is easy enough to find out the contents of the drawer
by reading the label on the front of the drawer.
– Sub-system” of microprocessor-based system.
– sub-system includes the registers inside the
microprocessor.
103
• There are different ways either type of memory can be
implemented.
Figure: Types of Semiconductor Memory.
104
Volatile Memory
• volatile memory retains its contents only so long as the
system is powered on.
• Non-volatile memory is usually a lot slower, more
involved to work with, and much more expensive.
• While the volatile memory in your PC has access times in
the nanosecond range, some types of non-volatile
memory will be unavailable for milliseconds after writing
one lousy byte to them.
105
• volatile memory is generally called RAM – Random
Access Memory.
• Of course, the random part does not mean that chance
is involved in accessing the memory.
106
 Static RAM
– Disregarding the era of computers before the use of
integrated circuits, Static Random Access Memory
(SRAM) was the first type of volatile memory to be
widely used.
– An SRAM chip consists of an array of cells, each
capable of storing one bit of information.
– To store a bit of information, a so-called flip-flop is
used, which basically consists of six transistors.
107
108
 Dynamic RAM
– In contrast to a well known claim that nobody will
ever need more than 640 kilobytes of RAM, there
never seems to be enough memory available.
– Now, we already know that SRAM usually needs six
transistors to store one single bit of information.
– Of course, the more transistors per cell are needed,
the larger the silicon area will be.
109
• Instead of using a lot of transistors to build flip-flops,
one bit of information is stored in a capacitor.
110
111
– That is what was achieved with Dynamic Random
Access Memory – DRAM:
• The number of transistors needed per bit of
information was brought down to one.
• This, of course, reduced the silicon area for a given
cell count.
• So at the same chip size, a DRAM has much larger
storage capacity compared to an SRAM.
112
• Well, the information is indeed stored in a capacitor, but
in order to select it for reading or writing, a transistor is
needed.
• By now, it should be obvious how a DRAM works:
– If you want to store a logical one, you address the memory cell
you want to access by driving the transistor.
– Then, you apply a voltage, which charges the capacitor.
– To store a logical zero, you select the cell and discharge the
capacitor.
– Well, you just have to check whether the capacitor is charged
or not.
113
• This means that DRAMs are available in larger capacities.
• However, that would also increase the number of
address pins larger package to accommodate them
higher cost.
• Therefore, it makes sense to reduce the number of
external pins by multiplexing row and column number:
114
Non-volatile Memory
• Contrary to SRAMs and DRAMs, non-volatile memories
retain their content even when power is cut.
• But, as already mentioned, that advantage comes at a
price: Writing non-volatile memory types is usually much
slower and comparatively complicated, often downright
annoying.
115
• Read Only Memories (ROMs): were the first types of non-
volatile semiconductor memories.
• In the case of ROM, we kind of lied: As the name implies,
you simply cannot write to a ROM.
• If you want to use ROMs, you have to hand the data over
to the chip manufacturer, where a specific chip is made
containing your data.
• A common type of ROM is the so-called Mask-ROM
(MROM).
• An MROM, like any IC chip, is composed of several layers.
116
• The geometrical layout of those layers defines the chip’s
function.
• Just like a RAM, an MROM contains a matrix of memory
cells.
• However, during fabrication, on one layer fixed
connections between rows and columns are created,
reflecting the information to be stored in he MROM.
• During fabrication of an IC, masks are used to create the
layers.
• The name Mask-ROM is derived from the one mask which
defines the row-column connections.
117
• Programmable Read Only Memory (PROM): These are
basically matrices of memory cells, each containing a
silicon fuse.
• Initially, each fuse is intact and each cell reads as a
logical 1.
– By selecting a cell and applying a short but high current pulse,
the cell’s fuse can be destroyed, thereby programming a logical
0 into the selected cell.
– Sometimes, you will encounter so-called One Time
Programmable (OTP) microcontrollers.
118
• PROMs and OTP microcontrollers are, of course, not
suitable for development, where the content of the
memory may still need to be changed.
• But once the development process is finished, they are
well-suited for middle range mass production, as long as
the numbers are low enough that production of MROMs
is not economically feasible.
119
• Erasable Programmable Read Only Memory (EPROM):
Memory is stored in so-called field effect transistors
(FETs), or rather in one of their pins called gate.
• It is aptly named floating gate, as it is completely
insulated from the rest of the circuit.
• However, by applying an appropriately high voltage, it is
possible to charge the floating gate via a physical process
called avalanche injection.
120
• So, instead of burning fuses, electrons are injected into
the floating gate, thus closing the transistor switch.
• Once a cell is programmed, the electrons should remain
in the floating gate indefinitely.
121
• Electrically Erasable and Programmable ROM
(EEPROM): has all the advantages of an EPROM without
the hassle.
– No special voltage is required for programming
anymore, and – as the name implies – no more UV
light source is needed for erasing.
– EEPROM works very similar to EPROM, except that
the electrons can be removed from the floating gate
by applying an elevated voltage.
122
– EEPROMs are used quite regularly in microcontroller
applications.
– However, due to their limited write endurance, they
should be used for longer term storage rather than
as scratch memory.
– One example where EEPROMs are best used is the
storage of calibration parameters.
123
• Flash: Flash is a variant of EEPROM where erasing is not
possible for each address, but only for larger blocks or
even the entire memory (erased ‘in a flash’, so to speak).
– That way, the internal logic is simplified, which in turn
reduces the price considerably.
– Also, due to the fact that it is not possible to erase
single bytes,
– Flash EEPROM is commonly used for program, not
data memory.
124
– This, in turn, means that reduced endurance is
acceptable – while you may reprogram a data
EEPROM quite often, you will usually not reprogram a
microcontroller’s program Flash 100.000 times.
– Therefore, Flash-EEPROMs often have a lower
guaranteed write/erase cycle endurance compared to
EEPROMs – about 1.000 to 10.000 cycles.
– This, too, makes Flash-EEPROMs cheaper.
125
• Non-Volatile RAM (NVRAM): Finally, there is a type of
memory that combines the advantages of volatile and
non-volatile memories:
– This can be achieved in different ways.
– One is to just add a small internal battery to an SRAM
device, so that when external power is switched off,
the SRAM still retains its content.
– Another variant is to combine a SRAM with an
EEPROM in one package.
126
– Upon power-up, data is copied from the EEPROM to
the SRAM.
– During operation, data is read from and written to the
SRAM.
– When power is cut off, the data is copied to the
EEPROM.
ASSIGNMENT (Individual)
1) Draw the pin diagram of 8051 and explain the function of each pin.
2) What is the main difference between a mainframe and a super computer?
3) Explain various addressing modes with examples.
4) What is the necessity to have different registers for serial communications
and Timer / Counter operations?
5) What types of control pins are needed in a microprocessor to regulate traffic
on the bus, in order to prevent two devices from trying to use it at the same
time?
6) List and State the functions of various assembler directives ?
7) Discuss on I/O port detailed structure of microcontroller?
8) Explain CD-ROM in detail
9) Explain in detail Memory organization Registers and Clock concept?

More Related Content

PPTX
1IntroductionToComputersAndComputerOrganization.pptx
PPTX
Microprocessors presentation
PPTX
MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1
PPTX
MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1
PDF
Sistem mikroprosessor
PPTX
1. Introduction to Microprocessor.pptx
PPTX
Genesis & Progression of Processors in CPU
PPTX
Presentation spd (1).pptx
1IntroductionToComputersAndComputerOrganization.pptx
Microprocessors presentation
MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1
MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1 MPMC UNIT 1
Sistem mikroprosessor
1. Introduction to Microprocessor.pptx
Genesis & Progression of Processors in CPU
Presentation spd (1).pptx

Similar to Fundamentals of Microcontrollers CHAPTER 1.pptx (20)

PDF
Week 2 Course Material.pdf
PPTX
ch 1_Evolution of computer architecture.pptx
PPT
Journey of Microprocessors By Basit Ali
PDF
8085 microprocessor ramesh gaonkar
PDF
Microprocessor and Positive and Negative Logic
PDF
EE6502 Microprocessor & Microcontroller Regulation 2013
PDF
Microprocessor 8085-Ramesh Gaonkar_250806_175733.pdf
PDF
8085 microprocessor ramesh gaonkar
PDF
8085 microprocessor ramesh gaonkar
PDF
8085 microprocessor ramesh gaonkar
PDF
8085 micro processor book
PDF
8085 microprocessor ramesh gaonkar
PPTX
Evolution of microprocessors
PPTX
Evolution of microprocessors
PPTX
Microprocessor - A Brief History
PDF
MICROCONTROLLRES NOTES.pdf
PPTX
Microprocessors
DOCX
8085 manual NCIT SAROZ BISTA SIR
PDF
8085 microprocessor ramesh gaonkar
PPT
Assmemble langauge for slideshare.net
Week 2 Course Material.pdf
ch 1_Evolution of computer architecture.pptx
Journey of Microprocessors By Basit Ali
8085 microprocessor ramesh gaonkar
Microprocessor and Positive and Negative Logic
EE6502 Microprocessor & Microcontroller Regulation 2013
Microprocessor 8085-Ramesh Gaonkar_250806_175733.pdf
8085 microprocessor ramesh gaonkar
8085 microprocessor ramesh gaonkar
8085 microprocessor ramesh gaonkar
8085 micro processor book
8085 microprocessor ramesh gaonkar
Evolution of microprocessors
Evolution of microprocessors
Microprocessor - A Brief History
MICROCONTROLLRES NOTES.pdf
Microprocessors
8085 manual NCIT SAROZ BISTA SIR
8085 microprocessor ramesh gaonkar
Assmemble langauge for slideshare.net
Ad

More from natyesu (20)

PPT
vdocuments.net_copyright-2007-ramez-elmasri-and-shamkant-b-navathe-slide-7-1.ppt
PPTX
Basic Intrusion Detection Systems (IDS).pptx
PPTX
Basic Fire Detection and Alarm Systems.pptx
PPTX
Introduction to Database System Chapter 1.pptx
PPTX
Introduction to Smart Television System.pptx
PPTX
Introduction to Cathod Ray Tube Television .pptx
PPTX
IT and Its devices, Switch Presentation.pptx
PPTX
Introduction to the basics of HTML p1.pptx
PPTX
Introduction to Measurement CHAPTER 2 (2) (1).pptx
PDF
History of Ethiopia and the horn1012 Unit 1 Edited.pdf
PDF
FUNDAMENTAL OF ELECTERONIS MEASUREMENT 111.pdf
PPTX
input and output management chapter 4 (3).pptx
PPTX
Memory concept and managementChapter 3.pptx
PPTX
THE BASIC CONCEPTS OF PROCESSING MANAGEMENT chapter 2.pptx
PPTX
OPERATING SYSTEMS INTRODUCTION chapter 1.pptx
PPTX
BASIC C++ lecture NOTE C++ lecture 3.pptx
PDF
communication exp power of microwave tubes.PPT
PPT
Chapter 4 - FINAL Promoting Inclusive Culture.ppt
PPT
05-Laplace Transform and Its Inverse_2.ppt
PPTX
Informal Fallacies.pptx
vdocuments.net_copyright-2007-ramez-elmasri-and-shamkant-b-navathe-slide-7-1.ppt
Basic Intrusion Detection Systems (IDS).pptx
Basic Fire Detection and Alarm Systems.pptx
Introduction to Database System Chapter 1.pptx
Introduction to Smart Television System.pptx
Introduction to Cathod Ray Tube Television .pptx
IT and Its devices, Switch Presentation.pptx
Introduction to the basics of HTML p1.pptx
Introduction to Measurement CHAPTER 2 (2) (1).pptx
History of Ethiopia and the horn1012 Unit 1 Edited.pdf
FUNDAMENTAL OF ELECTERONIS MEASUREMENT 111.pdf
input and output management chapter 4 (3).pptx
Memory concept and managementChapter 3.pptx
THE BASIC CONCEPTS OF PROCESSING MANAGEMENT chapter 2.pptx
OPERATING SYSTEMS INTRODUCTION chapter 1.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
communication exp power of microwave tubes.PPT
Chapter 4 - FINAL Promoting Inclusive Culture.ppt
05-Laplace Transform and Its Inverse_2.ppt
Informal Fallacies.pptx
Ad

Recently uploaded (20)

PPTX
Cloud Security and Privacy-Module-1.pptx
PPTX
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
PDF
Disaster Management_Lecture_ PPT_Dr. Kunjari Mog, NITH.pdf
PDF
B461227.pdf American Journal of Multidisciplinary Research and Review
PDF
August 2025 Top Read Articles in - Bioscience & Engineering Recent Research T...
PPTX
CC PPTS unit-I PPT Notes of Cloud Computing
PDF
PhD defense presentation in field of Computer Science
PDF
ITEC 1010 - Information and Organizations Database System and Big data
PDF
1.-fincantieri-investor-presentation2.pdf
PDF
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
PDF
IMDb_Product_Teardown_product_management
PDF
Project_Mgmt_Institute_- Marc Marc Marc.pdf
PDF
IoT-Based Hybrid Renewable Energy System.pdf
PPTX
quantum theory on the next future in.pptx
PPTX
Soumya Das post quantum crypot algorithm
PDF
August 2025 Top read articles in International Journal of Database Managemen...
PDF
Recent Trends in Network Security - 2025
PPTX
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
PPTX
Ingredients of concrete technology .pptx
PPTX
PPT-HEART-DISEASE[1].pptx presentationss
Cloud Security and Privacy-Module-1.pptx
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
Disaster Management_Lecture_ PPT_Dr. Kunjari Mog, NITH.pdf
B461227.pdf American Journal of Multidisciplinary Research and Review
August 2025 Top Read Articles in - Bioscience & Engineering Recent Research T...
CC PPTS unit-I PPT Notes of Cloud Computing
PhD defense presentation in field of Computer Science
ITEC 1010 - Information and Organizations Database System and Big data
1.-fincantieri-investor-presentation2.pdf
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
IMDb_Product_Teardown_product_management
Project_Mgmt_Institute_- Marc Marc Marc.pdf
IoT-Based Hybrid Renewable Energy System.pdf
quantum theory on the next future in.pptx
Soumya Das post quantum crypot algorithm
August 2025 Top read articles in International Journal of Database Managemen...
Recent Trends in Network Security - 2025
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
Ingredients of concrete technology .pptx
PPT-HEART-DISEASE[1].pptx presentationss

Fundamentals of Microcontrollers CHAPTER 1.pptx

  • 2. Outline • Introduction • A Brief History of Microprocessor and microcontroller • Microprocessors and Microcontroller comparison • Structure of a basic computer system • The microcontroller architecture • CPU families used in microcontrollers • Types of Memories • Memory organization Registers and Clock concept 2
  • 3. 3 Introduction • A microcontroller (MCU) is a small computer on a single integrated circuit consisting of a relatively simple central processing unit (CPU) combined with peripheral devices. • Microcontroller is an Integrated electronic computing device that includes three major components on a single chip. – processor . – Memory. – I/O (Input/output) ports.
  • 4. 4
  • 5. 5 • The purpose of the microprocessor is to control memory. • Microprocessor is the heart of the computer and it perform all the computational tasks.
  • 6. 6 Block Diagram of Microcontrollers
  • 7. 7 • A microprocessor is a programmable electronics chip that has computing and decision making capabilities similar to central processing unit of a computer. • Any microprocessor- based systems having limited number of resources are called microcomputers. • Nowadays, microprocessor can be seen in almost all types of electronics devices like mobile phones, printers, washing machines etc. • Microprocessors are also used in advanced applications like radars, satellites and flights.
  • 8. 8
  • 9. 9 Block Diagram of Microprocessors Microprocessors • Read instructions • Process binary data
  • 10. 10 • A typical microprocessor consists of arithmetic and logic unit (ALU) in association with control unit to process the instruction execution. • Almost all the microprocessors are based on the principle of store-program concept. • In store-program concept, programs or instructions are sequentially stored in the memory locations that are to be executed. • To do any task using a microprocessor, it is to be programmed by the user.
  • 11. 11 • So the programmer must have idea about its internal resources, features and supported instructions. • Each microprocessor has a set of instructions, a list which is provided by the microprocessor manufacturer. • The instruction set of a microprocessor is provided in two forms: – binary machine code and – mnemonics.
  • 12. 12 • Microprocessor communicates and operates in binary numbers 0 and 1. • The set of instructions in the form of binary patterns is called a machine language and it is difficult for us to understand. • Therefore, the binary patterns are given abbreviated names, called mnemonics, which forms the assembly language. • The conversion of assembly-level language into binary machine-level language is done by using an application called assembler.
  • 13. 13 • An assembler is a software that converts an assembly language code to machine code. • It takes the basic commands and operations from assembly code and converts them into binary code that can be recognized by a specific type of processor. – E.g. java, c, c++, keil uVision and etc. • Bit: A bit is a single binary digit. • Word: A word refers to the basic data size or bit size that can be processed by the arithmetic and logic unit of the processor. – A 16-bit binary number is called a word in a 16-bit processor.
  • 14. 14 • Bus: A bus is a group of wires/lines that carry similar information.
  • 15. 15 • System Bus: The system bus is a group of wires/lines used for communication between the microprocessor and peripherals.
  • 16. 16 • Memory Word: The number of bits that can be stored in a register or memory element is called a memory word. • Address Bus: It carries the address, which is a unique binary pattern used to identify a memory location or an I/O port. – For example, an eight bit address bus has eight lines and thus it can address 28 = 256 different locations. – The locations in hexadecimal format can be written as 00H – FFH.
  • 17. 17
  • 18. 18 • Data Bus: The data bus is used to transfer data between memory and processor or between I/O device and processor. – For example, an 8-bit processor will generally have an 8-bit data bus and a 16-bit processor will have 16-bit data bus. • Control Bus: The control bus carry control signals, which consists of signals for selection of memory or I/O device from the given address, direction of data transfer and synchronization of data transfer in case of slow devices.
  • 19. 19
  • 20. 20 A Brief History of Microprocessor and microcontroller • The invention of the transistor in 1947 was a significant development in the world of technology. • It could perform the function of a large component used in a computer in the early years. • Shockley, Brattain and Bardeen are credited with this invention and were awarded the Nobel prize for the same.
  • 21. 21 • Soon it was found that the function this large component was easily performed by a group of transistors arranged on a single platform. • This platform, known as the integrated chip (IC), turned out to be a very crucial achievement and brought along a revolution in the use of computers. • A person named Jack Kilby of Texas Instruments was honoured with the Nobel Prize for the invention of IC, which laid the foundation on which microprocessors were developed. • At the same time, Robert Noyce of Fairchild made a parallel development in IC technology for which he was awarded the patent.
  • 22. 22 • Fairchild Semiconductors (founded in 1957) invented the first IC in 1959. • The semiconductor manufacturing technologies used for chips are: – Transistor-Transistor Logic (TTL) – Emitter Coupled Logic (ECL) – Complementary Metal-Oxide Semiconductor (CMOS) • In 1968, Robert Noyce, Gordan Moore, Andrew Grovere signed from Fairchild Semiconductors.
  • 23. 23 • They founded their own company Int-el (Integrated Electronics). • The design could integrate a number of functions on a single chip making it feasible for providing the required functionality. • This led to the design of Intel 4004, the world's first microprocessor. Intel 4004
  • 24. 24 Evolution of Microprocessor • It can be classified as following types; – First generation of processor: 4-bit Microprocessor • introduced in 1971 by Intel Corp. • It was named Intel 4004 • Intel introduced the enhanced version of 4004, the 4040 • Some other 4 bit processors are International’s PPS4 and Toshiba’s T3472. Intel 4040
  • 25. 25 – Second generation of processor: 8-bit Microprocessor • The first 8 bit microprocessor which could perform arithmetic and logic operations on 8 bit words was introduced in 1973 again by Intel. • This was Intel 8008 and was later followed by an improved version, Intel 8088. • Some other 8 bit processors are Zilog-80 and Motorola M6800. Intel 8008 • Its clock speed was 500 KHz. • Could execute 50,000 instructions per second.
  • 26. 26 • Introduced in 1974. • It was also 8-bit µP. • Its clock speed was 2 MHz • It had 6,000 transistors. • Was 10 times faster than 8008. • Could execute 5,00,000 instructions per second. Intel 8085 Intel 8085 • Introduced in 1976. • It was also 8-bit µP. • Its clock speed was 3 MHz • Its data bus is 8-bit and address bus is 16-bit. • It had 6,500 transistors. • Could execute 7,69,230 instructions per second. • It could access 64 KB of memory. • It had 246 instructions. • Over 100 million copies were sold.
  • 27. 27 – Third generation of processor: 16-bit Microprocessor • The 8-bit processors were followed by 16 bit processors. • They are Intel 8086 and 80286. • The 16 bit microprocessors started becoming a commercial sell-out in the 1980s with the first popular one being the TMS9900 of Texas Instruments. • Intel developed the 8086 which still serves as the base model for all latest advancements in the microprocessor family. • The Intel 8086 microprocessor is a 16 bit processor. • The microprocessor can read/write 16 bit data from or to memory • It was largely a complete processor integrating all the required features in it.
  • 28. 28 Intel 8086 • Introduced in 1978. • It was first 16-bit µP. • Its clock speed is 4.77 MHz, 8 MHz and 10 MHz, depending on the version. • Its data bus is 16-bit and address bus is 20-bit. • It had 29,000 transistors. • Could execute 2.5 million instructions per second. • It could access 1 MB of memory. • It had 22,000 instructions. • It had Multiply and Divide instructions.
  • 29. 29 Intel 8088 Intel 80186 Intel 80188 Intel 80286
  • 30. 30 – Fourth generation of processor: 32-bit Microprocessor • The 32 bit microprocessors were introduced by several companies but the most popular one is Intel 80386. Intel 80386 • Introduced in 1986. • It was first 32-bit µP. • Its data bus is 32-bit and address bus is 32-bit. • It could address 4 GB of memory. • It had 275,000 transistors. • Its clock speed varied from 16 MHz to 33 MHz depending upon the various versions. •Intel 80386 became the best selling microprocessor in history.
  • 31. Intel 80486 Intel Pentium Intel Pentium Pro Intel Pentium II
  • 32. 32 Intel Pentium IV Intel Dual Core Intel Pentium III Intel Pentium II Xeon
  • 33. 33 – Fifth generation of processor: Pentium Series • Instead of 80586, Intel came out with a new processor namely Pentium processor. • Its performance is closer to Reduced Instruction Set Computer (RISC) performance.
  • 34. 34 • Pentium was followed by Pentium Pro CPU. – Pentium Pro allows allow multiple CPUs in a single system in order to achieve multiprocessing. • The MMX extension was added to Pentium Pro and the result was Pentium II. – The low cost version of Pentium II is Celeron. • The Pentium III provided high performance floating point operations for certain types of computations by using the SIMD extensions to the instruction set. – These new instructions make the Pentium III faster than high-end RISC CPUs.
  • 35. 35 64-bit Microprocessors • Introduced in 2006. • It is a 64-bit µP. • Its clock speed is from 1.2 GHz to 3 GHz. • It has 291 million transistors. • It has 64 KB of L1 cache per core and 4 MB of L2 cache. • It is launched in three different versions: • Intel Core 2 Duo • Intel Core 2 Quad • Intel Core 2 Extreme Intel Core 2
  • 36. 36 Intel Core i7 Intel Core i5 Intel Core i3 Introduced in 2010. Its clock speed is from 2.93 GHz to 3.33 GHz. It has 781 million transistors. Introduced in 2009. Its clock speed is from 2.4 GHz to 3.6 GHz. It has 781 million transistors. Introduced in 2008. Its clock speed is from 2.66 GHz to 3.33 GHz. It has 781 million transistors.
  • 37. 37 Classification of Microprocessors • Based on their specification, application and architecture microprocessors are classified.  Based on size of data bus: – 4-bit microprocessor – 8-bit microprocessor – 16-bit microprocessor – 32-bit microprocessor  Based on architecture: – Reduced Instruction Set Computer (RISC) processors – Complex Instruction Set Computer (CISC) processors
  • 38. 38  Based on application: – General-purpose microprocessor- used in general computer system and can be used by programmer for any application. • Examples, 8085 to Intel Pentium. – Microcontroller- microprocessor with built-in memory and ports and can be programmed for any generic control application. • Example, 8051. – Special-purpose processors- designed to handle special functions required for an application. • Examples, digital signal processors and application-specific integrated circuit (ASIC) chips.
  • 40. 40 • A microcontroller differs from a microprocessor in many ways. – The first and most important difference is its functionality. – In order that the microprocessor may be used, other components such as memory must be added to it. – Even though the microprocessors are considered to be powerful computing machines, their weak point is that they are not adjusted to communicating to peripheral equipment. Microprocessors and Microcontroller comparison
  • 41. 41
  • 42. 42 • Simply, in order to communicate with peripheral environment, the microprocessor must use specialized circuits added as external chips. • In short microprocessors are the pure heart of the computers. • This is how it was in the beginning and remains the same today. • On the other hand, the microcontroller is designed to be all of that in one.
  • 43. 43
  • 44. 44 • Most of the pins in the microcontroller chip can be made programmable by the user.
  • 45. 45
  • 46. 46 • The basic structure of computer system consists mainly of three parts which are; – central processing unit (CPU), – Input devices, and – output devices. • Further, the Central processing unit can be divided into two more parts – i.e. control unit (CU) and arithmetic logic unit (ALU). Structure of a basic computer system
  • 47. 47
  • 48. 48 • The basic structure of the computer describes a simple concept that the data is entered into the central processing unit with the help of input devices such as a keyboard, mouse, joystick, scanner, secondary storage devices, etc and then when the central processing unit receives the data from the input devices it has a pre-programmed set of instruction to follow and the result of instruction execution will lead to output and these output produce are mostly for the user which requires output devices such as a monitor, speaker, etc to understand the processed output data.
  • 49. 49 • Computer architecture can be classified into two types based on the instruction sets, – Reduced instruction set computer (RISC) machines and – Complex Instruction Set Computer (CISC) machines.
  • 50. 50 • CISC-based computers have many instructions and occupy almost 1,200 pages. • However, RISC-based computers have a reduced number of instructions usually less than 100 simple and less number of instructions making even the hardware less complicated.
  • 51. 51 The CISC Approach • The primary goal of CISC architecture is to complete a task in as few lines of assembly as possible. • This is achieved by building processor hardware that is capable of understanding and executing a series of operations. • Transistors used for storing complex instructions. • For this particular task, a CISC processor would come prepared with a specific instruction (we'll call it "MULT").
  • 52. 52 • When executed, this instruction loads the two values into separate registers, multiplies the operands in the execution unit, and then stores the product in the appropriate register. • Thus, the entire task of multiplying two numbers can be completed with one instruction: MULT 2:3, 5:2 • MULT is what is known as a "complex instruction."
  • 53. 53 • It operates directly on the computer's memory banks and does not require the programmer to explicitly call any loading or storing functions. • It closely resembles a command in a higher level language. • For instance, if we let "a" represent the value of 2:3 and "b" represent the value of 5:2, then this command is identical to the C statement "a = a * b."
  • 54. 54 • Some examples of CISC processors are; – Motorola 68k – x86 from int-el • Intel 8051 – PC and data center servers
  • 55. 55
  • 56. 56 The RISC Approach • RISC processors only use simple instructions that can be executed within one clock cycle. • Thus, the "MULT" command described above could be divided into three separate commands: – "LOAD," which moves data from the memory bank to a register, – "PROD," which finds the product of two operands located within the registers, and – "STORE," which moves data from a register to the memory banks.
  • 57. 57 • In order to perform the exact series of steps described in the CISC approach, a programmer would need to code four lines of assembly: LOAD A, 2:3 LOAD B, 5:2 PROD A, B STORE 2:3, A • Spends more transistors on memory registers.
  • 58. 58 • Separating the "LOAD" and "STORE" instructions actually reduces the amount of work that the computer must perform. • After a CISC-style "MULT" command is executed, the processor automatically erases the registers. • If one of the operands needs to be used for another computation, the processor must re-load the data from the memory bank into a register. • In RISC, the operand will remain in the register until another value is loaded in its place.
  • 59. 59 • Some of the examples of RISC architecture are; – Sun’s – SPARC – ARM – AVR – Microchip PIC 18F87X
  • 60. 60 The microcontroller architecture • The architecture of a typical microcontroller which integrates on a single chip – CPU, – Memory (ROM, RAM) – I/O Ports (digital and A/D, pulse, serial/parallel commands and etc), – I/O interrupt control, – Timers and – Internal buses to connect the components.
  • 61. 61
  • 62. 62 • All components are connected via an internal bus and are all integrated on one chip. • The modules are connected to the outside world via I/O pins.
  • 63. 63 • The following list contains the modules typically found in a microcontroller. – Processor Core: The CPU of the controller. • CPU is responsible for fetching the instruction, decodes it, then finally executed. • CPU connects every part of a microcontroller into a single system. • The primary function of CPU is fetching and decoding instructions. • The instruction fetched from program memory must be decoded by the CPU.
  • 64. 64 – Memory: The memory is sometimes split into program memory and data memory. • The function of memory in a microcontroller is the same as a microprocessor. • It is used to store data and program. • A microcontroller usually has a certain amount of RAM and ROM (EEPROM, EPROM, etc) or flash memories for storing program source codes.
  • 65. 65 – Interrupt Controller: Interrupts are useful for interrupting the normal program flow in case of (important) external or internal events. • In conjunction with sleep modes, they help to conserve power. – e.g: Vectored Interrupts on 8-Bit MCU • Vectored interrupts (available on some of the latest PIC18F devices) improve the response time by using hardware.
  • 66. 66
  • 67. 67 • Each sensor shows a way the microcontroller may process sensor data. • Sensor 1's analog value is compared to a fixed voltage reference. • The comparator triggers an interrupt if the sensor puts out a signal above the reference value. • Sensor 2 needs to share data with the CPU, but only if the ADCC reads an incoming value.
  • 68. 68 • Finally, Sensor 3 reads a lot of data, and Timer 0 counts the sensor readings, reporting after reading a defined number of sensor outputs within a period of time. • Finally, certain output peripherals may also use interrupts after certain events have occurred. • Sensor 2 may be a capacitive touch button or some other type of analog sensor, and when the user-defined conditions are met, the ADCC interrupt flag goes HIGH.
  • 69. 69 • When this occurs, the interrupt controller first recognizes whether the ADCC interrupt is set to Low or High Priority. • Once the priority is determined, the controller uses the vector table to point to the first memory address where the interrupt service routine (ISR) for the ADCC is located, and the ISR is executed before either processing other flagged interrupts or returning to the main program.
  • 70. 70 – Timer/Counter: Most controllers have at least one and more likely 2-3 Timer/Counters, which can be used to timestamp events, measure intervals or count events. • Many controllers also contain PWM (pulse width modulation) outputs, which can be used to drive motors or for safe breaking (antilock brake system, ABS).
  • 71. 71
  • 72. 72 – Digital I/O: Parallel digital I/O ports are one of the main features of microcontrollers. • The number of I/O pins varies from 3-4 to over 90, depending on the controller family and the controller type. – Analog I/O: Apart from a few small controllers, most microcontrollers have integrated analog/digital converters, which differ in the number of channels (2-16) and their resolution (8-12 bits). • The analog module also generally features an analog comparator. In some cases, the microcontroller includes digital/analog converters.
  • 73. 73 – Parallel input/output ports • Parallel input/output ports are mainly used to drive/interface various devices such as LCD’S, LED’S, printers, memories, etc to a microcontroller.
  • 74. 74 – Interfaces: Controllers generally have at least one serial interface which can be used to download the program and for communication with the development PC in general. • Since serial interfaces can also be used to communicate with external peripheral devices, most controllers offer several and varied interfaces like SPI and SCI. • Many microcontrollers also contain integrated bus controllers for the most common (field) busses. • Larger microcontrollers may also contain PCI, USB or Ethernet interfaces.
  • 75. 75 – Watchdog Timer: Since safety-critical systems form a major application area of microcontrollers, it is important to guard against errors in the program and/or the hardware. • The watchdog timer is used to reset the controller in case of software “crashes”.
  • 76. 76 • Generally speaking, a watchdog timer is based on a counter that counts down from some initial value to zero. • The embedded software selects the counter’s initial value and periodically restarts it. • If the counter ever reaches zero before the software restarts it, the software is presumed to be malfunctioning and the processor’s reset signal is asserted. • The processor (and the embedded software it’s running) will be restarted as if a human operator had cycled the power.
  • 77. 77 – Debugging Unit: Some controllers are equipped with additional hardware to allow remote debugging of the chip from the PC. • So there is no need to download special debugging software, which has the distinct advantage that erroneous application code cannot overwrite the debugger.
  • 78. 78 - Analog to Digital Converter (ADC) • ADC converters are used for converting the analog signal to digital form. • The input signal in this converter should be in analog form (e.g. sensor output) and the output from this unit is in digital form. • The digital output can be used for various digital applications (e.g. measurement devices).
  • 79. 79
  • 80. 80 - Digital to Analog Converter (DAC) • DAC perform reversal operation of ADC conversion. • DAC converts the digital signal into analog format. It usually used for controlling analog devices like DC motors, various drives, etc.
  • 81. 81
  • 83. 83 Figure: Basic CPU architecture.
  • 84. 84 • A basic CPU architecture consists of the data path, which executes instructions and of the control unit, which basically tells the data path what to do. ARITHMETIC LOGIC UNIT (ALU): At the core of the CPU is the arithmetic logic unit (ALU), which is used to perform computations (AND, ADD, INC, . . . ). – Several control lines select which operation the ALU should perform on the input data. – The ALU takes two inputs and returns the result of the operation as its output.
  • 85. 85
  • 86. 86 – Source and destination are taken from registers or from memory.
  • 87. 87 • Program Status Word register in 8051 Microcontroller
  • 88. 88 – In addition, the ALU stores some information about the nature of the result in the status register (also called condition code register): • Z (Zero): The result of the operation is zero. • N (Negative): The result of the operation is negative, that is, the most significant bit (MSB) of the result is set (1). • O (Overflow): The operation produced an overflow, that is, there was a change of sign in a two’s complement operation. • C (Carry): The operation produced a carry.
  • 89. 89 REGISTER FILE: The register file contains the working registers of the CPU. – It may either consist of a set of general purpose registers (generally 16–32, but there can also be more), each of which can be the source or destination of an operation, or it consists of some dedicated registers.
  • 91. 91 Stack Pointer: The stack is a portion of consecutive memory in the data space which is used by the CPU to store return addresses and possibly register contents during subroutine and interrupt service routine calls. – It is accessed with the commands PUSH (put something on the stack) and POP (remove something from the stack).
  • 92. 92 • To store the current fill level of the stack, the CPU contains a special register called the stack pointer (SP), which points to the top of the stack. • Stacks typically grow “down”, that is, from the higher memory addresses to the lower addresses.
  • 93. 93
  • 94. 94 – So the SP generally starts at the end of the data memory and is decremented with every push and incremented with every pop. – The reason for placing the stack pointer at the end of the data memory is that your variables are generally at the start of the data memory, so by putting the stack at the end of the memory it takes longest for the two to collide.
  • 95. 95 •Unfortunately, there are two ways to interpret the memory location to which the SP points:
  • 96. 96 • It can either be seen as the first free address, so a PUSH should store data there and then decrement the stack pointer or • It can be seen as the last used address, so a PUSH first decrements the SP and then stores the data at the new address. – Since the SP must be initialized by the programmer, you must look up how your controller handles the stack and either initialize the SP to the last address in memory (if a push stores first and decrements afterwards) or to the last address + 1 (if the push decrements first).
  • 97. 97
  • 98. 98
  • 99. 99 – Accumulator is a Special Function Register (SFR) closely related to the operation of the ALU. • It is a kind of working desk used for storing all data upon which some operation should be performed (addition, shift/move etc.). • It also stores the results ready for use in further processing. • One of the SFRs, called a Status Register (PSW), is closely related to the accumulator. • It shows at any given moment the “status” of a number stored in the accumulator (number is greater or less than zero etc.).
  • 100. 100
  • 101. 101 Types of Memories • Memory: Stores information such as instructions and data in binary format (0 and 1). • Memory is part of the microcontroller used for data storage. – The easiest way to explain it is to compare it with a filing cabinet with many drawers. – Suppose, the drawers are clearly marked so that it is easy to access any of them.
  • 102. 102 • It is easy enough to find out the contents of the drawer by reading the label on the front of the drawer. – Sub-system” of microprocessor-based system. – sub-system includes the registers inside the microprocessor.
  • 103. 103 • There are different ways either type of memory can be implemented. Figure: Types of Semiconductor Memory.
  • 104. 104 Volatile Memory • volatile memory retains its contents only so long as the system is powered on. • Non-volatile memory is usually a lot slower, more involved to work with, and much more expensive. • While the volatile memory in your PC has access times in the nanosecond range, some types of non-volatile memory will be unavailable for milliseconds after writing one lousy byte to them.
  • 105. 105 • volatile memory is generally called RAM – Random Access Memory. • Of course, the random part does not mean that chance is involved in accessing the memory.
  • 106. 106  Static RAM – Disregarding the era of computers before the use of integrated circuits, Static Random Access Memory (SRAM) was the first type of volatile memory to be widely used. – An SRAM chip consists of an array of cells, each capable of storing one bit of information. – To store a bit of information, a so-called flip-flop is used, which basically consists of six transistors.
  • 107. 107
  • 108. 108  Dynamic RAM – In contrast to a well known claim that nobody will ever need more than 640 kilobytes of RAM, there never seems to be enough memory available. – Now, we already know that SRAM usually needs six transistors to store one single bit of information. – Of course, the more transistors per cell are needed, the larger the silicon area will be.
  • 109. 109 • Instead of using a lot of transistors to build flip-flops, one bit of information is stored in a capacitor.
  • 110. 110
  • 111. 111 – That is what was achieved with Dynamic Random Access Memory – DRAM: • The number of transistors needed per bit of information was brought down to one. • This, of course, reduced the silicon area for a given cell count. • So at the same chip size, a DRAM has much larger storage capacity compared to an SRAM.
  • 112. 112 • Well, the information is indeed stored in a capacitor, but in order to select it for reading or writing, a transistor is needed. • By now, it should be obvious how a DRAM works: – If you want to store a logical one, you address the memory cell you want to access by driving the transistor. – Then, you apply a voltage, which charges the capacitor. – To store a logical zero, you select the cell and discharge the capacitor. – Well, you just have to check whether the capacitor is charged or not.
  • 113. 113 • This means that DRAMs are available in larger capacities. • However, that would also increase the number of address pins larger package to accommodate them higher cost. • Therefore, it makes sense to reduce the number of external pins by multiplexing row and column number:
  • 114. 114 Non-volatile Memory • Contrary to SRAMs and DRAMs, non-volatile memories retain their content even when power is cut. • But, as already mentioned, that advantage comes at a price: Writing non-volatile memory types is usually much slower and comparatively complicated, often downright annoying.
  • 115. 115 • Read Only Memories (ROMs): were the first types of non- volatile semiconductor memories. • In the case of ROM, we kind of lied: As the name implies, you simply cannot write to a ROM. • If you want to use ROMs, you have to hand the data over to the chip manufacturer, where a specific chip is made containing your data. • A common type of ROM is the so-called Mask-ROM (MROM). • An MROM, like any IC chip, is composed of several layers.
  • 116. 116 • The geometrical layout of those layers defines the chip’s function. • Just like a RAM, an MROM contains a matrix of memory cells. • However, during fabrication, on one layer fixed connections between rows and columns are created, reflecting the information to be stored in he MROM. • During fabrication of an IC, masks are used to create the layers. • The name Mask-ROM is derived from the one mask which defines the row-column connections.
  • 117. 117 • Programmable Read Only Memory (PROM): These are basically matrices of memory cells, each containing a silicon fuse. • Initially, each fuse is intact and each cell reads as a logical 1. – By selecting a cell and applying a short but high current pulse, the cell’s fuse can be destroyed, thereby programming a logical 0 into the selected cell. – Sometimes, you will encounter so-called One Time Programmable (OTP) microcontrollers.
  • 118. 118 • PROMs and OTP microcontrollers are, of course, not suitable for development, where the content of the memory may still need to be changed. • But once the development process is finished, they are well-suited for middle range mass production, as long as the numbers are low enough that production of MROMs is not economically feasible.
  • 119. 119 • Erasable Programmable Read Only Memory (EPROM): Memory is stored in so-called field effect transistors (FETs), or rather in one of their pins called gate. • It is aptly named floating gate, as it is completely insulated from the rest of the circuit. • However, by applying an appropriately high voltage, it is possible to charge the floating gate via a physical process called avalanche injection.
  • 120. 120 • So, instead of burning fuses, electrons are injected into the floating gate, thus closing the transistor switch. • Once a cell is programmed, the electrons should remain in the floating gate indefinitely.
  • 121. 121 • Electrically Erasable and Programmable ROM (EEPROM): has all the advantages of an EPROM without the hassle. – No special voltage is required for programming anymore, and – as the name implies – no more UV light source is needed for erasing. – EEPROM works very similar to EPROM, except that the electrons can be removed from the floating gate by applying an elevated voltage.
  • 122. 122 – EEPROMs are used quite regularly in microcontroller applications. – However, due to their limited write endurance, they should be used for longer term storage rather than as scratch memory. – One example where EEPROMs are best used is the storage of calibration parameters.
  • 123. 123 • Flash: Flash is a variant of EEPROM where erasing is not possible for each address, but only for larger blocks or even the entire memory (erased ‘in a flash’, so to speak). – That way, the internal logic is simplified, which in turn reduces the price considerably. – Also, due to the fact that it is not possible to erase single bytes, – Flash EEPROM is commonly used for program, not data memory.
  • 124. 124 – This, in turn, means that reduced endurance is acceptable – while you may reprogram a data EEPROM quite often, you will usually not reprogram a microcontroller’s program Flash 100.000 times. – Therefore, Flash-EEPROMs often have a lower guaranteed write/erase cycle endurance compared to EEPROMs – about 1.000 to 10.000 cycles. – This, too, makes Flash-EEPROMs cheaper.
  • 125. 125 • Non-Volatile RAM (NVRAM): Finally, there is a type of memory that combines the advantages of volatile and non-volatile memories: – This can be achieved in different ways. – One is to just add a small internal battery to an SRAM device, so that when external power is switched off, the SRAM still retains its content. – Another variant is to combine a SRAM with an EEPROM in one package.
  • 126. 126 – Upon power-up, data is copied from the EEPROM to the SRAM. – During operation, data is read from and written to the SRAM. – When power is cut off, the data is copied to the EEPROM.
  • 127. ASSIGNMENT (Individual) 1) Draw the pin diagram of 8051 and explain the function of each pin. 2) What is the main difference between a mainframe and a super computer? 3) Explain various addressing modes with examples. 4) What is the necessity to have different registers for serial communications and Timer / Counter operations? 5) What types of control pins are needed in a microprocessor to regulate traffic on the bus, in order to prevent two devices from trying to use it at the same time? 6) List and State the functions of various assembler directives ? 7) Discuss on I/O port detailed structure of microcontroller? 8) Explain CD-ROM in detail 9) Explain in detail Memory organization Registers and Clock concept?