Content originally posted in LPCWare by fumio yoshizawa on Wed Oct 07 21:28:59 MST 2015
Hi everyone,
Please teach me how to use PCA9674 by LPC1769. I could use PCA9674 and PCF8594 by on LPC11U14 device board.This time I changed CPU and EEPROM to LPC1769 and24LC64 .
I make the board almost same as LPC11U14 board.So Program little bit modify for LPC1769. Then I success to read write EEPROM for 24LC64.But I cann't hundle for PCA9674.
The program read function about this.
/* MC24LC64 I2C read transfer */
volatile uint8_t *R_24LC64(int subads, int len)
{
// Write SLA(W), address, SLA(R), and read one byte back.
I2CWriteLength = 2;//Write transfer byte = 2byte
I2CReadLength = len; //Read transfer byte = len byte
I2CMasterBuffer[0] = MC24LC64_ADDR;//Slave address
I2CMasterBuffer[1] = 0x00;//sub address
//I2CMasterBuffer[2] = subads;//sub address
I2CMasterBuffer[2] = MC24LC64_ADDR | RD_BIT;//Read transfer
I2CEngine(); //Go I2C Transfer engine
return I2CSlaveBuffer;
}
Above do work well, But ...
volatile uint8_t *Keyinp(void)
{
I2CWriteLength = 3;
I2CReadLength = 1;
I2CMasterBuffer[0] = PCA9674_ADDR;
I2CMasterBuffer[1] = 0x00; // address p0~p5 は 3f p0-p7 は ff
I2CMasterBuffer[2] = 0xff; // address p0~p5 は 3f p0-p7 は ff
I2CMasterBuffer[3] = PCA9674_ADDR | RD_BIT;
I2CEngine();
return I2CSlaveBuffer;
}
I use key input by PCA9674. Hardware maybe I think OK.I use SDA, SCL pull up 4.7K resister.
Was it wrong for PCA9674? I wander how to set better about frequency.
Best Regards,