Finally some good news that you've got I2C working..
I recently got my Due about a day back and tried using I2C, by sending a byte over to my target external ADC (that communicates using I2C). The device address is 0x0D, target register address is 0x80 and the byte to be sent is 0xA0.
#include <Wire.h>
byte result=0;
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
Wire.begin(0x0D); //device address
delay(10);
}
void loop()
{
//main code here, to run over and over again
Wire.beginTransmission(0x80); //target register address
delay(1);
Wire.write(0xA0); //data byte to be transmitted
delay(1);
result=Wire.endTransmission(); //wanted to print the status of transmission as i cannot program my
delay(1); target IC (external ADC)
Serial.write(result);
Serial.println(" ");
delay(100);
}
Im getting the following message on my serial monitor:
assertion "(address & 0x80) == 0" failed: file "../source/twi.c", line 261, function: TWI_StartWrite
Exiting with status 1.
I will be really grateful to anyone who can analyze Patouf's code in the previous post and point out the error (if any) in mine.
Thanks a lot guys.