Technical Data

0x53 0x41
TheUSBI2CmodulewillperformthereadoperationontheI2Cbusandsendasinglebyte(thePCF8574inputs)backtothePC.ThePCshould
waitforthebytetobereturned(timingoutafter500mS)beforeproceedingwiththenexttransaction.
ReadingmultiplebytesfromI2Cdeviceswithoutsettinganewaddress
Thisisusedfordevicesthatdonothaveaninternalregisteraddressbutreturnsmultiplebytes.ExamplesofsuchdevicesaretheHoneywell
ASDXDOseriespressuresensors.Thiscommandcanalsobeusedfordevicesthatdohaveaninternaladdresswhichitincrements
automaticallybetweenreadsanddoesn'tneedtobeseteachtime,suchaseeproms.InthiscaseyouwouldusecommandI2C_AD1orI2C_AD2
forthefirstread,thenI2C_MULforsubsequentreads.HereisanexampleofreadingthetwobytepressurefromtheHoneywellsensor.
I2C_MUL ASDXI2Caddress+Readbit Numberofbytestoread
0x54 0xF1 0x02
TheUSBI2CwillperformthereadoperationontheI2CbusandsendtwobytesbacktothePChighbytefirstinthisexamplefortheASDX
sensor.ThePCshouldwaitforbothbytestobereturned(timingoutafter500mS)beforeproceedingwiththenexttransaction.
WritingtoI2Cdeviceswitha1byteinternaladdressregister
ThisincludesalmostallI2Cdevices.FollowingtheI2C_AD1commandyousendthedeviceI2Caddress,thenthedevicesinternalregister
addressyouwanttowritetoandthenumberofbytesyou'rewriting.Themaximumnumberofdatabytesshouldnotexceed64soasnotto
overflowtheUSBI2C'sinternalbuffer.
PrimaryUSBI2C
command
DeviceAddress+R/W
bit
Deviceinternalregister Numberofdatabytes Thedatabytes
ByteType I2C_AD1 Addr+R/W Reg ByteCount Data
Example 0x55 0xE0 0x00 0x01 0x51
Meaning
PrimaryUSBI2C
command
SRF08I2Caddress SRF08commandReg
Onecommandbyte
follows
Startrangingincm
This5bytesequencestartsanSRF08ataddress0xE0ranging.All5bytesshouldbesenttotheUSBI2Cinonesequence.Agapwillresultinthe
USBI2Crestartingitsinternalcommandsynchronizationloopandignoringthemessage.AfterallbyteshavebeenreceivedtheUSBI2C
performstheIC2writeoperationouttotheSRF08andsendsasinglebytebacktothePC.Thisreturnedbytewillbe0x00(zero)ifthewrite
commandfailedandnonzeroifthewritesucceeded.ThePCshouldwaitforthisbytetobereturned(timingoutafter500mS)beforeproceeding
withthenexttransaction.
Hereisanotherwriteexamplethistimean8bytesequencetoinitializetheMD22motordriver:
I2C_AD1
MD22
Addr+R/W
ModeReg Databytecount MD22mode1
LeftMotor
Stopped
RightMotor
Stopped
Fastacceleration
0x55 0xB0 0x00 0x04 0x01 0x00 0x00 0x02
AgaintheUSBI2Cwillrespondwithnonzeroifthewritesucceededandzeroifitfailed.Afailuremeansthatnoacknowledgewasreceived
fromtheI2Cdevice.
ReadingfromI2Cdeviceswitha1byteinternaladdressregister
Thisissimilartowriting,exceptthatyoushouldadd1tothedeviceaddresstomakeitanoddnumber.ToreadfromanSRF08ataddress0xE0,
youwoulduse0xE1astheaddress.(WhentheaddressgoesoutontheI2Cbus,itsthe1inthelowestbitpositionthatindicatesareadcycleis
happening).Themaximumnumberofdatabytesrequestedshouldnotexceed60soasnottooverflowtheUSBI2C'sinternalbuffer.Hereisan
exampleofreadingthetwobytebearingfromtheCMPS03compassmodule:
I2C_AD1 CPMS03I2Caddress+Readbit CMPS03bearingregister Numberofbytestoread
0x55 0xC1 0x02 0x02
TheUSBI2CwillperformthereadoperationontheI2CbusandsendtwobytesbacktothePChighbytefirst.ThePCshouldwaitforboth
bytestobereturned(timingoutafter500mS)beforeproceedingwiththenexttransaction.
WritingtoI2Cdeviceswitha2byteinternaladdressregister
Thisisprimarilyforeeprom'sfrom24LC32(4kx8)to24LC1024(2*64kx8).FollowingtheI2C_AD2yousendthedeviceI2Caddress,then
thedevicesinternalregisteraddress(2bytes,highbytefirstforeeprom's)andthenthenumberofbytesyou'rewriting.Themaximumnumberof
databytesshouldnotexceed64soasnottooverflowtheUSBI2C'sinternalbuffer.
PrimaryUSBI2C
command
DeviceAddress+
R/Wbit
Highbyteofinternal
Address
Lowbyteofinternal
Address
Numberofdatabytes Thedatabytes
Byte
Type
I2C_AD2 Addr+R/W AddressHigh AddressLow ByteCount Data
Example 0x56 0xA0 0x00 0x00 0x40 0xnn
Meaning
PrimaryUSBI2C
command
24LC32I2Caddress Address0x0000 Address0x0000
Onecommandbyte
follows
64(0x40)data
bytes