Download as pdf
Download as pdf
You are on page 1of 23
Lik PORTA, fs) PA7-PAO rm oer 0-07 ke PC7-PCA org —— | a re B Ld elite pca-pco WR (cls) 10 ee Cony fer Control fo Denia) PB7-PBO AL RESET iI hm eto cS “* PORT A, PORT B and PORT C O These are 8 bits 10 ports and works as follows: [ron | MODEO | MODE1 | MODE? | _BsRMODE PORT JS ‘YES YES YES NO PORTB YES YES NO NO PoRTC ves NO [HS] NO [HS] YES: Problem-3 Interface an 8255 with 8086 to work as an 1/0 port. Initialize port A as output port, port B as input port and port C as output port. Port A address should be 0740H. Write a program to sense switch positions SW,-SW, connected at port B. The sensed pattern is to be displayed on port A, to which 8 LEDs are connected, while the port C lower displays number of on switches out of the total eight switches Problem-3 Control word Format Control word = 82 H selection Port C Problem-5 Write a program to generate a square wave at the LSB of the data bus of an output port with address F767H. MOV DX,F767H AGAIN: MOV AL,OFFH OUT DX,AL CALL DELAY_IMS MOV AL,00 OUT DX,AL CALL DELAY_IMS IMP AGAIN Assume procedure DELAY_1MS havin DELAY_IMS PROC NEAR MOV CX.N HERE: NOP LOOP HERE 4202) DELAY_IMS ENDP 7 Imsecs delay Problem-4 Write a program for getting a delay of 100 msecs. MOV CX.N 4 HERE ADD AX,0 5 LOOP HERE 17/5 12 MHz Total cycles of delay = 4 + SN +(17 x (N~1))+5=4+22N 12=22N-8 Total delay time = 100msecs = (22N ~ 8) « 0.083usecs For 100msecs delay time, the value of N = ( (100msecs/,083usecs) + 8)/22 54765 DSED H Problem-6 In a pressure monitoring environment, 10 pressure sensors have been connected. The pressure from these sensors has to be read at intervals of 5 msecs. Write a program to read the sensor values from input ports having address OFFOH to OFF9H Problem-6 MOV DX.OFFOH MOV CX, 10H ENTR IN AL,OX MOV TEMP[SI]AL TEMP is memory to store the pressure 4 Inc st INC Dx CALL DELAY_FUNC LOOP ENT! EXIT DELAY_FUNC PROC NEAR MOV CX,08C2H 1/4 HERE: NOP 13 //approx 5 ms. LOOP HERE //17/5 RET DELAY_FUNC END Lainput Onoutput Mode selection Port Control word Format Qe | >, D =D, Dy PortAMode Porta Cone Mtoae Pot Tower 1-I/P_ 1-1/P_ o-Modeo 1-1/P 1-1/P 0-0/P 0-0/P Moder 0-O/P 0-O/P Group A Group B Programming 8255 MOV DX OFFF6h; MOV AL 80h: OUT DX AL: Port A MOV DX OFFFOh: OUT DXAL: Port 8 MOV OX OF FF2h OUT DX AL Port ¢ MOV OX OFFF4h; OUT DX AL: @ Modes of operation of 8255 Read 12 switches and display switch Gn 12 LEDs with 8255H and -00H PEPPER ERE Example equ 06h 2 equ 0h qu @2h equ oat Input Read 4.3 | 021 01 Don't care 4.3 | 021 01 Don't care Example: Connect 3 LEDs to Port C. Blink one LED after another at regular intervals of Ims 8255- Base address 00,, MOV AL, our cr. MOV AL, our cr, MOV AL, our cr, MOV AL, our CR, ‘OOH AL osH AL on AL osH AL MOV AL, O1H our cR. AL MOV AL, O44 OUT CR, AL JUMP Pins and Signals ‘AD,~AD,; (Bidirectional) Low order address bus; these are multiplexed with data sss the symbol A stead of AD, for example Ay-Ays: ‘of AD, for 8086

You might also like