LPC11C24 i2c

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC11C24 i2c

1,248件の閲覧回数
vnv
Contributor II

hi,

I use the LPC11C24 i2c and AT24C16 communication,I am using NXP official example.as follew:

/* Master tx only */
int Chip_I2C_MasterSend(I2C_ID_T id, uint8_t slaveAddr, const uint8_t *buff, uint8_t len)
{
I2C_XFER_T xfer = {0};
xfer.slaveAddr = slaveAddr;
xfer.txBuff = buff;
xfer.txSz = len;
while (Chip_I2C_MasterTransfer(id, &xfer) == I2C_STATUS_ARBLOST) {}
return len - xfer.txSz;
}

/* Sequential master read */
int Chip_I2C_MasterRead(I2C_ID_T id, uint8_t slaveAddr, uint8_t *buff, int len)
{
I2C_XFER_T xfer = {0};
xfer.slaveAddr = slaveAddr;
xfer.rxBuff = buff;
xfer.rxSz = len;
while (Chip_I2C_MasterTransfer(id, &xfer) == I2C_STATUS_ARBLOST) {}
return len - xfer.rxSz;
}

  • This wrapper function is not provided from the slave device register address,Only the slave hardware address is provided(uint8_t slaveAddr,),Causing read and write errors. How can I do the right to read and write?I do not know how to control the register address.Who can give me some advice?

Who can give me some examples of reading and writing?

ラベル(1)
0 件の賞賛
返信
1 返信

738件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi VN V,

   I don't have the LPC11C24 I2C code for AT24C16 directly.

   But we have some I2C code for PCF8594, I think you can refer to it.

   Please download the code from this link:

1. MDK  project

Sample Code Bundle for LPC11xx Peripherals using Keil's MDK-ARM | www.LPCware.com 

2. LPCxpresso IDE project

Sample Code Bundle for LPC11xx Peripherals using NXP LPCXpresso | www.LPCware.com 

Please download the code, and refer to lpc11xx.keil-examples-CMSIS-update_2\lpc11xx.keil-examples-CMSIS-update\ADC

There has the I2C write and read code.

With it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信