Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Microprocessor and Microcontroller Notes

The document provides an overview of microprocessors and microcontrollers, specifically focusing on the 8085 and 8051 architectures. It explains the components of a microprocessor-based system, including the ALU, registers, control unit, and memory, as well as the instruction set and programming models. Additionally, it covers the classification of instructions, internal architecture, and functional pin diagram of the 8085 microprocessor.

Uploaded by

Suvit Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Microprocessor and Microcontroller Notes

The document provides an overview of microprocessors and microcontrollers, specifically focusing on the 8085 and 8051 architectures. It explains the components of a microprocessor-based system, including the ALU, registers, control unit, and memory, as well as the instruction set and programming models. Additionally, it covers the classification of instructions, internal architecture, and functional pin diagram of the 8085 microprocessor.

Uploaded by

Suvit Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Microprocessor and Microcontrollers Interfacing 8085 & 8051

Dr. Sapna Singh

A.P in ECE Deptt.


NIET, Nims University
Rajasthan, Jaipur
• Microprocessor based personal computer system

Microprocess Input
memory output
or

DRAM 8085 printer

SRAM 8086 floppy disk


drive

Cache memory 80286 mouse

ROM 80386 keyboard

Flash memory 80486 hard drive

Pentium video monitor

ALU

I/P CU O/P

M/M
Microprocessor

M/M O/P
Peripheral devices, A/D convertor,
Timer,

Fig. block diagram of microcontroller

• A Microprocessor (MP) is a multi-purpose programable clock driven register based


electronic device that reads binary instructions from a storage device called
memory, accept binary data as input and processes data according to those
instructions and provide results as output.

✓ A typical programable machine represented with 4 components


1. Input
2. Output
3. Memory
4. Microprocessor

• These 4-components work together or interact with each other to perform


a given task. The physical components of this system are called hardware.

• A set of instructions written for the microprocessor to perform a task is


called a program, and a group of programs is called software.
• The microprocessor is generally categorized as
1. Microcontrollers that include all the component on the one chip
2. General purpose microprocessor with discrete components

• Microprocessors operate in binary digits ,0 and 1 also known as bit. These digits
are represented in terms of electrical voltages in the machine. Generally 0
represents one voltage level and 1 represents another voltage level.

• Microprocessor as a CPU

Given block diagram shows that computer has 4 components

1. Memory
2. Input
3. Output
4. Processor -> which consists of ALU, Register and CU

✓ The CPU contains various registers to store the data, the ALU to perform arithmetic
and logical operations, instruction decoders counter and control lines. The CPU
reads instructions form the memory and perform the task specified. It
communicates with input and output devices either to accept or to send the data.
these devices are also known as peripheral devices.
✓ The CPU is the primary and central player in communicating with devices such as
memory input and output. However, the timing of communication process is
controlled by the group of circuits called the control unit.

MEMORY

Microprocessor as INPUT
CPU

OUTPUT
Fig. Block Diagram of Microprocessor
• Organization of a microprocessors-based system

Input
output

System bus
ALU Register
Array

Control unit

Memory

RAM ROM

Fig. microprocessor-based system with bus architecture

• It includes 3 components such as microprocessor, input, output and memory


(read/write memory and read only memory).
• These components are organized around a common communication path
called a bus.
• The entire group of components is also referred as a system or a
microcomputer system and the components themselves are referred to as a
sub-system.

✓ Parts of the microprocessors-based system

1. ALU (arithmetic logic unit): This is the area of a microprocessor


where various computing functions are performed on data. The
ALU units perform such arithmetic operations as addition and
subtraction and such logic operations as AND, OR and XOR.
2. Register Array: This area of the microprocessor consists of various
registers identified by letters such as B, C, D, E, H, L these registers
are primarily used to store data temporarily during the execution of
the program and are accessible to the user.

3. Control Unit (CU): The control unit provides the necessary timing
and control signal to all the operations in the microcomputer. It
controls the flow of data between microprocessors, the memory and
other peripherals.

4. Memory : Memory stores such binary information as instruction


