I am trying to communicate with BQ34z110 using a PIC microcontroller. I am trying to get a the Device ID(sub command 0x0001) as the reply from the IC, to make sure the communications are proper. The IC is returning values 0x0000 but nothing else. isnt it supposed to send 0x0541??
this is the code i have used.
StopI2C();//send stop signal
StartI2C();
I2C_send(0xAA);//write addr
I2C_send(0x00);//commad LSB
I2C_send(0x01);//sub command MSB
RestartI2C();//restart signal
I2C_send(0xAA);//write addr
I2C_send(0x01);//command MSB
I2C_send(0x00);//sub command LSB
RestartI2C();
I2C_send(0xAA);//write addr
I2C_send(0x00);//pointing LSB
RestartI2C();
I2C_send(0xAB);//read addr
idata[0]=ReadI2C();//LSB
NotAckI2C();//NACK
RestartI2C();
I2C_send(0xAA);//write addr
I2C_send(0x01);//pointing MSB
RestartI2C();
I2C_send(0xAB)//read addr;
idata[1]=ReadI2C();//MSB
NotAckI2C();
StopI2C();
while(1);
}
i have tried all kinds of method, finally the most simple method.
Can some 1 please help me fast?