UnitThree MicroprocessorInput/OutputInterfacing - - PDF document

unit three
SMART_READER_LITE
LIVE PREVIEW

UnitThree MicroprocessorInput/OutputInterfacing - - PDF document

10/25/2016 UnitThree MicroprocessorInput/OutputInterfacing Thischapteroutlinessomeofthebasic methodsofcommunications,bothserial and


slide-1
SLIDE 1

10/25/2016 1

UnitThree

MicroprocessorInput/OutputInterfacing

  • Thischapteroutlinessomeofthebasic

methodsofcommunications,bothserial and parallel,betweenhumansormachinesand themicroprocessor.

  • WefirstintroducethebasicI/Ointerfaceand

discussdecoding forI/Odevices.

  • Then,weprovidedetailonparallel andserial

interfacing,bothofwhichhaveavarietyof applications.

slide-2
SLIDE 2

10/25/2016 2

  • Explaintheoperationofthebasicinputand
  • utputinterfaces.
  • Decodean8*,16*,and32*bitI/Odeviceso

thattheycanbeusedatanyI/Oportaddress.

  • Definehandshaking andexplainhowtouseit

withI/Odevices.

  • Interfaceandprogramthe82C55

programmableparallelinterface.

  • InterfaceLCDdisplays,LEDdisplays,

keyboards,ADC,DAC,andvariousother devicestothe82C55.

  • Interfaceandprogramthe16550serial

communicationsinterfaceadapter.

  • Interfaceandprogramthe8254

programmableintervaltimer.

  • (cont.)
slide-3
SLIDE 3

10/25/2016 3

  • Interfaceananalog*to*digitalconverter anda

digital*to*analogconverter tothe microprocessor.

  • InterfacebothDC andsteppermotors tothe

microprocessor.

  • (cont.)

! " #!$%#

  • I/Oinstructions(IN,INS,OUT,andOUTS)are

explained.

  • Alsoisolated (directorI/OmappedI/O)and

memory*mapped I/O,thebasicinput and

  • utputinterfaces,andhandshaking.
  • Knowledgeofthesetopicsmakesiteasierto

understandtheconnection andoperation of theprogrammable interface components andI/Otechniques.

slide-4
SLIDE 4

10/25/2016 4

"

  • Onetypeofinstructiontransfersinformation

toanI/Odevice(OUT).

  • Anotherreads fromanI/Odevice(IN).
  • Instructionsarealsoprovidedtotransfer

stringsofdatabetweenmemoryandI/O.

– INS andOUTS,foundexceptthe8086/8088

  • InstructionsthattransferdatabetweenanI/O

device andthemicroprocessor’saccumulator (AL,AX,orEAX)arecalled and .

  • TheI/OaddressisstoredinregisterDXasa

16*bitaddressorinthebyte(p8)immediately followingtheopcode asan8*bitaddress.

– Intelcallsthe8*bit form(p8)a& becauseitisstoredwiththeinstruction,usually inaROM

  • The16*bitaddress iscalleda

becauseitisstoredinaDX,and thenusedtoaddresstheI/Odevice.

slide-5
SLIDE 5

10/25/2016 5

OtherinstructionsthatuseDXtoaddress I/OaretheINS andOUTS instructions.

  • I/Oportsare8bits inwidth.

– a16*bitport isactuallytwo consecutive8*bit ports beingaddressed – a32*bitI/Oport isactuallyfour8*bitports

  • WhendataaretransferredusingIN orOUT,

theI/Oaddress,( orsimplyport), appearsontheaddressbus.

  • ExternalI/Ointerfacedecodestheport

numberinthesamemannerasamemory address.

– the8*bitfixedportnumber (p8)appearson addressbusconnectionsA7–A0 withbits A15–A8 equalto000000002 – connectionsaboveA15 areundefined for I/Oinstruction

slide-6
SLIDE 6

10/25/2016 6

  • The16*bitvariableportnumber (DX)

