所需E币: 4
时间: 2019-12-24 21:19
大小: 369.59KB
ThisapplicationnotedescribeshowtouseaPIC16F877AasanI2C™mastertocommunicatewiththeMicrochipMCP23016I2CI/OExpanderslavedevice.AnI/OExpanderdeviceisusedtoincreasetheI/Ocapabilityofamicrocontroller(refertoFigure1).Amicrocontroller’sI2Cportcanbeusedasacommuni-cationchannelwithMCP23016(s)toexpandthemicro-controller’sI/Ocount.ByusingtwoI2Cpins(andonegeneral-purposeI/Opin,ifusingtheinterruptcapabilityoftheMCP23016),16to128general-purposeI/Oscanbegained.TheMCP23016hasthreeaddresspinswhichcanbeusedtoprovideuniqueaddressesforuptoeightdevices.EachdeviceattachedtotheI2Cbusmustbeassignedauniqueaddressunlessalldevices(withthesameaddress)arereceivingthesamedataanddonottrans-mitanydata.Whenthemasterinitiatesadatatransfer,theaddressoftheslavedeviceistransmitted.Withintheaddress,theLSb(R/Wbit)specifieswhetherthemasterreadsfrom,orwritesto,theslave.Forwriteoperations,aseriesofbyteswouldbetransmittedfromthemaster.Forreadoperations,themasterwaitsforthebustobefree(i.e.,SCLlinenotpulledlow)andthenclocksthedatatobereceivedfromtheslave.MAN245InterfacingTheMCP23016I/OExpanderWithThePIC16F877AWhatcanyoudowithanI/OExpander?Author:AbdelwahabFassi-FihriMicrochipTechnologyInc.AnI/OExpandercanalsobeusedtomonitorswitchesand/orsensors,driveLEDsand/orrelays,aswellasothergeneral-purposeI/Ofunctions.AnI/OExpanderINTRODUCTIONcanhaveseveralusesinavarietyofapplications.Typ-This……