Opcode fetch machine cycle of 8085 :
-
Each instruction of the processor has one byte opcode.
-
The opcodes are stored in memory. So, the processor executes the opcode fetch machine cycle to fetch the opcode from memory.
-
Hence, every instruction starts with opcode fetch machine cycle.
-
The time taken by the processor to execute the opcode fetch cycle is 4T.
-
In this time, the first, 3 T-states are used for fetching the opcode from memory and the remaining T-states are used for internal operations by the processor.
Fig - Timing Diagram for Opcode Fetch Machine Cycle
UNIT-II
INSTRUCTION SET & ADDRESSING MODES
The 8085 instruction set can be classified into the following five functional headings.
1. DATA TRANSFER INSTRUCTIONS:
It includes the instructions that move (copies) data between registers or between memory locations and registers. In all data transfer operations the content of source register is not altered. Hence the data transfer is copying operation.
Ex: (1) Mov A,B (2) MVI C,45H
2. ARITHMETIC INSTRUCTIONS:
Includes the instructions, which performs the addition, subtraction, increment or decrement operations. The flag conditions are altered after execution of an instruction in this group.
Ex: (1) ADD A,B (2) SUI B,05H
3. LOGICAL INSTRUCTIONS:
The instructions which performs the logical operations like AND, OR, EXCLUSIVE- OR, complement, compare and rotate instructions are grouped under this heading. The flag conditions are altered after execution of an instruction in this group.
Ex: (1) ORA A (2) ANI B, 01H
4. BRANCHING INSTRUCTIONS:
The instructions that are used to transfer the program control from one memory location to another memory location are grouped under this heading.
Ex: (1) CALL (2) JMP 4100
5. MACHINE CONTROL INSTRUCTIONS:
It includes the instructions related to interrupts and the instruction used to stop the program execution.
Ex: (1) NOP (2) END
Addressing modes of 8085:
-
Every instruction of a program has to operate on a data.
-
The method of specifying the data to be operated by the instruction is called Addressing.
-
The 8085 has the following 5 different types of addressing.
1. Immediate Addressing
2. Direct Addressing
3. Register Addressing
4. Register Indirect Addressing
5. Implied Addressing
1. Immediate Addressing:
-
In immediate addressing mode, the data is specified in the instruction itself. The data will be a part of the program instruction.
-
EX. MVI B, 3EH - Move the data 3EH given in the instruction to B register; LXI SP, 2700H.
2. Direct Addressing:
-
In direct addressing mode, the address of the data is specified in the instruction. The data will be in memory. In this addressing mode, the program instructions and data can be stored in different memory.
-
EX. LDA 1050H - Load the data available in memory location 1050H in to accumulator; SHLD 3000H
3. Register Addressing:
-
In register addressing mode, the instruction specifies the name of the register in which the data is available.
-
EX. MOV A, B - Move the content of B register to A register; SPHL; ADD C.
4. Register Indirect Addressing:
-
In register indirect addressing mode, the instruction specifies the name of the register in which the address of the data is available. Here the data will be in memory and the address will be in the register pair.
-
EX. MOV A, M - The memory data addressed by H L pair is moved to A register. LDAX B.
5. Implied Addressing:
-
In implied addressing mode, the instruction itself specifies the data to be operated.
-
EX. CMA - Complement the content of accumulator; RAL
DATA TRANSFER INSTRUCTIONS
Opcode
|
Operand
|
Explanation of Instruction
|
Description
|
MOV
|
Rd, Rs
M, Rs
Rd, M
|
Copy from source(Rs) to destination(Rd)
|
This instruction copies the contents of the source register into the destination register; the contents of the source register are not altered. If one of the operands is a memory location, its location is specified by the contents of the HL registers.
Example: MOV B, C or MOV B, M
|
MVI
|
Rd, data
M, data
|
Move immediate 8-bit
|
The 8-bit data is stored in the destination register or memory. If the operand is a memory location, its location is specified by the contents of the HL registers.
Example: MVI B, 57H or MVI M, 57H
|
LDA
|
16-bit address
|
Load accumulator
|
The contents of a memory location, specified by a 16-bit address in the operand, are copied to the accumulator. The contents of the source are not altered.
Example: LDA 2034H
|
LDAX
|
B/D Reg. pair
|
Load accumulator indirect
|
The contents of the designated register pair point to a memory location. This instruction copies the contents of that memory location into the accumulator. The contents of either the register pair or the memory location are not altered.
Example: LDAX B
|
LXI
|
Reg. pair, 16-bit data
|
Load register pair immediate
|
The instruction loads 16-bit data in the register pair designated in the operand.
Example: LXI H, 2034H or LXI H, XYZ
|
LHLD
|
16-bit address
|
Load H and L registers direct
|
The instruction copies the contents of the memory location pointed out by the 16-bit address into register L and copies the contents of the next memory location into register H. The contents of source memory locations are not altered.
Example: LHLD 2040H
|
STA
|
16-bit address
|
16-bit address
|
The contents of the accumulator are copied into the memory location specified by the operand. This is a 3-byte instruction, the second byte specifies the low-order address and the third byte specifies the high-order address.
Example: STA 4350H
|
STAX
|
Reg. pair
|
Store accumulator indirect
|
The contents of the accumulator are copied into the memory location specified by the contents of the operand (register pair). The contents of the accumulator are not altered.
Example: STAX B
|
SHLD
|
16-bit address
|
Store H and L registers direct
|
The contents of register L are stored into the memory location specified by the 16-bit address in the operand and the contents of H register are stored into the next memory location by incrementing the operand. The contents of registers HL are not altered. This is a 3-byte instruction, the second byte specifies the low-order address and the third byte specifies the high-order address.
Example: SHLD 2470H
|
XCHG
|
none
|
Exchange H and L with D and E
|
The contents of register H are exchanged with the contents of register D, and the contents of register L are exchanged with the contents of register E.
Example: XCHG
|
SPHL
|
none
|
Copy H and L registers to the stack pointer
|
The instruction loads the contents of the H and L registers into
the stack pointer register, the contents of the H register provide the high-order address and the contents of the L register provide the low-order address. The contents of the H
and L registers are not altered.
Example: SPHL
|
XTHL
|
none
|
Exchange H and L with top of stack
|
The contents of the L register are exchanged with the stack location pointed out by the contents of the stack pointer register. The contents of the H register are exchanged with the next stack location (SP+1); however, the contents of the stack pointer register are not altered.
Example: XTHL
|
PUSH
|
Reg. pair
|
Push register pair onto stack
|
The contents of the register pair designated in the operand are copied onto the stack in the following sequence. The stack pointer register is decremented and the contents of the highorder register (B, D, H, A) are copied into that location. The stack pointer register is decremented again and the contents of the low-order register (C, E, L, flags) are copied to that location.
Example: PUSH B or PUSH A
|
POP
|
Reg. pair
|
Pop off stack to register pair
|
The contents of the memory location pointed out by the stack pointer register are copied to the low-order register (C, E, L, status flags) of the operand. The stack pointer is incremented by 1 and the contents of that memory location are copied to the high-order register (B, D, H, A) of the operand. The stack pointer register is again incremented by 1.
Example: POP H or POP A
|
OUT
|
8-bit port address
|
Output data from accumulator to a port with 8-bit address
|
The contents of the accumulator are copied into the I/O port specified by the operand.
Example: OUT F8H
|
IN
|
8-bit port address
|
Input data to accumulator from a port with 8-bit address
|
The contents of the input port designated in the operand are read and loaded into the accumulator.
Example: IN 8CH
|
ARITHMETIC INSTRUCTIONS
Opcode
|
Operand
|
Explanation of Instruction
|
Description
|
ADD
|
R
M
|
Add register or memory, to accumulator
|
The contents of the operand (register or memory) are added to the contents of the accumulator and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the addition.
Example: ADD B or ADD M
|
ADC
|
R
M
|
Add register to accumulator with carry
|
The contents of the operand (register or memory) and M the Carry flag are added to the contents of the accumulator and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the addition.
Example: ADC B or ADC M
|
ADI
|
8-bit data
|
Add immediate to accumulator
|
The 8-bit data (operand) is added to the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the addition.
Example: ADI 45H
|
ACI
|
8-bit data
|
Add immediate to accumulator with carry
|
The 8-bit data (operand) and the Carry flag are added to the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the addition.
Example: ACI 45H
|
LXI
|
Reg. pair, 16-bit data
|
Load register pair immediate
|
The instruction loads 16-bit data in the register pair designated in the operand.
Example: LXI H, 2034H or LXI H, XYZ
|
DAD
|
Reg. pair
|
Add register pair to H and L registers
|
The 16-bit contents of the specified register pair are added to the contents of the HL register and the sum is stored in the HL register. The contents of the source register pair are not altered. If the result is larger than 16 bits, the CY flag is set. No other flags are affected.
Example: DAD H
|
SUB
|
R
M
|
Subtract register or memory from accumulator
|
The contents of the operand (register or memory ) are subtracted from the contents of the accumulator, and the result is stored in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the subtraction.
Example: SUB B or SUB M
|
SBB
|
R
M
|
Subtract source and borrow from accumulator
|
The contents of the operand (register or memory ) and M the Borrow flag are subtracted from the contents of the accumulator and the result is placed in the accumulator. If the operand is a memory location, its location is specified by the contents of the HL registers. All flags are modified to reflect the result of the subtraction.
Example: SBB B or SBB M
|
SUI
|
8-bit data
|
Subtract immediate from accumulator
|
The 8-bit data (operand) is subtracted from the contents of the accumulator and the result is stored in the accumulator. All flags are modified to reflect the result of the subtraction.
Example: SUI 45H
|
SBI
|
8-bit data
|
Subtract immediate from accumulator with borrow
|
The contents of register H are exchanged with the contents of register D, and the contents of register L are exchanged with the contents of register E.
Example: XCHG
|
INR
|
R
M
|
Increment register or memory by 1
|
The contents of the designated register or memory) are incremented by 1 and the result is stored in the same place. If the operand is a memory location, its location is specified by the contents of the HL registers.
Example: INR B or INR M
|
INX
|
R
|
Increment register pair by 1
|
The contents of the designated register pair are incremented by 1 and the result is stored in the same place.
Example: INX H
|
DCR
|
R
M
|
Decrement register or memory by 1
|
The contents of the designated register or memory are M decremented by 1 and the result is stored in the same place. If the operand is a memory location, its location is specified by the contents of the HL registers.
Example: DCR B or DCR M
|
DCX
|
R
|
Decrement register pair by 1
|
The contents of the designated register pair are decremented by 1 and the result is stored in the same place.
Example: DCX H
|
DAA
|
none
|
Decimal adjust accumulator
|
The contents of the accumulator are changed from a binary value to two 4-bit binary coded decimal (BCD) digits. This is the only instruction that uses the auxiliary flag to perform the binary to BCD conversion, and the conversion procedure is described below. S, Z, AC, P, CY flags are altered to reflect the results of the operation.
If the value of the low-order 4-bits in the accumulator is greater than 9 or if AC flag is set, the instruction adds 6 to the low-order four bits.
If the value of the high-order 4-bits in the accumulator is greater than 9 or if the Carry flag is set, the instruction adds 6 to the high-order four bits.
Example: DAA
|
BRANCHING INSTRUCTIONS
Opcode
|
Operand
|
Explanation of Instruction
|
Description
|
JMP
|
16-bit address
|
Jump unconditionally
|
The program sequence is transferred to the memory location specified by the 16-bit address given in the operand.
Example: JMP 2034H or JMP XYZ
|
Opcode
|
Description
|
Flag Status
|
JC
|
Jump on Carry
|
CY = 1
|
JNC
|
Jump on no Carry
|
CY = 0
|
JP
|
Jump on positive
|
S = 0
|
JM
|
Jump on minus
|
S = 1
|
JZ
|
Jump on zero
|
Z = 1
|
JNZ
|
Jump on no zero
|
Z = 0
|
JPE
|
Jump on parity even
|
P = 1
|
JPO
|
Jump on parity odd
|
P = 0
|
|
16-bit address
|
Jump conditionally
|
The program sequence is transferred to the memory location specified by the 16-bit address given in the operand based on the specified flag of the PSW as described below.
Example: JZ 2034H or JZ XYZ
|
Opcode
|
Description
|
Flag Status
|
CC
|
Call on Carry
|
CY = 1
|
CNC
|
Call on no Carry
|
CY = 0
|
CP
|
Call on positive
|
S = 0
|
CM
|
Call on minus
|
S = 1
|
CZ
|
Call on zero
|
Z = 1
|
CNZ
|
Call on no zero
|
Z = 0
|
CPE
|
Call on parity even
|
P = 1
|
CPO
|
Call on parity odd
|
P = 0
|
|
16-bit address
|
Unconditional subroutine call
|
The program sequence is transferred to the memory location specified by the 16-bit address given in the operand. Before the transfer, the address of the next instruction after CALL (the contents of the program counter) is pushed onto the stack.
Example: CALL 2034H or CALL XYZ
|
RET
|
none
|
Return from subroutine unconditionally
|
The program sequence is transferred from the subroutine to the calling program. The two bytes from the top of the stack are copied into the program counter,and program execution begins at the new address.
Example: RET
|
Opcode
|
Description
|
Flag Status
|
RC
|
Return on Carry
|
CY = 1
|
RNC
|
Return on no Carry
|
CY = 0
|
RP
|
Return on positive
|
S = 0
|
RM
|
Return on minus
|
S = 1
|
RZ
|
Return on zero
|
Z = 1
|
RNZ
|
Return on no zero
|
Z = 0
|
RPE
|
Return on parity even
|
P = 1
|
RPO
|
Return on parity odd
|
P = 0
|
|
none
|
Return from subroutine conditionally
|
The program sequence is transferred from the subroutine to the calling program based on the specified flag of the PSW as described below. The two bytes from the top of the stack are copied into the program counter, and program execution begins at the new address.
Example: RZ
|
PCHL
|
none
|
Load program counter with HL contents
|
The contents of registers H and L are copied into the program counter. The contents of H are placed as the high-order byte and the contents of L as the low-order byte.
Example: PCHL
|
RST
|
0-7
|
Restart
|
The RST instruction is equivalent to a 1-byte call instruction to one of eight memory locations depending upon the number. The instructions are generally used in conjunction with interrupts and inserted using external hardware. However these can be used as software instructions in a program to transfer program execution to one of the eight locations. The addresses are:
Instruction
|
Restart Address
|
RST 0
|
0000H
|
RST1
|
0008H
|
RST 2
|
0010H
|
RST 3
|
0018H
|
RST 4
|
0020H
|
RST 5
|
0028H
|
RST 6
|
0030H
|
RST 7
|
0038H
|
The 8085 has four additional interrupts and these interrupts generate RST instructions internally and thus do not require any external hardware. These instructions and their Restart addresses are:
Interrupt
|
Restart Address
|
TRAP
|
0024H
|
RST 5.5
|
002CH
|
RST 6.5
|
0034H
|
RST 7.5
|
003CH
|
|
LOGICAL INSTRUCTIONS
Opcode
|
Operand
|
Explanation of Instruction
|
Description
|
CMP
|
R
M
|
Compare register or memory with accumulator
|
The contents of the operand (register or memory) are M compared with the contents of the accumulator. Both contents are preserved . The result of the comparison is shown by setting the flags of the PSW as follows:
if (A) < (reg/mem): carry flag is set
if (A) = (reg/mem): zero flag is set
if (A) > (reg/mem): carry and zero flags are reset
Example: CMP B or CMP M
|
CPI
|
8-bit data
|
Compare immediate with accumulator
|
The second byte (8-bit data) is compared with the contents of the accumulator. The values being compared remain unchanged. The result of the comparison is shown by setting the flags of the PSW as follows:
if (A) < data: carry flag is set
if (A) = data: zero flag is set
if (A) > data: carry and zero flags are reset
Example: CPI 89H
|
ANA
|
R
M
|
Logical AND register or memory with accumulator
|
The contents of the accumulator are logically ANDed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY is reset. AC is set.
Example: ANA B or ANA M
|
ANI
|
8-bit data
|
Logical AND immediate with accumulator
|
The contents of the accumulator are logically ANDed with the
8-bit data (operand) and the result is placed in the
accumulator. S, Z, P are modified to reflect the result of the
operation. CY is reset. AC is set.
Example: ANI 86H
|
XRA
|
R
M
|
Exclusive OR register or memory with accumulator
|
The contents of the accumulator are Exclusive ORed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY and AC are reset.
Example: XRA B or XRA M
|
XRI
|
8-bit data
|
Exclusive OR immediate with accumulator
|
The contents of the accumulator are Exclusive ORed with the 8-bit data (operand) and the result is placed in the accumulator. S, Z, P are modified to reflect the result of the operation. CY and AC are reset.
Example: XRI 86H
|
ORA
|
R
M
|
Logical OR register or memory with accumulator
|
The contents of the accumulator are logically ORed with M the contents of the operand (register or memory), and the result is placed in the accumulator. If the operand is a memory location, its address is specified by the contents of HL registers. S, Z, P are modified to reflect the result of the operation. CY and AC are reset.
Example: ORA B or ORA M
|
ORI
|
8-bit data
|
Logical OR immediate with accumulator
|
The contents of the accumulator are logically ORed with the 8-bit data (operand) and the result is placed in the accumulator. S, Z, P are modified to reflect the result of the operation. CY and AC are reset.
Example: ORI 86H
|
RLC
|
none
|
Rotate accumulator left
|
Each binary bit of the accumulator is rotated left by one position. Bit D7 is placed in the position of D0 as well as in the Carry flag. CY is modified according to bit D7. S, Z, P, AC are not affected.
Example: RLC
|
RRC
|
none
|
Rotate accumulator right
|
Each binary bit of the accumulator is rotated right by one position. Bit D0 is placed in the position of D7 as well as in the Carry flag. CY is modified according to bit D0. S, Z, P, AC are not affected.
Example: RRC
|
RAL
|
none
|
Rotate accumulator left through carry
|
Each binary bit of the accumulator is rotated left by one position through the Carry flag. Bit D7 is placed in the Carry flag, and the Carry flag is placed in the least significant position D0. CY is modified according to bit D7. S, Z, P, AC are not affected.
Example: RAL
|
RAR
|
none
|
Rotate accumulator right through carry
|
Each binary bit of the accumulator is rotated right by one position through the Carry flag. Bit D0 is placed in the Carry flag, and the Carry flag is placed in the most significant position D7. CY is modified according to bit D0. S, Z, P, AC are not affected.
Example: RAR
|
CMA
|
none
|
Complement accumulator
|
The contents of the accumulator are complemented. No flags are affected.
Example: CMA
|
CMC
|
none
|
Complement carry
|
The Carry flag is complemented. No other flags are affected.
Example: CMC
|
STC
|
none
|
Set Carry
|
Set Carry
Example: STC
|
CONTROL INSTRUCTIONS
Opcode
|
Operand
|
Explanation of Instruction
|
Description
|
NOP
|
none
|
No operation
|
No operation is performed. The instruction is fetched and decoded. However no operation is executed.
Example: NOP
|
HLT
|
none
|
Halt and enter wait state
|
The CPU finishes executing the current instruction and halts any further execution. An interrupt or reset is necessary to exit from the halt state.
Example: HLT
|
DI
|
none
|
Disable interrupts
|
T the interrupt enable flip-flop is reset and all the in teinterrupts except the TRAP are disabled. No flags are afaffected.
Example: DI
|
EI
|
none
|
Enable interrupts
|
The interrupt enable flip-flop is set and all interrupts are enabled. No flags are affected. After a system reset or the acknowledgement of an interrupt, the interrupt enable flipflop is reset, thus disabling the interrupts. This instruction is
necessary to reenable the interrupts (except TRAP).
Example: EI
|
RIM
|
none
|
Read interrupt mas
|
This is a multipurpose instruction used to read the status of interrupts 7.5, 6.5, 5.5 and read serial data input bit. The instruction loads eight bits in the accumulator with the following interpretations.
Example: RIM
|
SIM
|
none
|
Set interrupt mask
|
This is a multipurpose instruction and used to implement the 8085 interrupts 7.5, 6.5, 5.5, and serial data output. The instruction interprets the accumulator contents as follows.
Example: SIM
|
Memory Read Machine Cycle of 8085:
-
The memory read machine cycle is executed by the processor to read a data byte from memory.
-
The processor takes 3T states to execute this cycle.
-
The instructions which have more than one byte word size will use the machine cycle after the opcode fetch machine cycle.
Fig- Timing Diagram for Memory Read Machine Cycle
Memory Write Machine Cycle of 8085:
-
The memory write machine cycle is executed by the processor to write a data byte in a memory location.
-
The processor takes, 3T states to execute this machine cycle.
Fig - Timing Diagram for Memory Write Machine Cycle
Programs
Addition of two 8-bit numbers program
LXI H 4000H : HL points 4000H
MOV A, M : Get first operand
INX H : HL points 4001H
ADD M : Add second operand
INX H : HL points 4002H
MOV M, A : Store result at 4002H
HLT : Terminate program execution
Flowchart:
Subtraction of two 8-bit numbers program
LXI H 4000H : HL points 4000H
MOV A, M : Get first operand
INX H : HL points 4001H
SUB M : Subtract second operand
INX H : HL points 4002H
MOV M, A : Store result at 4002H
HLT : Terminate program execution
SYLLABUS : INTERFACING CONCEPTS
Peripheral I/O instructions – device selection and data transfer – Input Interfacing – Practical Input interfacing using decoders – Interfacing O/P Devices: LED and 7 segment Display – Interfacing memory – Memory
time and unit states.
8085 I/O INTERFACING
I/O STRUCTURE OF A TYPICAL MICROCOMPUTER:
There are three major types of data transfer between the microcomputer and art I/O device. They are,
-
Programmed I/O : In programmed I/O the data transfer is accomplished through an I/O port and controlled by software.
-
Interrupt driven I/O : In interrupt driven I/O, the I/O device will interrupt the processor, and initiate data transfer.
-
Direct memory access (DMA) : In DMA, the data transfer between memory and I/O can be performed by bypassing the microprocessor.
INTERFACING I/O AND PERIPHERAL DEVICES:
1. For data transfer from input device to processor the following operations are performed.
-
The input device will load the data to the port.
-
When the port receives a data, it sends message to the processor to read the data.
-
The processor will read the data from the port.
-
After a data have been read by the processor the input device will load the next data into the port.
2. For data transfer from processor to output device the following operations are performed.
-
The processor will load the data to the port.
-
The port will send a message to the output device to read the data.
-
The output device will read the data from the port.
-
After the data have been read by the output device the processor can load the next data to the port.
-
The various INTEL 110 port devices are 8212, 8155/8156, 8255, 8355 and 8755.
-
8212
-
The 8212 is a 24 pin IC.
-
It consists of eight number of D-type latches.
-
It has 8-input lines DI1 to DI8 and 8-output lines DO1 to DO8
-
The 8212 can be used as an input or output device
-
It has two selecting device DS1 (low) and DS2.
Fig - Internal address of 8155
8155:
-
It has two numbers of 8-bit parallel I/O port (port-A and B)
-
One number of 6-bit parallel I/O port (port-C).
-
It has 14 bit timer (operating in 4 modes).
-
It has six internal addresses.
-
It has one chip select pin CS (low).
8156:
-
It has two numbers of 8-bit parallel I/O port (port-A and B)
-
One number of 6-bit parallel 1 port (port-C).
-
It has 14 bit timer (operating in 4 modes).
-
It has six internal addresses.
-
It has one chip select pin CS (low).
Fig - Internal address of 8156
8255:
-
It has 3 numbers of 8-bit parallel I/O ports (port A, B and C).
-
Port-A can be programmed in mode-0 mode-1 or mode-2 as input or output port.
-
Port-B can be programmed in mode-1 and mode-2 as 1/Oport.
-
When ports A and B are in mode-0, the port-C can be used as I/O port.
-
One logic low chip select (CS) pin.
-
It requires four internal addresses
8355:
-
It has 2KB ROM.
-
It has two number of 8 bit port (A,B).
-
It has one CS(low).
-
It has four internal addresses.
8755:
-
It has 2Kb EPROM.
-
It has two number of 8 bit port (A,B).
-
It has one CS(low).
-
It has four internal addresses.
Fig - Internal address of 8255
Fig - Internal address of 8355
Fig - Internal address of 8755
Fig - Internal address of 8255
Fig - Memory and I/O Port Interfacing with 8085
7 SEGMENT LED INTERFACING
Statement: Interface an 8-digit 7 segment LED display using 8255 to the 8085 microprocessor system and write an 8085 assembly language routine to display message on the display.
HARDWARE FOR EIGHT DIGIT SEVEN SEGMENT DISPLAY INTERFACE
Fig. shows the multiplexed eight 7-segment display connected in the 8085 system using 8255. In this circuit port A and port B are used as simple latched output ports. Port A provides the segment data inputs to the display and port B provides a means of selecting a display position at a time for multiplexing the displays. A0-A7 lines are used to decode the addresses for 8255. For this circuit different addresses are:
PA = 00H PB = 01H
PC = 02H CR = 03H.
The register values are chosen in Fig. such that the segment current is 80 mA. This current is required to produce an average of 10 mA per segment as the displays are multiplexed. In this type of display system, only one of the eight display position is 'ON' at any given instant. Only one digit is selected at a time by giving low signal on the corresponding control line. Maximum anode current is 560 mA (7-segments x 80 mA = 560 mA), but the average anode current is 70 mA.
INTERFACING SCHEME
SOFTWARE FOR EIGHT DIGIT SEVEN SEGMENT DISPLAY
For 8255, Port A and B are used as output ports. The control word format of 8255 according to hardware connections is:
Source program:
-
SOFTWARE TO INITIALIZE 8255:
-
MVI A, 80H : Load control word in AL
-
OUT CR : Load control word in CR
SUBROUTINE TO DISPLAY MESSAGE ON MULTIPLEXED LED DISPLAY:
SET UP REGISTERS FOR DISPLAY:
-
MVI B, 08H : load count
-
MVI C, 7FH : load select pattern
-
LXI H, 6000B : starting address of message
DISPLAY MESSAGE:
-
DISP 1: MOV A, C : select digit
-
OUT PB
-
MOV A, M : get data
-
OUT PA : display data
-
CALL DELAY : wait for some time
-
DISP 1: MOV A, C
-
RRC
-
MOV C, A : adjust selection pattern
-
INX H
-
DCR B : Decrement count
-
JNZ DISP 1 : repeat 8 times
-
RET
Note: This "display message subroutine" must be called continuously to display the 7-segment coded message stored in the memory from address 6000H.
Delay Subroutine:
-
Delay: LXI D, Count
-
Back: DCX D
-
MOV A, D
-
ORA E
-
JNZ Back
-
RET
|
MEMORY INTERFACING WITH 8085
TYPICAL EPROM AND STATIC RAM:
-
A typical semiconductor memory IC will have n address pins, m data pins (or output pins).
-
Having two power supply pins (one for connecting required supply voltage (V and the other for connecting ground).
-
The control signals needed for static RAM are chip select (chip enable), read control (output enable) and write control (write enable).
-
The control signals needed for read operation in EPROM are chip select (chip enable) and read control (output enable).
DECODER:
It is used to select the memory chip of processor during the execution of a program. No of IC's used for decoder is,
Table - Number of Address Pins and Data Pins in Memory ICs
Examples of Memory Interfacing..(Contd) - Page2
Fig - Block diagram and Truth table of 2-4 decoder
Fig - Block diagram and Truth table of 3-8 decoder
SYLLABUS :
PARALLEL AND SERIAL INTERFACE
Introduction to programmable Peripheral Interface 8255 – Pin Diagram – Architecture – Modes of Operation: I/O and BSR – Architecture and operation of 8251 (USART).
INTERRUPT AND TIMER LOGIC
8085 interrupts - Architecture of programmable interrupt controller 8259 –– Architecture of 8254 Programmable Interval timer / counter – Modes of Operation of 8254 – Generating square wave using 8254.
APPLICATIONS
Time delay program – Traffic Light Control System – Water Level Controller – Stepper Motor Control –Interfacing DAC – Interfacing ADC – Temperature measurement.
Programmable Peripheral Interface (PPI)
Data Bus BuffeThis three-state bi-directional 8-bit buffer is used to interface the 8255 to the system data bus. Data is transmitted or received by the buffer upon execution of input or output instructions by the CPU. Control words and status informa-tion are also transferred through the data bus buffer.
Read/Write and Control Logic
The function of this block is to manage all of the internal and external transfers of both Data and Control or Status words. It accepts inputs from the CPU Address and Control busses and in turn, issues commands to both of the Control Groups.
(CS) Chip Select. A "low" on this input pin enables the communcation between the 8255 and the CPU.
(RD) Read. A "low" on this input pin enables 8255 to send the data or status information to the CPU on the data bus. In essence, it allows the CPU to "read from" the 8255.
(WR) Write. A "low" on this input pin enables the CPU to write data or control words into the 8255.
(A0 and A1) Port Select 0 and Port Select 1. These input signals, in conjunction with the RD and WR inputs, control the selection of one of the three ports or the control word register. They are normally connected to the least significant bits of the address bus (A0 and A1).
(RESET) Reset. A "high" on this input initializes the control register to 9Bh and all ports (A, B, C) are set to the input mode.
A1
|
A0
|
SELECTION
|
0
|
0
|
PORT A
|
0
|
1
|
PORT B
|
1
|
0
|
PORT C
|
1
|
1
|
CONTROL
|
Group A and Group B Controls
The functional configuration of each port is programmed by the systems software. In essence, the CPU "outputs" a control word to the 8255. The control word contains information such as "mode", "bit set", "bit reset", etc., that initializes the functional configuration of the 8255. Each of the Control blocks (Group A and Group B) accepts "commands" from the Read/Write Control logic, receives "control words" from the internal data bus and issues the proper commands to its associated ports.
Ports A, B, and C
The 8255 contains three 8-bit ports (A, B, and C). All can be configured to a wide variety of functional characteristics by the system software but each has its own special features or "personality" to further enhance the power and flexibility of the 8255.
Port A One 8-bit data output latch/buffer and one 8-bit data input latch. Both "pull-up" and "pull-down" bus-hold devices are present on Port A.
Port B One 8-bit data input/output latch/buffer and one 8-bit data input buffer.
Port C One 8-bit data output latch/buffer and one 8-bit data input buffer (no latch for input). This port can be divided into two 4-bit ports under the mode control. Each 4-bit port contains a 4-bit latch and it can be used for the control signal output and status signal inputs in conjunction with ports A and B.
Block Diagram of the 8255 Programmable Peripheral Interface (PPI)
Mode Definition Format
Share with your friends: |