appearsonaddressconnectionsA15–A0.

  • Thefirst256I/Oport addresses(00H–FFH)

areaccessedbybothfixedandvariableI/O instructions.

– anyI/Oaddressfrom0100HtoFFFFH isonlyaccessedbythevariableI/Oaddress

  • InaPCcomputer,all16addressbusbits

aredecodedwithlocations0000H–03FFH.

– usedforI/OinsidethePContheISA ()bus

  • INS andOUTS instructionsaddressanI/O

deviceusingtheDXregister.

– butdonottransferdatabetweenaccumulator andI/OdeviceasdotheIN/OUTinstructions – Instead,theytransferdata betweenmemory andtheI/Odevice

  • Pentium4andCore2operatinginthe64*bit

mode havethesameI/Oinstructions.

  • Thereareno64*bitI/Oinstructions inthe64*

bitmode.

– mostI/Oisstill8bits andlikelywillremainso

slide-7
SLIDE 7

10/25/2016 7

'('"

  • TwodifferentmethodsofinterfacingI/O:

" and(".

  • InisolatedI/O,theIN,INS,OUT,andOUTS

transferdatabetweenthemicroprocessor’s accumulator ormemoryandtheI/Odevice.

  • Inmemory*mappedI/O,anyinstructionthat

referencesmemorycanaccomplishthe transfer.

  • ThePCdoesnotusememory*mappedI/O.
  • ThemostcommonI/Otransfertechnique

usedintheIntel*basedsystem isisolatedI/O.

– isolated describeshowI/Olocationsareisolated frommemoryinaseparateI/Oaddressspace

  • AddressesforisolatedI/Odevices,called

ports,areseparatefrommemory.

  • Becausetheportsareseparate,theusercan

expandthememorytoitsfullsizewithout usinganyofmemoryspace forI/Odevices.

slide-8
SLIDE 8

10/25/2016 8

  • AdisadvantageofisolatedI/Oisthatdata

transferredbetweenI/Oandmicroprocessor mustbeaccessedbytheIN,INS,OUT,and OUTS instructions.

  • Separatecontrolsignals fortheI/Ospaceare

developed(usingM/IOandW/R),which indicateanI/Oread(IORC)oranI/Owrite (RD)operation.

  • ThesesignalsindicateanI/Oportaddress,

whichappearsontheaddressbus,isused toselect theI/Odevice.

%)*#(Input/Output instructions.

slide-9
SLIDE 9

10/25/2016 9

$+ ThememoryandI/Omapsforthe8086/8088microprocessors.(a) IsolatedI/O.(b)Memory*mappedI/O.

– inthePC,isolatedI/O portsareusedtocontrol peripheraldevices – an8*bitportaddress is usedtoaccessdevices locatedonthesystem board,suchasthetimer andkeyboard interface – a16*bitport isusedto accessserialandparallel ports,video anddiskdrive systems

  • Memory*mappedI/Odoesnotuse theIN,INS,

OUT,orOUTS instructions.

  • Itusesanyinstructionthattransfersdata

betweenthemicroprocessorandmemory.

– treatedasamemorylocation inmemorymap

  • Advantage isanymemorytransferinstruction

canaccesstheI/Odevice.

  • Disadvantage isaportionofmemorysystem

isusedastheI/Omap.

– reducesmemoryavailable toapplications

slide-10
SLIDE 10

10/25/2016 10

$+, I/OmapofapersonalcomputerillustratingmanyofthefixedI/Oareas.

  • "'

– thePCusespartofI/Omap for dedicatedfunctions,asshownhere – I/Ospacebetweenports0000Hand 03FFH isnormallyreservedforthe systemandISAbus – portsat0400H–FFFFH aregenerally availableforuserapplications,main* boardfunctions,andthePCIbus – 80287coprocessoruses00F8H–00FFH, soIntelreservesI/Oports00F0H–00FFH

)

  • Thebasicinputdevice isasetofthree*state

