You are on page 1of 4

6/17/2016

THE8255PROGRAMMABLEPERIPHERALINTERFACE~ComputerScienceeGuru

The8255isawidelyused,programmable,parallelI/Odevice.
Itcanbeprogrammedtotransferdataundervariousconditions,fromsimpleI/OtointerruptI/O.
Itisflexible,versatileandeconomicalandcomplex.
The8255has24I/Opinsthatcanbegroupedprimarilyintotwo8bitparallelports:AandB,withtheremaining8bitsaport
C.The8bitsofportCcanbeusedasindividualbitsorbegroupedintwo4bitports:CUPPER(CU)andCLOWER(CL),as
showninthefigure1.1.Thefunctionsoftheseportsaredefinedbywritingacontrolwordinthecontrolregister.

Figure1.2showsallthefunctionsof8255classifiedaccordingtotwomodes:theBitSet/Reset(BSR)modeandI/Omode.
TheBSRmodeisusedtosetorresetthebitsinportC.TheI/Omodeisfurtherdividedintothreemodes:Mode0,Mode1
andMode2.InMode0,allportsfunctionassimpleI/Oports.Mode1isahandshakemodewherebyPortsAand/orBuse
bits from port C as handshake signals. In Mode 2 Port A can be set up for bidirectional data transfer using handshaking
signalsfromPortC,andPortBcanbesetupeitherinMode0orMode1.
BlockDiagramofthe8255

CONTROLLOGIC

http://lectnote.blogspot.in/2009/12/8255programmableperipheralinterface.html

1/4

6/17/2016

THE8255PROGRAMMABLEPERIPHERALINTERFACE~ComputerScienceeGuru

(Read):ThiscontrolsignalenablestheReadoperation.Whenthesignalislow,theMPUreadsdatafroaselected
I/OPortofthe8255.

(Write):Thiscontrolsignalenablesthewriteoperation.Whenthesignalgoeslow,MPUwritesintoaselectedI/O
Portorcontrolregister.
RESET(Reset):Thisisanactivehighsignalitclearsthecontrolregisterandsetsallportsintheinputmode.
,A0andA1:Thesesaredeviceselectsignals.ChipSelectisconnectedtoadecodedaddress,andA0andA1
aregenerallyconnectedtoMPUaddresslinesA0andA1respectively

CONTROLWORD
Figure1.5showsaregistercalledthecontrolregister.Thecontentsofthisregistercalledcontrolword.Thisregistercanbe
accessedtowriteacontrolwordwhenA0andA1areatlogic1.Thiscontrolregisterisnotaccessibleforareadoperation.
BitD7ofthecontrolregisterspecifieseitherI/OfunctionortheBitSet/Resetfunction.IfbitD7=1,bitsD6D0determines
I/Ofunctionsinvariousmodes.IfbitD7=0,PortCoperatesintheBitSet/Reset(BSR)mode.TheBSRcontrolworddoes
notaffectthefunctionsofPortAandPortB.

Tocommunicatewithperipheralsthroughthe8255,threestepsarenecessary:

http://lectnote.blogspot.in/2009/12/8255programmableperipheralinterface.html

2/4

6/17/2016

THE8255PROGRAMMABLEPERIPHERALINTERFACE~ComputerScienceeGuru

1.DeterminetheaddressofportsA,BandCandofthecontrolregisteraccordingtothechipselectlogicandaddresslines
A0andA1.
2.Writethecontrolwordinthecontrolregister.
3.WriteI/OinstructionstocommunicatewithperipheralsthroughPortsA,BandC.
OperatingModes

Mode0:SimpleInputorOutput
Inthismode,portsA,Bareusedastwosimple8bitI/OportsandportCastwo4bitports.Eachportcanbeprogrammed
tofunctionassimplyaninputportoranoutputport.Theinput/outputfeaturesinMode0areasfollows.

1.Outputsarelatched.
2.Inputsarenotlatched.
3.Portsdonthavehandshakeorinterruptcapability.
Mode1:InputorOutputwithHandshake

Inthismode,handshakesignalsareexchangedbetweentheMPUandperipheralspriortodatatransfer.Thefeaturesofthe
modeincludethefollowing:

1.Twoports(AandB)functionas8bitI/Oports.Theycanbeconfiguredaseitherasinputoroutputports.
2.EachportusesthreelinesfromortCashandshakesignals.TheremainingtwolinesofPortCcanbeusedforsimpleI/O
operations.
3.InputandOutputdataarelatched.
4.Interruptlogicissupported.
Mode2:BidirectionalDataTransfer
This mode is used primarily in applications such as data transfer between two computers. In this mode, Port A can be
configured as the bidirectional port and Port B either in Mode 0 or Mode 1. Port A uses five signals from Port C as
handshake signals for data transfer. The remaining three signals from port C can be used either as simple I/O or as
handshakeforportB.
BSR(BitSet/Reset)Mode
The BSR mode is concerned only with the eight bits of port C, which can be set or reset by writing an appropriate control
word in the control register. A control word with bit D7 =0 is recognized as a BSR control word, and it does not alter any
http://lectnote.blogspot.in/2009/12/8255programmableperipheralinterface.html

3/4

6/17/2016

THE8255PROGRAMMABLEPERIPHERALINTERFACE~ComputerScienceeGuru

previouslytransmittedcontrolwordwithbitD7=1thustheI/OoperationsofportsAandBarenotaffectedbyaBSRcontrol
word. In BSR mode, individual bits of port C can be used for applications such as an on/off switch. Ports A and B are not
affectedbytheBSRMode.
BSRCONTROLWORD

Thiscontrolword,whenwritteninthecontrolregister,setsorresetsonebitatatime,

http://lectnote.blogspot.in/2009/12/8255programmableperipheralinterface.html

4/4

You might also like