AnsweredAssumed Answered

How to use I2c

Question asked by jikehe on Dec 3, 2013
Latest reply on Dec 8, 2013 by Robin_Shen

volatile bool DataReceivedFlg = FALSE;

volatile bool DataTransmittedFlg = FALSE;

uint8_t OutData[4] = {0x00U, 0x01U, 0x02U, 0x03U};

uint8_t InpData[4];

LDD_TError Error;

LDD_TDeviceData *MyI2CPtr;

 

 

int main(void)

{

  PE_low_level_init();

  MyI2CPtr = I2C2_Init(NULL);

  while(1)     

  {

    Error = I2C2_SlaveReceiveBlock(MyI2CPtr, &InpData, 4U);

    if(TRUE == DataReceivedFlg)

    {

        I2C2_SendAcknowledge(MyI2CPtr, LDD_I2C_ACK_BYTE);

        DataReceivedFlg = FALSE;

    }

  }

}

 

 

 

no ack signal

Outcomes