buffers.

  • Thebasicoutputdevice isasetofdata

latches.

  • ThetermIN referstomovingdatafrom the

I/Odeviceinto themicroprocessor and

  • ThetermOUT referstomovingdataout of

themicroprocessorto theI/Odevice.

slide-11
SLIDE 11

10/25/2016 11

  • Three*statebuffers areusedtoconstructthe

8*bitinputportdepictedinFigure11–3.

  • ExternalTTLdataareconnectedtotheinputs
  • fthebuffers.

– bufferoutputsconnecttothedatabus

  • Thecircuitofallowstheprocessortoreadthe

contentsoftheeightswitchesthatconnectto any8*bit sectionofthedatabuswhenthe selectsignalbecomesalogic0.

$+. Thebasicinputinterface illustratingtheconnectionofeight switches.Notethatthe74ALS244isathree*statebuffer thatcontrolsthe applicationoftheswitchdatatothedatabus.

slide-12
SLIDE 12

10/25/2016 12

  • WhentheINinstructionexecutes,contents
  • ftheswitchescopy totheALregister.
  • Thisbasicinputcircuitisnotoptionaland

mustappearanytimeinputdataare interfacedtothemicroprocessor.

  • Sometimesitappearsasadiscretepartofthe

circuit,asshowninFigure11–3.

– alsobuiltintoaprogrammableI/Odevices

  • Sixteen* or32*bitdata canalsobeinterfaced

butisnotnearlyascommonas8*bitdata.

  • Receivesdatafromtheprocessorandusually

mustholditforsomeexternaldevice.

– latchesorflip*flops,likebuffersintheinput device,areoftenbuiltintotheI/Odevice

  • Fig11–4showshoweight light*emitting

diodes(LEDs)connecttotheprocessor throughasetofeight datalatches.

  • Thelatchstoresthenumberoutputbythe

microprocessorfromthedatabussothatthe LEDscanbelit withany8*bitbinarynumber.

slide-13
SLIDE 13

10/25/2016 13

$+/ Thebasicoutput interfaceconnectedtoasetof LEDdisplays.

  • Latcheshold thedatabecausewhenthe

processorexecutesanOUT,dataareonly presentonthedatabusforlessthan1.0s.

– theviewerwouldneverseetheLEDsilluminate

  • WhentheOUTexecutes,datafromAL,AX,
  • rEAXtransfertothelatchviathedatabus.
  • EachtimetheOUTexecutes,theSELsignal

activates,capturingdata tothelatch.

– dataarehelduntilthenextOUT

  • Whentheoutputinstructionisexecuted,data

fromtheALregister appearontheLEDs.

slide-14
SLIDE 14

10/25/2016 14

01+

  • ManyI/Odevicesacceptorrelease

informationslower thanthemicroprocessor.

  • AmethodofI/Ocontrolcalled1+
  • r+,synchronizestheI/Odevicewith

themicroprocessor.

  • Anexampleisaparallelprinterthatprintsa

fewhundredcharacterspersecond(CPS).

  • Theprocessorcansenddatamuchfaster.

– awaytoslowthemicroprocessordowntomatch speedswiththeprintermustbedeveloped

  • Fig11–5illustratestypicalinputandoutput

connectionsfoundonaprinter.

– datatransfersviadataconnections(D7–D0)

  • ASCIIdataareplacedonD7–D0,andapulse

isthenappliedtotheSTBconnection.

– BUSY indicatestheprinterisbusy – STB isaclockpulseusedtosenddatatoprinter

  • Thestrobesignal sendsorclocksthedata

intotheprintersothattheycanbeprinted.

– astheprinterreceivesdata,itplaceslogic1on theBUSY pin,indicatingitisprintingdata

slide-15
SLIDE 15

10/25/2016 15

FIGURE 11-5 The DB25 connector found on computers and the Centronics 36-pin connector found on printers for the Centronics parallel printer interface.

  • Thesoftwarepolls orteststheBUSY pinto

