AnsweredAssumed Answered

How to Read iic for the S12G64?

Question asked by yan laidong on Jan 31, 2018
Latest reply on Feb 1, 2018 by Daniel Martynek

I want to read Register of  MAX9288 ,but i face to difficulty. I has been read value success.but the reasult is zero .

please tell me reason,thanks.

 

add: I was read register  for the  slave address is 0x90.

 

for example:

byte IIC_9288_RecvBlock_Test(uint8_t addr,void* Ptr,word Siz,word *Rcv)
{
word I;
bool Acknowledge;
word Trial;

*Rcv = 0U;
Trial = TRIALS;
do {
Inhr1_SetDir((bool)INPUT); /* SDA HIGH - START SETUP */
Inhr2_SetDir((bool)INPUT); /* CLOCK HIGH PULSE */
Delay(); /* CLOCK HIGH PULSE + BUS FREE TIME */
Inhr1_SetDir((bool)OUTPUT);
Inhr1_ClrVal(); /* START CONDITION */
Delay(); /* START HOLD TIME */
Inhr2_SetDir((bool)OUTPUT);
Inhr2_ClrVal(); /* CLOCK LOW PULSE */
Delay();
Write((byte)(addr + READ));
Acknowledge = GetAck();
--Trial;
}
while((Trial != 0U) && Acknowledge);

if(Acknowledge)
{
IIC_9288_OnNACK();
Inhr2_SetDir((bool)OUTPUT);
Inhr2_ClrVal(); /* CLOCK LOW PULSE */
InternalStop();
return ERR_BUSY;
}
else
{
Inhr2_SetDir((bool)OUTPUT);
Inhr2_ClrVal(); /* CLOCK LOW PULSE */
Delay();
}

for (I = 0U; I < Siz; I++)
{
*((byte *) Ptr + I) = Read();
IIC_9288_OnRxChar();
if (I == (Siz - 1U))
{
SetAck((bool)NOACK);
}
else
{
SetAck((bool)ACK);
}
++(*Rcv);
}
return ERR_OK;
}

Outcomes