In SX Microcontrollers, SX/B Compiler and SX-Key Tool, johncouture wrote: '================================================== I2C_WRITE: ' Write a single byte to an I2C Device ' USAGE: ' I2C_WRITE DeviceAddress, RegisterAddress, DataToBeWritten ' I2C_Device = __param1 I2C_RegAddr = __param2 I2C_Dataout = __param3 I2CSt ' start communication I2CSn I2C_Device ' send the device address I2CSn I2C_RegAddr ' send the register address I2CSn I2C_Dataout ' send the data to put in the register I2CSp ' stop communication RETURN '================================================== I2C_READ: ' Get a byte from the I2C device ' USAGE: ' myVar = I2C_READ DeviceAddress, RegisterAddress ' I2C_Device = __param1 I2C_RegAddrn = __param2 I2CSt ' start communication I2CSn I2C_Device ' send the device address I2CSn I2C_RegAddr ' send the register address I2CSt ' restart for read I2CSn i2c_device ' resend the device address Temp = i2crcv i2csn $i2c_dataout ' send the data to put in the register i2csp ' stop communication RETURN '================================================== I2CSt: I2CStart I2CData return '================================================== I2CSp: I2CStop I2CData return '================================================== I2CSn: Temp = __PARAM1 I2CSend I2CData,Temp return '================================================== I2CRcv: I2CRecv I2CData,Temp ' get one byte from i2c device return Temp One last point. I don't have this chip so I don't have a way to test this out. However, there is enough data above to get you started. If you get stuck, I would recommend looking at the DS1307 chip on the Prof Dev Board and trying to get that to work first. John. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=440673#m440935 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2010 (http://www.dotNetBB.com)