anyone know if it’s possible to Interface i2c with a repeated start for the ( IR Temp sensor MLX90614.)
there is a dll available for the netduino here - but it just throws an exception on the cobra…
Thanks,
James
anyone know if it’s possible to Interface i2c with a repeated start for the ( IR Temp sensor MLX90614.)
there is a dll available for the netduino here - but it just throws an exception on the cobra…
Thanks,
James
Hi Gus,
I have read that, but it didn’t seem to mention what I understand is the unusual repeated start type - I’m new to this so please tell me if i’ve missed something!
Thanks,
James
When you build a multi transaction then repeated start is automatically generated in between.
Ah great - well I shall give it a go! From the schematic your board already has pull up resistors for the I2C, so I should be able to connect the lines directly… I shall give it a go
James
I’m using the following code,
I’ve set the device address (5a) and clock (50) where do I choose what address I want to read?
I need T_Obj1 from RAM address 0x07
and T_Ambient from RAM address 0x06
Thanks - sorry for being dense on this one! The rest of the project is going great!
James
I2CDevice.Configuration con =
new I2CDevice.Configuration(0x5a, 50);
I2CDevice MyI2C = new I2CDevice(con);
// Create transactions
// We need 2 in this example, we are reading from the device
// First transaxrtion is writing teh "read command"
// Second transaction is reading the data
I2CDevice.I2CTransaction[] xActions =
new I2CDevice.I2CTransaction[2];
// create write buffer (we need one byte)
byte[] RegisterNum = new byte[1] { 2 };
xActions[0] = I2CDevice.CreateWriteTransaction(RegisterNum);
// create read buffer to read the register
byte[] RegisterValue = new byte[1];
xActions[1] = I2CDevice.CreateReadTransaction(RegisterValue);
// Now we access the I2C bus using a timeout of one second
// if the execute command returns zero, the transaction failed (this
// is a good check to make sure that you are communicating with the device correctly
// and dont have a wiring issue or other problem with the I2C device)
if (MyI2C.Execute(xActions, 1000) == 0)
{
Debug.Print("Failed to perform I2C transaction");
}
else
{
Debug.Print("Register value: " + RegisterValue[0].ToString());
}
Hi Jamez, Did you resolve this issue? Did you get the Sensor to function using the FEZ or have you opted to using the Arduino module?
I would like to use the IR module on a FEZ project too and am finding it somewhat complex atm.
let me know…
TC