and data and provides that information to the microprocessor
whenever necessary or required. To execute program the
microprocessor reads instruction and data from memory and
performs the computing operations in its ALU section. Results are
either transferred to the output section display or stored in the
memory for later use.

5. System bus: The system bus is a communication path between the


microprocessor and peripherals. It is nothing but a group of wires to
carry bits.

• Microprocessor instruction set and computer languages

Microprocessors recognize and operate in binary numbers however each


microprocessor has its own binary words, meanings, and language. The
words are formed by combining a number of weights for a given machine.
The word or word length is defined as the number of bits the microprocessor
recognizes and processes at a time. The word length ranges from 4 bits for
small microprocessors-based systems to 64 bits for high-speed large
computers. Another term commonly used to express word length is byte. A
byte is defined as a group of 8 bits for example 16-bit microprocessor has a
word length = 2 bytes.
• Machine Language

The number of bits in a word for a given machine is fixed and words are formed
through various combinations of these bits. For example, a machine with a word
length of 8 bits can have 256 (28) combinations of 8 bit. The microprocessor
design engineer selects combinations of bits patterns and gives a specific
meaning to each combination by using electronic logic circuit this is called an
instruction.

Example:

• 0011 1100-> is an instruction that increments the number in the register


called the accumulator by 1.

• 1000 0000-> is an instruction that adds the number in the register called
B to the number in the accumulator and keeps the sum in the
accumulator.

• Assembly Language

The instructions written in hexadecimal code is difficult to understand the


program. Therefor each manufacturer of a microprocessor provides a symbolic
code for each instruction called the mnemonics.

For example,

1. INR A - INR stands for increment and A represents accumulator. This symbol
suggests the operation of incrementing the accumulator the content by 1

2. ADD B - ADD stands for addition and B represents the contents in register B. this
symbol suggests the addition of the content in register B and the content in
accumulator.

3.
• The complete set of 8085 mnemonics is called the 8085-assembly language and a
program written in these mnemonics is called an assembly language program.
The machine language and assembly language are microprocessor specific, and both are
considered as low-level languages.

a). 8085 hardware Model

Timing and control


Accumulator
ALU Register Array
Flag Memory Pointer Reg
Instruction Decoder

16 bit address bus Control Bus


8 bit data bus

Accumulator A(8) Flag Register

B(8) C(8)

D(8) E(8)

H(8) L(8)

Stack Pointer (SP) (16)

Program Counter (PC) (16)

b).Programming Model

8 Bidirectional 16 Lines
D7 D6 D5 D4 D3 D2 D1 D0
S Z Ac P Cy
c). Flag Register

✓ Flag Register bits of 8085

1. S: Sign (+ - of the result)


2. Z : Zero (the result is 0 or not)
3. Ac: Auxiliary Carry
4. P: Parity (odd even)
5. CY: Carry (result have carry or not)

✓ 8085 Hardware Model shows two major segments.


• One segment includes the ALU, and an 8-bit register called an accumulator,
instruction decoder (IR), Flags.
• The second segment shows 8 bit and 16-bit registers.
• Both segments are corrected with various internal connections called an
internal bus. the Arithmetic and Logical Operations are performed in the
ALU. Results are stored in the accumulator, and Flip Flops called Flags are
set to reflect the results.

✓ There are 3 buses


1. 16-bit unidirectional address bus
2. 8-bit bidirectional data bus
3. Control bus

The 8085 processor uses the 16-bit address bus to send out memory addresses, the 8 bit
data bus to transfer data and the control bus for timing signals.

• Instruction Classification.

An instruction is a binary pattern designed inside a microprocessor to perform


a specific function the entire group of instructions called the instruction set.
That determines what functions the microprocessor can perform.
✓ The 8085 Instruction Set:

The 8085 instructions can be classified into the following 5 functional categories

1. Data transfer operations (copy)


2. Arithmetic operations
3. Logical operations
4. Branching operations
5. Machine Control operations

✓ Data transfer operations (copy):


