Hello,
I wanted to use PCF8574P, so I had the code to write the correct structure :
#define IO_EXPENDER_1_ADDR 0x40
static byte ucTrameIOEX1[] = {IO_EXPENDER_1_ADDR, 0xFF };
fnWrite(IICPortID, (unsigned char *)ucTrameIOEX1, sizeof(ucTrameIOEX1))
The first write is correct but it look like the write buffer did not get empty : ptQUEQue->chars is incremented but never decremented.
I made following changes :
case MASTER_REPEATED_START_SENT: // (0x10) repeated start has been sent
case MASTER_START_SENT: // (0x08) start bit sent, now send address
{
unsigned long ulAddress = *ptIICQue->IIC_queue.get++; // the address
//ADD//HP//021109//
if (ptIICQue->IIC_queue.chars)
ptIICQue->IIC_queue.chars--;
//
case MASTER_TX_ADDRESS_NOT_ACKED: // (0x20) the slave address has been sent but no ack was received
case MASTER_TX_DATA_NOT_ACKED: // (0x30) a byte of data has been sent but was not acked
case MASTER_TX_DATA_ACKED: // (0x28) a byte of data has been sent and acked
case MASTER_TX_ADDRESS_ACKED: // (0x18) the slave address was sent and we have received an ack - continue with the TX data
if (ptIICQue->ucPresentLen != 0) {
iic->I2CDAT = *ptIICQue->IIC_queue.get++; // send first data byte
//ADD//HP//021109//
if (ptIICQue->IIC_queue.chars)
ptIICQue->IIC_queue.chars--;
//
then it works....