Professional Documents
Culture Documents
MPMC Notes 1-5
MPMC Notes 1-5
Course Code/
191EC511/MICROPROCESSORS AND MICROCONTROLLERS 3 0 0 3
Title
To understand the Architecture of 8086 Microprocessor and 8051Microcontroller
To interface 8086
Objectives Microprocessor and 8051 Microcontroller with supporting chips.
To design a microcontroller based system.
Unit-I THE 8086 MICROPROCESSOR 9
Overview of Microprocessors, 8086 – Architecture ,Signals, Addressing modes , Instruction set and assembler directives ,
Assembly language programming , Stacks , Procedures ,Macros , Interrupts and interrupt service routines , Introduction to
advanced microprocessors.
Unit-II PERIPHERAL INTERFACING AND PROGRAMMING 9
Parallel communication interface, Serial communication interface, D/A and A/D Interface, Timer, Keyboard /display
controller , DMA controller, Traffic Light control Interfacing Techniques.
Unit-III 8051 MICROCONTROLLER 9
Functional block diagram and pin diagram of 8051-Special Function register-Program and Data Memory organization-
addressing modes. Instruction Set: data transfer, arithmetic and logical, program branching instructions and Boolean
variable manipulation.
Unit-IV ON-CHIP PERIPHERALS AND PROGRAMMING TECHNIQUES 9
Input output pins, ports and circuits, timer/counter-Operating Modes-Programming 8051 Timers - Counter Programming-
Serial Communication: Basics of Serial Communication Modes-Serial Port Programming. Interrupt: 8051 Interrupt-
External and Internal Interrupts- Programming timer Interrupts, external hardware interrupts and serial communication
interrupts -Interrupt Priority and Programming.
Unit-V PERIPHERAL INTERFACING AND PROGRAMMING 9
D/A and A/D Interface, LED interfacing, LCD interfacing, Keyboard /display Interface, Sensor Interfacing, and Stepper
Motor Interfacing Techniques, Comparison of 8051, PIC, ARM.
1. Analyze and implement programs on 8086 microprocessor.
2. Interface the peripherals and I/O devices with 8086 microprocessor.
Outcomes 3. Interpret 8051 microcontrollers’ architectures and its functionalities.
4. Design and development of 8051 microcontroller based systems for real time applications
5. Interface the peripherals and I/O devices using 8051 microcontroller.
TextBooks
1. Muhammad Ali Mazidi, J.G. Mazidi, R.D. McKinlay,”The 8051 Microcontroller and Embedded Systems”, Second
Edition, Prentice Hall of India Pvt. Ltd., 2007.
2. A.K.Ray,K.M.Bhurchandi, "Advanced Microprocessors and Peripherals" 3rd edition, Tata McGrawHill, 2012.
References
1. Krishna Kant, “Microprocessors and Microcontrollers- Architecture, programming and system design 8085, 8086,
8051,8096”, Prentice Hall of India, New Delhi, 2007.
2. Kenneth J Ayala, “The 8051 Microcontroller – Architecture, Programming and Applications”,Penram
International Publications, Mumbai India, 1996.
3. DoughlasV.Hall,”Microprocessors and Interfacing, Programming and Hardware”, TMH, 2012
UNIT – I
Overview of Microprocessor:
STACK
Intel 80186
• 80186 contain a 16-bit data bus.
• The internal register structure of the 80186 is virtually identical to the 8086.
• The only difference is that the 80186 contain additional reserved interrupt vectors and some
very powerful built in I/O
features
• The 80186 and 80188 are often called embedded controllers because of their application as a
controller, not as a microprocessor-based computer.
• The 80186 contains 16 bit data bus.
• The internal register structure of 80186 is virtually identical to the 8086.
• Enhanced 8086-2 CPU.
• Clock Generator.
• 2 Independent DMA Channels.
• Programmable Interrupt Controller.
• 3 Programmable 16-bit Timers.
• Programmable Memory and Peripheral Chip-Select Logic.
• Available in 10 MHz and 8 MHz Versions.
• Direct Addressing Capability to 1 Mbyte of Memory and 64 Kbyte I/O
Intel 80286
The 80286 is the first member of the family of advanced microprocessors with memory management
and protection abilities.
Features
• The 80286 microprocessor is an advanced version of the 8086 microprocessor that is designed
for multi user and multitasking environments.
• The 80286 addresses 16 M Byte of physical memory and 1G Bytes of virtual memory by using its
memory-management system.
• The 80286 is basically an 8086 that is optimized to execute instructions in fewer clocking periods
than the 8086.
• Various versions of 80286 are available that runs on 12.5 MHz , 10 MHz and 8 MHz clock
frequencies.
• Like the 80186, the 80286 doesn’t incorporate internal peripherals; instead it contains a
memory management unit (MMU).
• The 80286 operates in both the real and protected modes
• In the real mode, the 80286 addresses a 1MByte memory address space and is virtually identical
to 8086.
• In the protected mode, the 80286 addresses a 16MByte memory space.
Intel 80386
Features
• 32-bit general and offset registers.
• 16-byte prefetch queue.
• Memory Management Unit with a Segmentation Unit and a Paging Unit.
• 32-bit Address and Data Bus.
• 4-Gbyte Physical address space.
• 64-Tbyte virtual address space.
• i387 numerical coprocessor with IEEE standard-754-1985 for floating point arithmetic.
• 64K 8-, 16-, or 32-bit ports.
• Implementation of real, protected and virtual 8086 modes.
• The protection mode opeartion provides paging,virtual addressing,multilevel protection and
multitasking capabilities.
UNIT 2 PERIPHERAL INTERFACING AND
PROGRAMMING
-tr 1~~(., ~r Mr u.~ Pff J
f ~-rr ..\ -o/ ~ , f\}p'rtt.)
f~ ~l +o Qi,IAih ~ -
fA-1 Y, P~t- ~ - wn~lw~t- +o
PPr Gt t E.~ ct ~«>'h.,
&i'., 'I'!> f_~ 2-
f .B '.2- f BI f,Bo
12-.,_ p~
'I PJ~
Gr p~
2-
t, 1) } 0 t>
'I{ '-f 2 Y31/4
0 \ 0 D
' D
~H
b 0 f) I 0 \i
tt'
rt
·o ·\ I oq~
() 0 \ V D r 0 0 ct~~
~l ~ 2- ~ R¼
Q
G 0 C1 0
..,
-
~l)V A-L1 ~~
}I') ov
~t1
~/
A-L--
it g-.
Jf\/2.
tcr
tuo
L/rt..L !i) ~ \/ft y
~ fJV -'o--L.., l~ i-t
r)\l'f f o~ Pr-L
e) VT g-11 "4 L
~ev c1.-, o A-
C,+ t.. L- ~ E '-fr Y
Features of Microcontroller:
The 8051 Features are like below
8051 has 8-bit Processing Unit to control applications.
Using 8051 we can process bits, or in other words, the bit processing
capability is present in the 8051microcontroller.
8051 has separate Data memory and separate program memory spaces.
The program memory is basically 4KBof on-chip EPROM (address space
0000H to 0FFFH), and 128 bytes of RAM (address space 00H to 7FH)
There is total 64KB of program memory address space including the on-
chip 4KB space.
The RAM Address space (128 bytes) is not considered in the 64KB space.
There are four 8-bit ports, so 32bi-directional and individually addressable
IO lines.
It also has two 16-bit timers or counters T0 and T1.
It has full duplex UART (universal asynchronous Receiver Transmitter)
8-bit Microcontroller
The 8051 Microcontroller is an 8-bit Microcontroller. The width of the data bus is
8-bits. The data bus is utilized to carry data from specific operations.
Consequently, the CPU can process 8 bits of data at one time.
Memory
A Microcontroller needs program memory to store program/instructions to
perform defined tasks. This memory is termed as ROM. Furthermore the
Microcontroller also requires data memory to store the operands/data on a
temporary basis. This memory is known as RAM. The 8051 Microcontroller is
built with 4 Kb on-chip Read Only Memory (ROM) and 128 bytes Random
Access Memory (RAM).
Address Bus
A bus of the Microcontroller can be defined as a group of wire which can act as a
medium for the transfer of data. There are two buses present in the 8051
Microcontroller. While we are already aware of the Data Bus, let us know about
the Address Bus of the 8051 Microcontroller. The address bus, which is used to
address memory locations, is 16-bit wide. Furthermore, the address bus can also
be used to transfer data from the CPU (Central Processing Unit) to the
memory. Hence, for obvious reasons the address bus is unidirectional.
Interrupts
The most powerful attribute of the 8051 Microcontroller is the concept of
Interrupts. The interrupt is a mechanism to –
Architecture of 8051
Arithmetic and Logical Unit (ALU)
1. Register Banks
There are 32 8-bit registers arranged in 4 groups. These are used as general purpose
registers.
2. Bit Addressable RAM
8051 has 16 bytes of RAM, which is bit addressable. It is grouped as 16, 8 byte
arrays and any of the 128 bits can also be set/cleared individually.
3. Scratch PAD RAM
The third group of registers occupy addresses 2Fh-7Fh, i.e. 80 locations, and does
not have any special functions or features. Scratch pad RAM is used by the ALU,
while fetching, decoding and executing the instructions during operation of the
microcontroller.
System Timing, Interrupts, Timers, Data Buffers and Memory Control
System Timing, refers to the entire timing unit of the microcontroller. The primary
source of timing for 8051 is external crystal. The system timing unit is mainly
responsible for providing timing to critical events like instruction fetch, decode and
execute operations.
Interrupts: 8051 provides a method to stop current execution and switch over to a
priority task with the use of Interrupts. They are associated with external pins
P3.2(INT0) and P3.3(INT1). As well as internal units like timers and serial
communication. Thus an interrupt to 8051 can be external generated by peripheral
device or internal from one of its inbuilt units sometimes referred as software
interrupt.
Timers/Counters: Again one of the most widely used features, timers are used to
count time internally or can be made to count external event as counters.
Memory Control: It is an internal unit of the microcontroller, responsible for
accessing data from RAM and ROM.
After a reset, the program counter is loaded with 0000H but the content of on-chip RAM is not
affected.
OSCILLATOR CIRCUIT OF 8051 CONTROLLER
The 8051 uses the crystal for precisely that to synchronize it’s operation. Effectively, the 8051
operates using what are called "machine cycles."
A single machine cycle is the minimum amount of time in which a single 8051 instruction can be
executed although many instructions take multiple cycles.
8051 has an on-chip oscillator. It needs an external crystal that decides the operating frequency
of the 8051.
MOVA, #0AFH;
MOVR3, #45H;
MOVDPTR, #FE00H;
In these instructions, the # symbol is used for immediate data. In the last
instruction, there is DPTR. The DPTR stands for Data Pointer. Using this, it
points the external data memory location. In the first instruction, the immediate
data is AFH, but one 0 is added at the beginning. So when the data is starting
with A to F, the data should be preceded by 0.
MOVA, R5;
MOVR2, #45H;
MOVR0, A;
In 8051, there is no instruction like MOVR5, R7. But we can get the same result
by using this instruction MOV R5, 07H, or by using MOV 05H, R7. But this two
instruction will work when the selected register bank is RB0. To use another
register bank and to get the same effect, we have to add the starting address of
that register bank with the register number. For an example, if the RB2 is
selected, and we want to access R5, then the address will be (10H + 05H =
15H), so the instruction will look like this MOV 15H, R7. Here 10H is the starting
address of Register Bank 2.
MOV80H, R6;
MOVR2, 45H;
MOVR0, 05H;
The first instruction will send the content of registerR6 to port P0 (Address of Port
0 is 80H). The second one is forgetting content from 45H to R2. The third one is
used to get data from Register R5 (When register bank RB0 is selected) to
register R5.
MOV0E5H, @R0;
MOV@R1, 80H
In the instructions, the @ symbol is used for register indirect addressing. In the
first instruction, it is showing that theR0 register is used. If the content of R0 is
40H, then that instruction will take the data which is located at location 40H of the
internal RAM. In the second one, if the content of R1 is 30H, then it indicates that
the content of port P0 will be stored at location 30H in the internal RAM.
MOVXA, @R1;
MOV@DPTR, A;
In these two instructions, the X in MOVX indicates the external data memory.
The external data memory can only be accessed in register indirect mode. In the
first instruction if the R0 is holding 40H, then A will get the content of external
RAM location40H. And in the second one, the content of A is overwritten in the
location pointed by DPTR.
Indexed addressing mode
In the indexed addressing mode, the source memory can only be accessed from
program memory only. The destination operand is always the register A. These
are some examples of Indexed addressing mode.
MOVCA, @A+PC;
MOVCA, @A+DPTR;
The C in MOVC instruction refers to code byte. For the first instruction, let us
consider A holds 30H. And the PC value is1125H. The contents of program
memory location 1155H (30H + 1125H) are moved to register A.
RLA;
SWAPA;
These are 1- byte instruction. The first one is used to rotate the A register content
to the Left. The second one is used to swap the nibbles in A.
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Write an ALP FOR FLASHING OF LEDS WITH A DELAY OF 1 MILLI SEC
L1: MOV PO,#FF
ACALL DELAY
L1: MOV PO,#00
ACALL DELAY
SJMP L1