This group of instructions copies data from a location called a source to other
location to destination without modifying the content of the source. The
various types of the data transfer operations are listed below together with the
examples of each type.

1. Data transfer between the registers ex. Copy the content of register B
into register D.
2. Specific data byte to a register or a memory location ex. Load register B
with the data byte 32H.
3. Between a memory location and a register ex. From a memory location
2000H to register B
4. Data transfer between an input output device and the accumulator ex.
From an input keyboard to the accumulator.

✓ Arithmetic operations:
These instructions perform arithmetic operations such as Addition,
Subtraction, Multiplication -, increment, decrement
1. Addition:
Any 8-bit number or the contents of a register or the content of a memory
location can be added to the content of the accumulator and the sum is
stored in the accumulator.
2. Subtraction
Any 8-bit number or the content of the register or the content of a
memory location can be subtracted from the content of the accumulator
and the results stored in the accumulator.

3. Increment or decrement
The 8-bit content of a register or a memory location can be incremented or
decremented by 1. Similarly, the 16-bit content of a register pair such as
BC can be incremented or decremented by 1.

✓ Logical Operations:
These instructions perform various logical operations with the content of the
accumulator
1. AND, OR, XOR
Any 8-bit number or the content of a register or a memory location can be
logically ANDed, ORed, XORed with the content of the accumulator. The
results are stored in the accumulator.
2. Rotate
Each bit in the accumulator can be shifted either left or right to the next
position
3. Compare
Any 8-bit number or the content of the register or a memory location can
be compared for equality, greater then, or less than with the content of the
accumulator.
4. Complement
The content of the accumulator can be complemented all 0’s are replaced
by 1’s and all the 1’s are replaced by 0’s.

Examples

AND operator: ANA R

OR operator: ORA R

Immediate data AND: ANI 8bit

Immediate data OR: XRI 8bit


✓ Branching operation
This group of instructions alters the sequence of the program execution either
conditionally or unconditionally.
1. Jump
Conditional jumps are an important aspect of the decision-making processes
in programming. These instructions test for a certain condition (0 or carry
flag) and alter the program sequence when the condition is mate. In addition,
the instruction set includes an instruction called unconditional jump
Ex.
JMP 16-bit add. JMP 2080H jump to add. 2080
JZ 16-bit add. JZ 2050H jump when 0 flag is set
JNZ 16-bit add. JNZ 2070H jump when 0 flag is reset
JC 16-bit add. JC 2020H jump when carry flag is set
JNC 16-bit add. JNC 2030H jump when carry flag is reset

2. Call, return and restart


These instructions change the sequence of the program either by calling a
subroutine or returning from a subroutine. The conditional call and return
instructions also can test condition flags.

✓ Machine control operation

These instructions control machine functions such as Halt, interrupt.

• Instruction data format and storage

An instruction is a command to the microprocessor to perform a given task on


a specified data.

Each instruction has two parts:

• One is the task to be performed called the operation code


• Second is the data to be operated on called the operand.
• The operand can be specified in various ways. It may include 8-bit or
16-bit data, an internal register, a memory location or a 8 bit and 16
bit address.
✓ Instruction word size:

The 8085-instruction set is classified into the following 3 groups according to


word size or byte size.

1. 1-byte instruction:
1-Byte instruction includes an opcode and the operand in the same byte.
For Examples:

Task Opcode Operand Binary Code Hex. Code


Move A to C MOV C, A 0100 1111 4FH
Add to B ADD B 1000 0000 80H
compliment CMA 0010 1111 2FH

2. 2-byte instruction
In a 2-byte instruction the first byte specifies the operation code, and
the second byte specifies the operand.

For Example:

Task Opcode Operand Binary Code Hex. Code

Move 32H to A MVI A, 32H 0011 1110 3E - first byte


0011 0010 32 - 2-byte
Move F2H to B MVI B, F2H 0000 0110 3E - first byte
1111 0010 F2 -2-byte

3. 3-byte instruction:
In 3-byte instructions the first byte specifies the op-code, and the
following 2 bytes specify the 16-bit address.

