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 switchesProblem-3
Control word Format Control word = 82 H
selection
Port CProblem-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 delayProblem-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 HProblem-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 OFF9HProblem-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
ENDLainput Onoutput Mode
selection
PortControl 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 BProgramming 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 8255Read 12 switches and display switch
Gn 12 LEDs with 8255H and
-00H
PEPPER EREExample
equ 06h
2 equ 0h
qu @2h
equ oatInput Read4.3 | 021 01
Don't care4.3 | 021 01
Don't careExample: 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
JUMPPins 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