decidewhethertheprinterisbusy.

– Iftheprinter isbusy,theprocessorwaits – ifnot,thenextASCIIcharactergoestotheprinter

  • Thisprocessofinterrogatingtheprinter,or

anyasynchronousdevicelikeaprinter,is calledhandshaking orpolling.

slide-16
SLIDE 16

10/25/2016 16

  • InputdevicesarealreadyTTL andcompatible,

andcanbeconnectedtothemicroprocessor anditsinterfacingcomponents.

– ortheyareswitch*based

  • Switch*baseddevices areeitheropenor

connected;ThesearenotTTLlevels.

– TTLlevelsarealogic0(0.0V–0.8V) – oralogic1(2.0V–5.0V)

  • Usingswitch*baseddevice asTTL*compatible

inputrequiresconditioningapplied.

$+2 Asingle*pole,single*throwswitchinterfacedasa TTLdevice.

slide-17
SLIDE 17

10/25/2016 17

  • Fig11–6showsatoggleswitch properly

connectedtofunctionasaninputdevice.

  • Apull*upresistor ensureswhentheswitchis
  • pen,theoutputsignalisalogic1.

– whentheswitchisclosed,itconnectsto ground,producingavalidlogic0level

  • Astandardrange ofvaluesforpull*up

resistorsisbetween1KOhmand10KOhm.

  • Mechanicalswitchcontactsphysicallybounce

whentheyareclosed,

– whichcancreateaproblemifaswitchisused asaclockingsignalforadigitalcircuit

  • Topreventproblemswithbounces,oneofthe

circuitsshowninFig11–7canbeused.

– thefirst isaclassictextbookbounceeliminator – second isamorepracticalversionofthesame

  • Thefirstversioncostsmoretoconstruct

– thesecondcostsrequiresnopull*upresistors andtwoinvertersinsteadoftwoNANDgates

slide-18
SLIDE 18

10/25/2016 18

$+3 Debouncingswitchcontacts:(a)conventional debouncingand(b)practicaldebouncing.

– astheQinputfromtheswitchbecomesalogic0, itchangesthestateoftheflip*flop – ifthecontactbounces awayfromtheQinput,the flip*flopremembers,nochangeoccurs,andthus nobounce

  • Outputdevicesaremorediverse thaninput

devices,butmanyareinterfacedinauniform manner.

  • Beforeanoutputdevicecanbeinterfaced,we

mustunderstandvoltagesandcurrentsfrom themicroprocessororTTLinterface.

  • VoltagesareTTL*compatible fromthe

microprocessoroftheinterfacingelement.

– logic0=0.0Vto0.4V – logic1=2.4Vto5.0V

slide-19
SLIDE 19

10/25/2016 19

  • Currentsforaprocessorandmanyinterfacing

componentsarelessthanforstandardTTL.

– Logic0=0.0to2.0mA – logic1=0.0to400HA

  • Fig11–8showshowtointerfaceasimple

LEDtoamicroprocessorperipheralpin.

– atransistordriverisusedin11–8(a) – aTTLinverterisusedin11–8(b)

  • TheTTLinverter(standardversion)provides

upto16mA ofcurrentatalogic0level

– morethanenoughtodriveastandardLED

$+4 InterfacinganLED:(a)usingatransistorand(b) usinganinverter.

slide-20
SLIDE 20

10/25/2016 20

  • TTLinputsignalhasminimumvalueof2.4V
  • Dropacrossemitter*basejunctionis0.7V.
  • Thedifferenceis1.7V

– thevoltagedropacrosstheresistor

  • Thevalueoftheresistoris1.7V÷ 0.1mAor

17KJ.

– as17KJ isnotastandardvalue,an18KJ resistorischosen

  • In11–8(a),weelectedtouseaswitching

transistorinplaceoftheTTLbuffer.