For example:
Task Opcode Operand Binary Code Hex. Code
Move 32H to A LDA 2050H 0011 1010 3A -first byte
0011 0010 50 -2-byte
0010 0000 20 -3-byte
JMP 2085H 0011 0011 C3H -1- byte
1000 0101 85H2-byte
0010 0000 20H 3-byte

• Internal Architecture of 8085 Microprocessor:

• Functional Pin Diagram of 8085 Microprocessor:


Fig – Pin diagram of 8085 microprocessor.

The 8085 microprocessor is an 8-bit general purpose microprocessor capable of


addressing 64KB of memory. The device has 40 pins, requires a +5v single power
supply and can operate with a 3Mb single clock. All the signals of the 8085 can be
classified into 6 groups:
1. Address bus
2. Data bus
3. Control and status signal
4. Power supply and frequency signal
5. Externally initiated signal
6. Serial I/O ports

1. Address bus: 8085 has 16 address lines that are used as the address
bus. These lines are split into 2 segments.
a. A15 to A8
b. AD0 to AD7
The 8 signal lines (A15 to A8 ) are uni-directional and used for the
most significant bits called the higher order address of a 16-bit
address.

2. Multiplexed Address bus: the address lines AD0 to AD 7 are bi-


directional. They served a dual purpose. They are used as the low
order address bus as well as the data bus.

✓ Control and status signals:

This group of signals includes:

• Two control signals ̅̅̅̅


𝑅𝐷 and ̅̅̅̅̅
𝑊𝑅 .
• ̅ , S0, S1 to identify the nature of operation
Three status signals: IO/𝑀
and one special signal ALE to indicate the beginning of the operation.

1. ALE: Address Latch Enable: This is a positive going pulse generated


every time the 8085 begins an operation. It indicates that the bits on AD0-
AD7 are address and data bits. This signal is primarily used to latch the
lower address bus from the multiplexed bus and generates a set of 8
address lines A0-A7.

̅̅̅̅̅: Read operation: This is a read control signal (active low). This
2. 𝑹𝑫
signal indicates that the selected input and output or memory device is to
be read, and data are available only data bus.

3. ̅̅̅̅̅
𝑾𝑹: Write Operation: This is a write control signal (active low). This
signal indicates that the data on the data bus are to be written into a
selected memory or input output location.
̅ : This is a status signal used to differentiate between input output
4. IO/𝑴
and memory operations. When it is high, it indicates an input output
operation and when it is low, it indicates a memory operation.
̅ signal and it is used to
5. S1, S0: These status signals are similar to IO/𝑴
identify various operation .

✓ Power supply and clock frequency:

2. VCC =+ 5volt supply , VSS ground or 0.

2 X1, X2-> A crystal is connected at these two pins. The


frequency is internally divided by two, therefore, to operate
a system at 3MHZ the crystal should have frequency of
6MHZ.

✓ Externally initiated signals including interrupts:


The 8085 has 5 interrupt signals that can be used to interrupt a program execution.

• One of the signals, INTR (interrupt request) is identical to the INT interrupt
signal of 8080A microprocessor.
• The microprocessor acknowledges an interrupt by the ̅̅̅̅̅̅̅
𝐼𝑁𝑇𝐴 (interrupt
acknowledge) signal request.
a. INTR: (Interrupt Request):
This is used as a general-purpose interrupt. It is similar to INT signal of 8080A
processor.
b. ̅̅̅̅̅̅̅̅
𝑰𝑵𝑻𝑨: (Interrupt Acknowledge):
This is used to acknowledge an interrupt.
c. RST 7.5, 6.5, and 5.5: (Restart Interrupts):
These are vectored interrupts that transfers the program control to specific
memory location. They have higher priorities than the INTR. Among these three
the priority order is 7.5, 6.5 and 5.5.

