Created Sun, 01 Apr 2012 22:30:12 +0000 by scoprire
Sun, 01 Apr 2012 22:30:12 +0000
if i want to read ram address 0x007 of the device with address 0x05A what is the code? and what is the code if i want to write the eeprom address 0x00E (whit 0x055 for exemple) of the device to change his address in the i2c connection? thanks
Mon, 02 Apr 2012 02:48:41 +0000
Hello,
If I understood your question properly you probably want this:
Read from device (this is the normal procedure, you should check to make sure your device follows this):
void setup()
{
uint8_t temp[numBytes];
int index = 0;
Wire.begin();
Wire.beginTransmission(0x5A); //Where the parameter is the device address
Wire.send(0x00); //Assuming a 16-bit address
Wire.send(0x07);
Wire.endTransmission();
Wire.requestFrom(0x5A, numBytes); //Device Address, number of bytes to read
while(Wire.available())
{
temp[index++] = Wire.receive();
}
}
void loop()
{
}
Write to (again assuming that your device is normal):
void setup()
{
Wire.begin();
Wire.beginTransmission(0x5A);
Wire.send(0x00); //Assuming 16-bit addressing
Wire.send(0x0E);
Wire.send(0x00); //Assuming writing 16-bits
Wire.send(0x55);
Wire.endTransmission();
}
There are other examples if you go to File | Examples | Wire that show you how to use the Wire library.
Best Regards, Ryan K Digilent
Mon, 02 Apr 2012 09:12:56 +0000
first of all I want to thank you because before choosing chipkit I thought about using arduino, but I don't found the same courtesy and helpfulness in his community. I have to write a new i2c address and a new emission coefficient (EEPROM address 0x004 and 0x00E) in malexis MLX90614 IR temperature sensors and then I have periodically read the temperature of the object (RAM address 0x007), in the attachment the datasheet for the sensor, I found a code for reading but uses the library "i2cmaster.h" for AVR chip
[attachment=0]Malexis.zip[/attachment]
Tue, 03 Apr 2012 21:37:06 +0000
if someone want to help me i found also this code for pic18 http://www.melexis.com/Assets/SMBus-communication-with-MLX90614-5207.aspx
Wed, 04 Apr 2012 23:47:20 +0000
When I first received my CHipKit Max32 I tried to get it to talk to a MLX90614 - but the problem is that the Arduino i2c library on which the ChipKit is based does not support the "repeated start condition" (Sr) as per section 8.4.3.1 of the spec attached in an earlier post.
If I come back to this "project" and have any success I'll let you know.
Thu, 05 Apr 2012 18:05:22 +0000
thanks, i think i will sell the melexis sensor and i buy an analog IR sensor