You are on page 1of 10

The IN and OUT instructions in the 8086 microprocessor: IN AL, immmediate byte IN AL, DX IN AX, immediate byte IN AX,

DX Input from port into AL or AX. Second operand is a port number. If required to access port number over 255 - DX register should be used. OUT immediate byte, AL OUT immediate byte, AX OUT DX, AL OUT DX, AX Output from AL or AX to port. First operand is a port number. If required to access port number over 255 - DX register should be used.

Examples: Q1. Write an 8086 assembly language procedure to read an ASCII character from a keyboard via PORT A of an 8255 PPI when PORT C bit PC4 is strobed low. Assume a base address of 20H. PORTA PORTC EQU 20H EQU 22H 23H

CONTROL EQU READ PROC NEAR

MOV AL, 98H ; 1001 1000 OUT CONTROL, AL READ1: IN AL, PORTC ; Is Strobe PC4 Low? ; Initialize PORTS

TEST AL, 10H ; 0001 0000 JNZ READ1

IN AL, PORTA ; Read ASCII Character RET READ ENDP

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Q2. Write an 8086 assembly language procedure to send an ASCII character, stored in register AH, to a printer via PORT B of an 8255 PPI when PORT C bit PCO is strobed low and after an active low acknowledge signal is detected on PORT C bit PC5 from the printer. Assume a base address of 60H. PORTB EQU 61H PORTC EQU 62H

CONTROL EQU 63H PRINT PROC NEAR MOV AL, 88H ; 1000 1000 OUT CONTROL, AL PRINT1: IN AL, PORTC ; Is Acknowledge PC5 Low?

TEST AL, 20H ; 0010 000 JNZ PRINT1 ;------------------------------------MOV AL, AH ; send character OUT PORTB, AL ;------------------------------------MOV AL, 0FEH ; 1111 1110

OUT PORTC, AL ; strobe output PC0 RET PRINT ENDP

8255 Programmable Peripheral Interface (PPI) Data Bus Buffer This 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 0 0 1

A0 0 1 0

SELECTION PORT A PORT B PORT C

1 Group A and Group B Controls

CONTROL

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

ANNA UNIVERSITY COIMBATORE-SYLLABUS MICROPROCESSOR ANDAPPLICATIONS UNIT I 8 BIT MICROPROCESSORARCHITECTURE 9 8085-Internal Architecture - Addressing modes - Instruction set -Timing diagramsInterrupts-Assembly language Programming UNIT II 16 BIT MICROPROCESSORARCHITECTURE 9 8086-Internal Architecture -Memory segmentation -Timing diagram -Interrupts-8086 CPU Hardware design- Maximum mode CPU Module - Minimum mode CPU module UNIT III 8086 INSTRUCTION SET & ASSEMBLY LANGUAGE 9 PROGRAMMING Addressing modes - Instruction set- Data transfer instructions- String instructionsLogical Instructions Arithmetic Instructions Transfer of control instructions -Processor

control Instructions -Assembly language programmingAssemblerUNIT IV SPECIAL PURPOSE SUPPORT DEVICES 9 8255A -Programmable peripheral interface - 8251A USART -8279- keyboard and display controller -8259 programmable Interrupt controller -8257 DMA controller -8254 programmableinterval timer -digital to analogand analog to digital converters UNIT V MEMORY AND I/O INTERFACING 9 Types of Main memory- SRAM -interfacing- DRAM -interfacing -I/O interfacingprogrammed I/O- Interrupt Driven I/O- DMA Interfacing Microcomputer to high power devices - Optical Motor shaft Encoders TEXT BOOKS: 1. DouglasV-HallMicroprocessorandinterfacing2/ETMH,2002. 2.Walter A-Tribel & Avtar SinghThe 8088 and 8086 Microprocessors programming -Interfacing -software -Hardware and Application 4/E Pearson/PHI 2003. REFERENCES: 3.John UffenbeckMicrocomputer and Microprocessors The 8080-8085 and Z-80 programmingInterfacin 4.g andTroubleshooting 3rd Edition- -Pearson Education,2000 5.John Uffenbeck The 8086 family Design-programmingand interfacing-3/Epearson Education 6. RameshGaonkar-MicroprocessorArchitectureProgrammingandApplication with 8085-PenramPublications pvt Ltd-5 E/Pearson 2000 .

DEPARTMENT OF ECE Microprocessor and application UNIT - I PART-A

1. What is Microprocessor? It is a program controlled semiconductor device (IC}, which fetches, decodes and executes instructions. 2. What are the basic units of a microprocessor? The basic units or blocks of a microprocessor are ALU, an array of registers and control unit. 3. What is Software and Hardware? The Software is a set of instructions or commands needed for performing a specific task by a programmable device or a computing machine. The Hardware refers to the components ordevices used to form computing machine in which the Software can be run and tested. Without software the Hardware is an idle machine. 4. Define bit, byte and word. A digit of the binary number or code is called bit. Also, the bit is the fundamental storage unit of computer memory. The 8-bit (8-digit) binary number or code is called byte and16-bit binary number or code iscalled word. (Some microprocessor manufactures refer the basic data size operated by the processor as word). 5. What is a bus? Bus is a group of conducting lines that carries data, address and control signals. 6. Why data bus is bi-directional? The microprocessor has to fetch (read) the data from memory or input devicefor processing and after processing, it has to store (write) the data to memory or output device. Hence the data bus is bi-directional. 7. Why address bus is unidirectional? The address is an identification number used by the microprocessor to identify or access a memory location or I / O device. It is an output signal from the processor. Hence the address bus is unidirectional. 8. What is the function of microprocessor in a system? The microprocessor is the master in the system, which controls all the activity of the system. It issues address and control signals and fetches the instruction and data from memory. Then it executes the instruction to take appropriate action.

9. Define machine cycle. Machine cycle is defined as the time required to complete one operation of accessing memory, I/O, or acknowledging an external request. This cycle may consist of three to six Tstates. 10. Define T-State. T-State is defined as one subdivision of the operation performed in one clock period. These subdivisions are internal states synchronized withthesystemclock,andeachT-State is precisely equal to one clockperiod. 11. What is the need for system clock and how it is generated in 8085? The system clock is necessary for synchronizing various internal operations or devices in the microprocessor and to synchronize the microprocessor with other peripherals in the system. 12.Draw and specify the complete bit configuration of 8085flag Register? D7 D6 D5 D4 D3 D2 D1 D0 S Z AC P CY S- Sign Flag.If D7 =1 , then sign flag is set, otherwise rest. Z-Zero flag. If ALU operation results in zero, then this flag is set, Otherwise it is reset. AC-Auxilliary flag. In an arithmetic operation ,when a carry is generated by

digit D3 and passed on to digit D4, the AC flag is set. Otherwise it is reset. P-Parity Flag. If the result of an arithmetic or logic operation has an even number of 1s then this flag is set. Otherwise it is reset. CY-Carry Flag. If an arithmetic operation results in a carry, the carry flag is set. Otherwise it is reset. 13.List the four operations commonly performed by MPU( Micro processingUnit)? Memory Read : Reads data (or instructions) from memory. Memory Write: Writes Data (or instructions) into memory. I/O Read: Accepts data from input devices. 14. What is the need for timing diagram? The timing diagram provides information regarding the status ofvarioussignals, when a machine cycle is executed. The knowledge of timing diagram is essential for system designer to select matched peripheral devices like memories, latches, ports, etc., to form a microprocessor system. 15. Define opcode and operand. Opcode (Operation code) is the part of an instruction / directive that identifies a specific operation. Operand is a part of an instruction / directive that represents a value on which the

You might also like