Hi,
I want to use I2C write data for controling TDA7418-3 Band car audio procesor, I can use I2CU test program find device address 0x88,
Test program is below.
int count = 0;
for (int address=0x00; address<256; address+=2) {
//int a=i2c.write(address,NULL,0);
if (!i2c.write(address,NULL,0)) { // 0 returned is ok
printf(" - I2C device found at address 0x%x\n", address);
count++;
}
}
printf("%d devices found\n", count);
But when I change "NULL" to the code below in my program.
char buf[2];
buf[0]=0x8d; //register address ,test mode
buf[1]=0x12; //data
if(!i2c.write(0x88,buf,2)){
printf(" write success");
}else{
printf("write failed");
}
When I execute my program, print failed message "write failed".
I don't know what's wrong.
Please help me.
Thanks,
zhenjiang
Hi,
I want to use I2C write data for controling TDA7418-3 Band car audio procesor, I can use I2CU test program find device address 0x88,
Test program is below.
int count = 0;
for (int address=0x00; address<256; address+=2) {
//int a=i2c.write(address,NULL,0);
if (!i2c.write(address,NULL,0)) { // 0 returned is ok
printf(" - I2C device found at address 0x%x\n", address);
count++;
}
}
printf("%d devices found\n", count);
But when I change "NULL" to the code below in my program.
char buf[2];
buf[0]=0x8d; //register address ,test mode
buf[1]=0x12; //data
if(!i2c.write(0x88,buf,2)){
printf(" write success");
}else{
printf("write failed");
}
When I execute my program, print failed message "write failed".
I don't know what's wrong.
Please help me.
Thanks,
zhenjiang