– 2N2222isagoodlow*cost,general*purpose switchingtransistorwithaminimumgainof100 – collectorcurrentis10mA;sobasecurrentwill be1/100ofcollectorcurrentof0.1mA

  • Todeterminethevalueofthebasecurrent–

limitingresistor,usethe0.1mAbasecurrent andavoltagedropof1.7Vacrossthebase current–limitingresistor.

slide-21
SLIDE 21

10/25/2016 21

  • Supposeweneedtointerfacea12VDC1A

motortothemicroprocessor.

  • WecannotuseaTTLinverter:

– 12Vsignalwouldburnouttheinverter – currentfarexceeds16mAinvertermaximum

  • Wecannotusea2N2222transistor:

– maximumcurrentis250mAto500mA, dependingonthepackagestylechosen

  • ThesolutionistouseaDarlington*pair,such

asaTIP120.

– costs25¢,canhandle4Acurrentwithheatsink

  • Fig11–9illustratesamotorconnectedtothe

Darlington*pair withaminimumcurrentgain

  • f7000 andamaximumcurrentof4A.
  • Valueofthebiasresistoriscalculatedexactly

thesameastheoneusedintheLEDdriver.

  • Thecurrentthroughtheresistoris1.0A÷

7000,orabout0.143mA.

  • Voltagedropis0.9Vbecauseofthetwo

diodedrops(base/emitterjunctions).

  • Thevalueofthebiasresistoris0.9V÷

0.143mAor6.29KJ.

slide-22
SLIDE 22

10/25/2016 22

$+5 ADCmotorinterfacedtoasystembyusingaDarlington*pair.

– TheDarlington*pairmustuse aheatsink becauseofthe amountofcurrent – thediode mustbepresentto prevent theDarlington*pair frombeingdestroyedby inductivekickback

, "-! %66!#77 6#68

  • Verysimilar tomemoryaddressdecoding,

especiallyformemory*mappedI/Odevices.

  • Thedifferencebetweenmemorydecoding

andisolatedI/Odecodingisthenumberof addresspinsconnectedtothedecoder.

  • Inthepersonalcomputersystem,wealways

decodeall16bitsoftheI/Oportaddress.

slide-23
SLIDE 23

10/25/2016 23

6+4()"-% 6+4()"-%

slide-24
SLIDE 24

10/25/2016 24

6+4()"-% 6+4()"-%

slide-25
SLIDE 25

10/25/2016 25

6+4()"-% 6+4()"-%

slide-26
SLIDE 26

10/25/2016 26

6+4()"-% 6+4()"-%

slide-27
SLIDE 27

10/25/2016 27

6+4()"-% 6+4()"-%

slide-28
SLIDE 28

10/25/2016 28

6+4()"-% 6+4()"-%

slide-29
SLIDE 29

10/25/2016 29

6+4()"-%

slide-30
SLIDE 30

10/25/2016 30

slide-31
SLIDE 31

10/25/2016 31

slide-32
SLIDE 32

10/25/2016 32

slide-33
SLIDE 33

10/25/2016 33

slide-34
SLIDE 34

10/25/2016 34

slide-35
SLIDE 35

10/25/2016 35

slide-36
SLIDE 36

10/25/2016 36

slide-37
SLIDE 37

10/25/2016 37

slide-38
SLIDE 38

10/25/2016 38

slide-39
SLIDE 39

10/25/2016 39

slide-40
SLIDE 40

10/25/2016 40

slide-41
SLIDE 41

10/25/2016 41

slide-42
SLIDE 42

10/25/2016 42

slide-43
SLIDE 43

10/25/2016 43

slide-44
SLIDE 44

10/25/2016 44

slide-45
SLIDE 45

10/25/2016 45

slide-46
SLIDE 46

10/25/2016 46

slide-47
SLIDE 47

10/25/2016 47

slide-48
SLIDE 48

10/25/2016 48

slide-49
SLIDE 49

10/25/2016 49