Professional Documents
Culture Documents
Software System
Microprocessor 8085
Types of Computers
1. Mainframe –
- Largest and most powerful
- Designed to work at very high speed with large data words.
- Starts with 64 bits and have massive amount of memory.
2. Minicomputer –
- Slow and small in comparison to mainframe
- Used for business data processing, industrial control etc.
3. Microcomputer –
1. Small computers
2. The CPU is usually a single integrated circuit called a microprocessor.
Structure of Microprocessor
Data Bus
I/P
devices Control bus
Control bus
Devices
Memory –
- Consists of RAM and ROM
- Main purpose to store the binary codes for the instructions for execution.
Input/Output –
- Input Allows the computer to take in data from outside and send data to memory.
- Output takes data from memory and send it to output devices.
CPU –
- Also called as microprocessor
- Fetches binary coded instructions from memory, decodes the instructions into a
series of simple actions and carries out these actions into sequence of steps.
Address Bus –
- Consists of 16,20,24 or 32 parallel lines.
- These lines carry address of memory locations.
- The no of memory locations= 2 no of address lines.
e.g. no of address lines=16
Data Bus –
- Consists of 8,16, or 32 parallel signal lines.
- These are bidirectional lines.
Control Bus –
- Consists of 4 to 10 parallel signal lines.
- Typical signals are
- memory read
- memory write
- I/O read and write
Assembly Language –
- Instructions can be written in hexadecimal code. Therefore manufacturer of
Microprocessor has devised a symbolic code for each instructions called
Mnemonics.
Mnemonic – consists of letters which suggest the operation to be performed by
that instruction.
Micro-
Memory I/P O/P
Processor
D7 Data Bus
D0
Control Bus
Address Bus –
- Consists of 16,20,24 or 32 Unidirectional parallel lines.
- These lines carry address of memory locations.
- The no of memory locations= 2 no of address lines.
e.g. no of address lines=16
Data Bus –
- Consists of 8,16, or 32 parallel signal lines.
- These are bidirectional lines.
- It determines the word length and the register size of a Microprocessor.
Control Bus –
- Consists of 4 to 10 parallel signal lines, Used to provide timing signals.
- Typical signals are
- memory read
- memory write
- I/O read and write
Internal Data Operations
Internal architecture of 8-bit MP determines how and what operations can be
performed with the data-
1. Stores 8-bit data
2. Perform arithmetic and logical operations
3. Test for conditions
4. Sequence the execution of instructions
5. Store data temporarily during execution in the defined read/ write memory
locations called the stack.
For all above operations, MP requires registers, an ALU, Buses.
B (8) C (8)
D (8) E (8)
H (8) L (8)
Address Lines 16
Data Lines 8
Registers
- 8085 has 6- general purpose registers to store 8-bit data during program
execution.
- Registers are B,C,D,E,H,L
- These registers can be combined as pair BC, DE, HL to perform 16-bit
operations.
- Registers are programmable i.e. it can used to load or transfer data from
registers by using instructions.
Accumulator
- 8-bit register main part of ALU.
- Identified by A
Flags
- used for the testing for data conditions.
- 8086 has 5 flags to indicate 5 different types of data conditions.
Z (zero), Carry (CY), Sign (S), Parity (P), Auxiliary Carry (AC)
1. Sign Flag (S)– after execution of an arithmetic or logical operation, if bit D7 of
the result is 1, the sign flag will be set (-ive result) else reset (+ive result).
2. Zero Flag (Z) – this flag is et if ALU operations result is 0, else reset.
3. Auxiliary Carry Flag (AC) – if the carry is generated in BCD binary operation
from D3 bit to D4 bit then flag will be set.
4. Parity Flag (P) – if the result has an even no. of 1s in the result the it is called as
even parity and parity flag will be set, else reset.
5. Carry Flag (CY) – if result has carry then flag will be set else reset.
Program Counter (PC)
- 16- bit register used for sequencing execution of instructions.
- This register is a memory pointer.
- Used to point to the memory address from which the next byte is to be
fetched.
- When byte is being fetched the PC incremented by 1 to point next
location.
1. Address Bus
2. Multiplexed Address /Data bus
3. Control and status signals
4. Power Supply and Frequency Signals
5. Interrupt and peripheral initiated signals.
6. Serial I/O ports.
3 MHG +5v GND
Serial I/O Ports
5 1 2 40 20 28
SID
High order
4 address bus
SOD
21
6 19
TRAP Multiplexed
Addr/Data Bus
Interrupt and Externally
RST 7.5 7 12
29 S0
INTR 10
Control Signals
33 S1
35 34 IO/M
Ready
HOLD 39 32 RD
36 31 WR
RESET IN
11 INTA
3 37 38 HLDA
Memory Organization
111
A2 101
Memory Address
A1
100
A0
011
010
001
000
D7 to D0 I/O Lines
CS- chip select
R/W – read write
Memory chip of 8 registers with 3 address lines
To read from or write into a memory location the MP places the address on
the address bus.
- The decoder decodes the address and identifies the register
- The control signal R/W enables the I/O lines, and the data byte is either
read from or write into the memory location.
- cs signal used to select the chip
Peripheral I/O
- 2 instructions In and OUT are used for data transfer
- MP uses 8 address lines to send address of I/O devices
- IOR’ and IOW’ control signals are used.
• Classification of Interrupts
– Interrupts can be classified into two types:
• Maskable Interrupts (Can be delayed or Rejected)
• Non-Maskable Interrupts (Can not be delayed or Rejected)
– RST 5.5, RST 6.5, RST 7.5 are all automatically vectored.
• RST 5.5, RST 6.5, and RST 7.5 are all maskable.
D D
76543210
11101111
Hardware Generation of RST Opcode
• During the interrupt acknowledge machine cycle, (the 1st
machine cycle of the RST operation):
– The Microprocessor activates the INTA signal.
– This signal will enable the Tri-state buffers, which will place the
value EFH on the data bus.
– Therefore, sending the Microprocessor the RST 5 instruction.
• The one draw back to this scheme is that the only way to
change the priority of the devices connected to the
74366 is to reconnect the hardware.
Multiple Interrupts and Priority
– The vectors for these interrupt fall in between the vectors for the RST
instructions. That’s why they have names like RST 5.5 (RST 5 and a
half).
Masking RST 5.5, RST 6.5 and
RST 7.5
• These three interrupts are masked at two
levels:
– Through the Interrupt Enable flip flop and the
EI/DI instructions.
• The Interrupt Enable flip flop controls the whole
maskable interrupt process.
– Through individual mask flip flops that control
the availability of the individual interrupts.
• These flip flops control the interrupts individually.
The 8085 Maskable/Vectored Interrupt
Process
1. The interrupt process should be enabled using the EI
instruction.
2. The 8085 checks for an interrupt during the execution of
every instruction.
3. If there is an interrupt, and if the interrupt is enabled using
the interrupt mask, the microprocessor will complete the
executing instruction, and reset the interrupt flip flop.
4. The microprocessor then executes a call instruction that
sends the execution to the appropriate location in the
interrupt vector table.
The 8085 Maskable/Vectored Interrupt
Process
5. When the microprocessor executes the call instruction, it
saves the address of the next instruction on the stack.
6. The microprocessor jumps to the specific service routine.
7. The service routine must include the instruction EI to re-
enable the interrupt process.
8. At the end of the service routine, the RET instruction
returns the execution to where the program was
interrupted.
Manipulating the Masks
• The Interrupt Enable flip flop is manipulated
using the EI/DI instructions.
M5.5
M6.5
M7.5
MSE
SDO
R7.5
SDE
XXX
}
RST5.5 Mask
Serial Data Out 0 - Available
RST6.5 Mask
1 - Masked
RST7.5 Mask
• Bit 3 (Mask Set Enable - MSE) is an enable for setting the mask.
• If it is set to 0 the mask is ignored and the old settings remain.
• If it is set to 1, the new setting are applied.
• The SIM instruction is used for multiple purposes and not only for setting
interrupt masks.
– It is also used to control functionality such as Serial Data Transmission.
– Therefore, bit 3 is necessary to tell the microprocessor whether or not the
interrupt masks should be modified
SIM and the Interrupt Mask
• The RST 7.5 interrupt is the only 8085 interrupt that has memory.
– If a signal on RST7.5 arrives while it is masked, a flip flop will remember
the signal.
– When RST7.5 is unmasked, the microprocessor will be interrupted even
if the device has removed the interrupt signal.
– This flip flop will be automatically reset when the microprocessor
responds to an RST 7.5 interrupt.
M7.5
M6.5
M5.5
SDO
MSE
R7.5
SDE
XXX
- Disable 6.5 bit 1 = 1
- Enable 7.5 bit 2 = 0
- Allow setting the masks bit 3 = 1 0 0 0 0 1 0 1 0
- Don’t reset the flip flop bit 4 = 0
- Bit 5 is not used bit 5 = 0
- Don’t use serial data bit 6 = 0 Contents of accumulator are: 0AH
- Serial data is ignored bit 7 = 0
M6.5
M5.5
M7.5
P6.5
P7.5
P5.5
SDI
IE
}
RST5.5 Mask
Serial Data In 0 - Available
RST6.5 Mask
1 - Masked
RST7.5 Mask
RST5.5 Interrupt Pending
RST6.5 Interrupt Pending
RST7.5 Interrupt Pending Interrupt Enable
Value of the Interrupt Enable
Flip Flop
The RIM Instruction and the Masks
• Bits 0-2 show the current setting of the mask for each of
RST 7.5, RST 6.5 and RST 5.5
• They return the contents of the three mask flip flops.
• They can be used by a program to read the mask settings in order
to modify only the right mask.
Level
INTR Yes DI / EI No
Sensitive
DI / EI Edge
RST 7.5 Yes Yes
SIM Sensitive
Level &
TRAP No None Yes Edge
Sensitive
Instruction Set
Classification of Instruction Set by Operation
Instruction Format
Instruction Size
There can be three size instructions –
1. One byte
2. Two byte
3. Three byte
One byte – when opcode and operand is stored in the same byte
e.g. reg to reg operations, reg pair and Memory is used
Two Byte – when first byte is opcode and 2nd byte is operand of 8bit
Three byte - when first byte is opcode and 2nd byte and 3rd byte is operand
of 16bit
1. Opcode fetch 0 1 1 0 1
2. Memory Read 0 1 0 0 1
3. Memory Write 0 0 1 1 0
4. I/O Read 1 1 0 0 1
5. I/O Write 1 0 1 1 0
Important definitions
Data Transfer –
MOV B,A
MVI H, 32H
In 01H
Arithmetic Instructions –
ADD B
2. ADI 8bit - 2 byte instruction. Add 8 bit data into A
ADI 32H
3. SUB Reg - 1 byte instruction, Subtract contents of reg with
Accumulator A<- A - Reg
SUB B
4. SUI 8bit - 2 byte instruction. subtract 8 bit data into A
SUI 32h
5. INR R - 1 byte, increment reg by one R<- R+1
INR B
6. DCR R - 1 byte, decrement reg by one R<- R-1
DCR B