2. History
• uC developed in 1971 by Intel in US.
• 1st 4-bit uC- i4004 –used for calculator.
Intel 4004 – 1971
4040-
8008
8080
TMS1000 – TI 1974- 1st true uC- combined ROM, RAM, uP, clk onchip
8048 - Intel 1977 –uC with RAM+ROM-8 bit
8051- Intel 1981- uC with RAM+ROM+Timer+serial port- 8bit
8096- Intel 16-bit uC for High speed I/O applications
Microprocessors, need several external
peripherals to be connected, therefore
system cost is high
3. 8051 Microcontroller Architecture
• Features of 8051:
– 8051 microcontroller is designed by Intel in 1981
– Belong to MCS-51 family of Microcontrollers.
– It is an 8-bit microcontroller.
– Data Bus-8 Bits i.e can handle 8-bits of data at a time
– Address Bus-16 Bits i.e. Can access 216 = 64KBytes of
memory (ROM and External RAM)
– It is built with 40 pins DIP (dual inline package)
– 4kb of internal/ on-chip ROM
– 128 bytes of internal/ on-chip RAM
– Two 16-bit timers
– four parallel 8-bit ports, which are programmable as well
as addressable as per the requirement.
– 1 UART for Serial Communication
– On-chip crystal oscillator is integrated in the
microcontroller having crystal frequency of 12 MHz.
6. 8051 Pin Description
Port Pins:
Pins 1 to 8 − These pins are known as Port 1. Bi-
directional I/O port. This port doesn’t serve any other
functions.
Pins 10 to 17 − These pins are known as Port 3. This port
serves some functions like interrupts, timer input,
control signals, serial communication signals RxD and
TxD, etc.
Pins 21 to 28 − These pins are known as Port 2. It serves
as I/O port. Higher order address bus signals are also
multiplexed using this port.
Pins 32 to 39 − These pins are known as Port 0. It serves
as I/O port. Lower order address and data bus signals
are multiplexed using this port.
7. 8051 Pin Description
Other Pins:
• Pin 9 − It is a RESET pin, which is used to reset the
microcontroller to its initial values.
• Pins 18 & 19 − These pins are used for interfacing an external
crystal to get the system clock.
• Pin 20 − This pin provides the power supply to the circuit.
• Pin 29 − This is PSEN pin which stands for Program Store
Enable. It is used to read a signal from the external program
memory.
• Pin 30 − This is EA pin which stands for External Access input.
It is used to enable/disable the external memory interfacing.
• Pin 31 − This is ALE pin which stands for Address Latch Enable.
It is used to demultiplex the address-data signal of port.
• Pin 40 − This pin is used to provide power supply to the
circuit.
8. Registers of 8051
Storage Registers in 8051
• Accumulator
• R register
• B register
• Data Pointer (DPTR)
• Program Counter (PC)
• Stack Pointer (SP)
9. Registers of 8051
Accumulator:
• The accumulator, register A, is used for all arithmetic and logic
operations. If the accumulator is not present, then every
result of each calculation (addition, multiplication, shift, etc.)
is to be stored into the main memory. Access to main memory
is slower than access to a register like the accumulator
"R" Registers:
• The "R" registers are a set of eight registers, namely, R0, R1 to
R7. These registers function as auxiliary or temporary storage
registers in many operations
"B" Register
• The "B" register is very similar to the Accumulator in the
sense that it may hold an 8-bit (1-byte) value. The "B"
register is used only by two 8051 instructions: MUL
AB and DIV AB.
10. Registers of 8051
Data Pointer
• The Data Pointer (DPTR) is the 8051’s only user-accessible 16-
bit (2-byte) register. The Accumulator, R0–R7 registers and B
register are 1-byte value registers. DPTR is meant for pointing
to data. It is used by the 8051 to access external memory
using the address indicated by DPTR. DPTR is the only 16-bit
register available and is often used to store 2-byte values.
Program Counter
• The Program Counter (PC) is a 2-byte address which tells the
8051 where the next instruction to execute can be found in
the memory. PC starts at 0000h when the 8051 initializes and
is incremented every time after an instruction is executed.
11. Registers of 8051
Stack Pointer (SP)
• The Stack Pointer, like all registers except DPTR and PC, may
hold an 8-bit (1-byte) value. The Stack Pointer tells the
location from where the next value is to be removed from
the stack. When a value is pushed onto the stack, the value
of SP is incremented and then the value is stored at the
resulting memory location. When a value is popped off the
stack, the value is returned from the memory location
indicated by SP, and then the value of SP is decremented.
• This order of operation is important.
• SP will be initialized to 07h when the 8051 is initialized.
12. Registers of 8051
8051 Flag Bits and PSW Register
• The program status word (PSW) register is an 8-bit register,
also known as flag register. It is of 8-bit wide but only 6-bit of
it is used.
• Four of the flags are called conditional flags, which means
that they indicate a condition which results after an
instruction is executed. These four are CY (Carry), AC (auxiliary
carry), P (parity), and OV (overflow).
• The bits RS0 and RS1 are used to change the bank registers.
The following figure shows the program status word register.
13. Registers of 8051
• PSW
• CY, the carry flag − This carry flag is set (1) whenever there is a carry out from the D7 bit. It is
affected after an 8-bit addition or subtraction operation.
• AC, auxiliary carry flag − If there is a carry from D3 and D4 during an ADD or SUB operation,
the AC bit is set; otherwise, it is cleared.
• P, the parity flag − The parity flag represents the number of 1's in the accumulator register
only. If the A register contains odd number of 1's, then P = 1; and for even number of 1's, P =
0.
• OV, the overflow flag − This flag is set whenever the result of a signed number operation is
too large causing the high-order bit to overflow into the sign bit. Also used to check Timer
overflow.
14. ROM Space in 8051
• The Program Memory or ROM is a type of non-volatile memory used in
microcontrollers where the code or the program to be executed is stored
using the program counter (PC), like tables or initialization program. Intel
8051 has an internal/ built-in ROM of 4KB and can be extended up to
64KB by using an external program memory.
• External Program Memory
• Internal Program Memory (4KB) i.e.
from 0000H to 0FFFH + External Program
Memory (60KB) i.e. from 1000H to FFFFH.
This mode is selected by making EA = 1.
(Refer to fig.1)
• Total External Program Memory (64KB)
i.e., over the entire range of 0000H to
FFFFH. This mode is selected by making
EA = 0. (Refer to fig.2)
15. RAM in 8051
• The 128 bytes of RAM inside the 8051 are
assigned the address 00 to 7FH. They can be
accessed directly as memory locations and are
divided into three different groups as follows −
– 32 bytes from 00H to 1FH locations are set aside for
register banks and the stack.
– 16 bytes from 20H to 2FH locations are set aside for
bit-addressable read/write memory.
– 80 bytes from 30H to 7FH locations are used for read
and write storage; it is called as scratch pad. These 80
locations RAM are widely used for the purpose of
storing data and parameters by 8051 programmers.
18. RAM in 8051
Register Banks in 8051
• A total of 32 bytes of RAM are set aside for the register
banks and the stack.
• These 32 bytes are divided into four register banks in
which each bank has 8 registers, R0–R7.
• RAM locations from 0 to 7 are set aside for bank 0.
• The second bank of registers R0–R7 starts at RAM
location 08 and goes to locations OFH.
• The third bank of R0–R7 starts at memory location 10H
and goes to location to 17H.
• Finally, RAM locations 18H to 1FH are set aside for the
fourth bank of R0–R7.
20. 8096 Microcontroller Architecture
1.The 8096 is a 16-bit microcontroller.
2.The 8096 is designed to use in applications which require high speed calculations
and fast I/O operations.
3.The high speed I/O section of an 8096 includes a 16 bit timer, a 16 bit counter, a
4 input programmable edge detector;
4. software timers, and a 6-output programmable event generator.
5. CPU with 232 byte register file and register ALU
6. 8-Kbyte internal ROM
7. 256 bytes internal RAM
• 8. Two 16-bit Timers/Counters
• 9. A Serial port
• 10. Pulse width modulator
• 11. Watchdog timer
• 12. Eight multiplexed inputs analog to digital converter with 10 bit resolution and
• 13. Memory controller
• 14. It has 100 instructions, which can operate on bit, byte, word, double words.
• It consists of a complete set of 16-bit arithmetic instructions including multiply and
divide operations.
• Logical and arithmetic instructions are available for both byte and word
operations.
22. 8096 Microcontroller Architecture
• Two main buses (A-bus and D-bus) are used for inter-
processor communication. A-bus is a 8-bit address bus
and D-bus is a 16-bit data bus. The D-bus transfers data
only between the RALU and the register file or special
function registers (SFRs).
• The A-bus provides the addresses for above transfers
or address for multiplexed
address/data bus connecting to the memory controller.
The memory controller provides the addresses for the
internal ROM and external memory.
23.
24. 8096 Microcontroller Architecture
• RALU:
• Instructions to the RALU are taken from the A-Bus and stored
temporarily in the instruction register. The Control Unit
decodes the instructions and generates the correct sequence
of signals to have the RALU perform the desired function.
• It contains a 17-bit ALU, the program status word (PSW), It
contains a 17-bit ALU, the Program Status Word (PSW), the
Program Counter (PC), a loop counter, and three temporary
registers. All of the registers are 16-bits or 17-bits (16 + sign
extension) wide. Some of the registers have the ability to
perform simple operations to off-load the ALU.
25. 8096 Microcontroller Architecture
• 8096 Memory Space:
• The addressable memory space on the 8096
Memory Space consists of 64 K bytes, most of
which is available to the user for program or data
memory.
• Locations which have special purposes are 0000H
through 00FFH and 1FFEH through 2080H.
• All other locations can be used for either program
or data storage or for memory mapped
peripherals.
26.
27. Microcontroller Applications
• Microcontrollers are intended for embedded devices, in comparison
to the micro-processors which are used in PCs or other all-purpose
devices.
• Microcontrollers are employed in automatically managed
inventions and appliances like- power tools, implantable medical
devices, automobile engine control systems, , office machines,
remote controls appliances, toys and many more embedded
systems.
• By dipping the size and expenditure in comparison to a design that
make use of a different micro-processor, I/O devices and memory,
micro-controllers formulate it inexpensive to digitally control more
& more appliances and operations.
• Mixed signal micro-controllers are general; putting together analog
constituents required controlling non-digital electronic structures.
28. Microcontroller Applications
Application of Microcontroller in Day to Day Life Devices:
• Light sensing & controlling devices
• Temperature sensing and controlling devices
• Fire detection & safety devices
• Application of Microcontroller in Industrial Control Devices:
• Industrial instrumentation devices
• Process control devices
• Application of Microcontroller in Metering & Measurement Devices:
• Volt Meter
• Measuring revolving objects
• Current meter
• Hand-held metering systems
29. Microcontroller Applications
The main applications of microcontrollers types include the following.
• Automobiles
• Hand-held metering systems
• Mobile Phones
• Computer Systems
• Security Alarms
• Appliances
• Current meter
• Cameras
• Micro Oven
• Measurement Instruments
• Devices for process control
• Used in metering & measurement devices, voltmeter, measuring
rotating objects
30. Microcontroller Applications
• Controlling Devices
• Industrial instrumentation devices
• Instrumentation devices in Industries
• Light Sensing
• Safety devices
• Process control devices
• Controlling devices
• Fire detection
• Temperature sensing
• Mobile Phones
• Auto Mobiles
• Washing Machines
• Cameras
• Security Alarms