d. TRAP interrupt:
This is a non-maskable interrupt and have the highest priority.
e. HOLD: This signal indicates that a peripheral such as a DMA (direct memory
access) controller is requesting the use of address and data buses.
f. HLDA: This signal acknowledges the HOLD request.
g. READY: This signal is used to delay the microprocessor read write cycle until
a slow responding peripheral is ready to send or accept the data.
h. ̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐑𝐄𝐒𝐄𝐓 𝐈𝐍: When the signal on this pin goes low, the program counter is set to
zero, the buses are tri-stated, and the MPU is reset.
i. RESET OUT: This signal indicates that the MPU is being reset. the signal can
be used to reset other devices.

6. Serial input/ output ports: The 8085 has two signals to implements the serial
transmission.
1. SID
2. SOD

In serial transmission, data bits are sent over a single line, 1 bit at a time , such as
the transmission over telephone line.

• 8085 Interrupts

Diagram for 8085 interrupt and vector location


• Software interrupts: or Restart interrupts

Interrupts Vector Locations

RST 0 0000H

RST 1 0008H

RST2 0010H

RST3 0018H

RST4 0020H

RST5 0028H

RST6 0030H

RST7 0038H

1. Enable Interrupts (EI):


This is a 1-byte instruction. The instruction sets interrupt enable flip-flops and
enable the interrupt process.
2. Disable interrupt (DI):
This is a 1-byte instruction resets the interrupt enable flip flop and disable the
interrupt.
3. INTR (Interrupt Request):
• When the microprocessor is executing a program, it checks the INTR line
during the execution of each instruction.
• If the line INTR is high and the interrupt is enabled the microprocessor
completes the current instruction and disable the interrupt enable flip flop
and send a signal called ̅̅̅̅̅̅̅
𝐼𝑁𝑇𝐴.
• The processor cannot accept any interrupt request until the interrupt flip
flop is enable again.
4. RST (Restart):
The 8085-instruction set includes 8 RST instruction. These are 1 byte call
instruction, that transfers the program execution to a specific location.
5. TRAP: This is a non-maskable interrupt known as NMI. The TRAP has the highest
priority followed by RST 7.5, 6.5, 5.5 and INTR. However, the TRAP has a low
priority than the HOLD signal used for DMA controller.

6. RST 7.5, 6.5, 5.5:

These are maskable interrupt and represented by vector location 003CH, 0034H
and 002CH.

• Hardware Interrupts

Interrupts Vector location

TRAP 0024H

RST 7.5 003CH

RST 6.5 0034H

RST 5.5 0020H

8051-Microcontrollers

Features of 8051 Microcontroller

• It is an 8-bit microcontroller with 8-bit data bus and 16-bit address bus
• The 16-bit address bus can address a 64 K byte memory space and a separate 64
K byte of data memory space.
• The 8051 has 4K on chip ROM and 128 bytes of internal RAM.
• Besides internal RAM the 8051 has various special function registers such as the
accumulator, the B register and many other control registers.
• 34 8-bit general purpose registers.
• The ALU perform one 8-bit operation at a time.
• 2 16-bit counter timer
• 3 Internal interrupts
• Four 8-bit input output port
• Some 8051 chips come with UART for serial communication and ADC for analog
to digital conversion.

• Difference between microprocessor and microcontroller

Microprocessor Microcontroller

A microprocessor is a general- A microcontroller is a dedicated chip


purpose device which is called a which is also called single chip
CPU. computer.

A microprocessor does not contain A microcontroller includes RAM, ROM


input, output ports, timer memory serial and parallel interface timers
etc. on a single chip. interrupt in a single chip

Microprocessor is most commonly Microcontroller is used in small


used as a CPU in microcomputer minimal component designs
system performing control-oriented
applications.

Microprocessors instructions mainly Microcontroller is both bit


nibble and byte addressable. addressable as well as byte
addressable.

Microprocessor based system design Microcontroller based system is


is complex and expensive. simple and cost effective.
The instruction set of The instruction set of
microprocessors is complex with microcontrollers is very simple
large number of instructions with a smaller number of
instructions ex PIC
microcontroller have only 35
instructions.

A microprocessor has 0 status flag. A microcontroller has no zero flag.

• Internal architecture of 8051 Microcontroller:

Fig. Architecture of microcontroller 8051

You might also like