Experiment-5 Reading a number from One Port and Sending it to another Port 8086 Programming by Ravinder Nath Rajotiya - April 15, 2021May 9, 20220 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle Aim: Write a Program to read 16 bit Data from a port and display the same in another port.Objectives: [Equipment Require:Program to display data on various ports Using KitProcedureCommand word for 8255Port AddressesProgram to display the LEDs on various ports interfaced on 8255 portsViVa Questions: Aim: Write a Program to read 16 bit Data from a port and display the same in another port. Objectives: [ To learn configuring of Key board and display module with 8086 microprocessor using 8255PPI Design algorithm and develop a program for accepting data from oneport and displaying it to LCD connected to other port. Equipment Require: 8255 Display Module, 8086 trainer Kit Theory: A Simple approach We can make use of the 8086 IN and OUT instruction to read the data from the device attached to a port and send the data to another port. We can access the ports using direct addressing or indirect addressing Direct address can be provided in the instruction Indirect address is loaded in DX register. here is simple program statements for the reading from a port and writing to another port. MOV DX, 0125h ; Load DX with the input port address IN AL, DX ; Read the data in register AL from the specified port MOV DX, 0135h ; Load the output port address in DX register OUT DX, AL ; Transfer the data in AL at the specified port HLT Program to display data on various ports Using Kit Figure below shows the arrangement of the 8-LED on PA, PB, PC and the data lines. When the users write certain binary data on these ports, the LED whose bit is high will glow. Thus for example if we pass AA on portA the its equivalent binary 10101010 so the LEDs corresponding to high (‘1’) will glow. Procedure Connect the card to the 50-pin FRC cable. Ensure pin-1 of the card is connected to pin-1 of the kit bus connector Select SW-2 on card to OFF position and Enter the program given next in the kit memory using ‘S’ (SUB_MIR) command Execute the program by ‘GO’ command. Observe the display on the LEDs corresponding to the data sent on a port and also on the data lines LEDs Press SW1 on the card and observe the LEDs status as per the program given next. Command word for 8255 D7 D6 D5 D4 D3 D2 D1 D0 CW Description 1 0 0 0 0 0 0 0 80h All ports as o/p Port Addresses D7 D6 D5 D4 D3 D2 D1 D0 Port Address PORT 1 0 0 0 0 0 0 0 80h PA 1 0 0 0 0 0 1 0 82h PB 1 0 0 0 0 1 0 0 84h PC 1 0 0 0 0 1 1 0 88h CWR Program to display the LEDs on various ports interfaced on 8255 ports Here we configure the control word register in I/O mode with all ports as simple outputs Address OPCODE LABEL MNEMONICS Comment Description 1000:0100 BO 80 STSRT: MOV AL, 80 Configure PA,PB,PC as o/p : 0102 BA 86 00 MOV DX, 86 :0105 EE OUT DX, AL OBSERVE 80(10000000) ON DATA LINE ledS :0106 B0 AA LOOP: MOV AL, AAh :0108 BA 80 00 MOV DX, 80h :010B EE OUT DX, AL Observe Port-A LEDs :010C BA 82 00 MOV DX, 82h :010F EE OUT DX, AL Observe Port-B LEDs :0110 BA 84 00 MOV DX, 84h :0113 EE OUT DX, AL Observe Port-C LEDs :0114 B9 FF FF MOV CX, FFFFh :0117 CD AA INT AA CALL DELAY Sub Routine :0119 B0 55 MOV AL, 55h :011B BA 80 00 MOV DX, 80h :011E EE OUT DX, AL Observe Port-A LEDs :011F BA 82 00 MOV DX, 82h :0122 EE OUT DX, AL Observe Port-B LEDs :0123 BA 84 00 MOV DX, 84h :0126 EE OUT DX, AL Observe Port-C LEDs :0127 B9 FF FF MOV CX, FFFFh :012A CD AA INT AA Call Delay :012C EB D8 JMP 0106 LOOP Back Outputs: Observe the outputs on PA, PB, PC Press SW1 and again observe the LED display on various ports. ViVa Questions: Que-1 : Write the control word format for configuring all ports in simple i/o mode Ans: D7 D6 D5 D4 D3 D2 D1 D0 CW Description 1 0 0 0 0 0 0 0 80h All ports as o/p i/o mode Gp A in mode-0 PA as o/p PCUpper as o/p Gp as mode-0 PB as o/p PCLower as o/p Que 2: What is the purpose of INT AA ? Ans: This is an software interrupt call. interrupt number is AA. this interrupt causes the call to delay subroutine. Que 3: What are the port address used in this program for various ports of 8255? Ans: PA address = 80h PB address = 80h PC address = 80h CW Register address = 80h Share on Facebook Share Send email Mail Print Print