UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer likeyou614
Observer
2,311 Views
Registered: ‎01-12-2009

EDK IIC

In TestApp _ Peripheral =>souce
If I hope IIC to write one data device outside
Is that written like this mistakenly? Why seem not to write? '

Suppose I set up as follows
device address =0x4C;
register address =0x03;
data =0x64;


Could you tell me where is the mistake?  thank ............
 
//-----------------------------------------------------------------------------------------------------------------------------
 
int main (void) {
Xuint8 xdata[2];
 xdata[0]=0x03;
 xdata[1]=0x64;
vsk_iic_write(XPAR_IIC_0_BASEADDR, 0X4C, xdata[0],&xdata[1],1);

}
//---------------------------------------------------------------------------------------------------------------
 
Xuint8  vsk_iic_write(Xuint32 CoreAddress, Xuint8 ChipAddress, Xuint8 RegAddress,
                  Xuint8 *BufferPtr, Xuint8 ByteCount)
{
  Xuint8 SentByteCount;
  Xuint8 WriteBuffer[10];
  Xuint8 Index;
 
       

  /*
   * A temporary write buffer must be used which contains both the address
   * and the data to be written, put the address in first
   */
  WriteBuffer[0] = RegAddress;


  /*
   * Put the data in the write buffer following the address.
   */

  for (Index = 0; Index < ByteCount; Index++)
  {
    WriteBuffer[Index + 1] = BufferPtr[Index];
  }
  /*
   * Write data at the specified address.
   */

  SentByteCount = XIic_Send(CoreAddress, ChipAddress, WriteBuffer,ByteCount + 1, XIIC_STOP);
 
if (SentByteCount < 1) { SentByteCount = 1; }                            
  // Return the number of bytes written.
  return SentByteCount - 1;

}
 
//-----------------------------------------------------------------------------------------------------------------------------------

0 Kudos