Technical Data
SDAI/O3
5v
ThediagrambelowshowstheI2Cconnections.
0vGnd
The0vGndpinmustbeconnectedtothe0v(Ground)onyourI2Cdevice.
Input1
TheInput1pinisactuallytheprocessorresetlineandisusedinourworkshoptoprogramtheprocessorafterfinalassembly.Theresetfunction
hasbeendisabledinsoftwaresothatthispinmaybeusedasaninputpin.Ithasa47kpullupresistoronthePCB,soiftheinputisnotrequired
youcanjustignoreit.
SCLandSDA
ThesepinsaretheI2Cbusconnections.TheyshouldbeconnecteddirectlytotheSCLandSDApinsonyourI2Cdevice.TheUSBI2Cmodule
isalwaysabusmaster,andisfittedwith4.7kpullupresistorsonthePCB.
+5v
The+5vsupplyfromtheUSBI2Cmodulecansupplyupto70mAtoexternaldevices.IfyourI2Cdevicerequiresmorethanthis,orhasitsown
supply,thenleavethe+5vpinunconnected.Donotapplyyourown5vsupplytothispin.
Commands
Command Value Description
AvailableinI2CUSB
Version
I2C_SGL 0x53 Read/Writesinglebytefornonregistereddevices,suchasthePhilipsPCF8574I/Ochip. All
I2C_MUL 0x54 Readmultiplebyteswithoutsettingnewaddress(eeprom's,Honeywellpressuresensors,etc). V5andhigher
I2C_AD1 0x55
Read/Writesingleormultiplebytesfor1byteaddresseddevices(themajorityofdeviceswill
usethisone)
All
I2C_AD2 0x56
Read/Writesingleormultiplebytesfor2byteaddresseddevices,eepromsfrom32kbit(4kx8)
andup.
V6andhigher
I2C_USB 0x5A
ArangeofcommandstotheUSBI2Cmodule,generallytoimproveselectedcommunications
orprovideanalogue/digitalI/O
All
TheUSBI2CmoduletakescareofalltheI2Cbusrequirementssuchasstart/restart/stopsequencingandhandlestheacknowledgecycles.You
onlyneedsupplyastringofbytestotellthemodulewhattodo.ThesearetheCommandbyte,thedevicesI2CAddress,0,1or2bytesforthe
devicesInternalRegisterAddress,0or1byteDataByteCount,followedwhenwriting,withtheDataBytes.Initssimplestform,thisisjust2
bytes0x53,0x41whichreadstheinputsonaPCF8574I/Oexpanderandreturns1byte,asdetailedbelow.
WritingasinglebytetoI2Cdeviceswithoutinternallyaddressableregisters
TheseincludedevicessuchasthePhilipsPCF8574I/Oexpander.FollowingtheI2C_SGLyousendthedevicesI2Caddressandthedatabyte.
PrimaryUSBI2Ccommand DeviceAddress+R/Wbit Thedatabyte
ByteType I2C_SGL Addr+R/W Data
Example 0x53 0x40 0x00
Meaning DirectRead/Writecommand PCF8574I2Caddress Setallbitslow
This3bytesequencesetsallbitsofaPCF8574I/Oexpanderchiplow.All3bytesshouldbesenttotheUSBI2Cinonesequence.Agapwill
resultintheUSBI2Crestartingitsinternalcommandsynchronizationloopandignoringthemessage.Afterallbyteshavebeenreceivedthe
USBI2CperformstheIC2writeoperationouttothePCF8574andsendsasinglebytebacktothePC.Thisreturnedbytewillbe0x00(zero)if
thewritecommandfailedandnonzeroifthewritesucceeded.ThePCshouldwaitforthisbytetobereturned(timingoutafter500mS)before
proceedingwiththenexttransaction.
ReadingasinglebytefromI2Cdeviceswithoutinternallyaddressableregisters
Thisissimilartowriting,exceptthatyoushouldadd1tothedeviceaddresstomakeitanoddnumber.ToreadfromaPCF8574ataddress0x40,
youwoulduse0x41astheaddress.(WhentheaddressgoesoutontheI2Cbus,itsthe1inthelowestbitpositionthatindicatesareadcycleis
happening).HereisanexampleofreadingtheinputsonaPCF8574I/Oexpander:
I2C_SGL PCF8574I2Caddress+Readbit