Hi all,
I need to interface a cap-sensor, so i'm using a I2C bus to communicate between two controllers i.e.,
LPC111X[TARGET BOARD] to QT1050 [controller for touch sensor].
I have run through a simple code comparing the examples, and connected 4wires from target lpc111x to qt1050 i.e., as below:
SCL<-> SCL, SDA <-> SDA, VCC <-> VCC, GND <-> GND.
int main()
{
while(1)
{
i2c_lpc1_init(0x40);
// PINSEL0 = 0x50
LPC_I2C->SCLH = 75;
LPC_I2C->SCLL = 75;
LPC_I2C->CONSET = I2C_FLAG_I2EN;
LPC_I2C->CONSET |= I2C_FLAG_STA;
while(LPC_I2C->STAT != 0X08)
// LPC_I2C->DAT = EEPROM_WRITE;
LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
while(LPC_I2C->STAT != 0X18);
LPC_I2C->DAT = WORD_ADDR_MSB;
LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI|I2C_FLAG_STA;
while(LPC_I2C->STAT != 0X28);
LPC_I2C->DAT = WORD_ADDR_LSB;
LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
while(LPC_I2C->STAT != 0X28);
//I2C0DAT = DATA;
//LPC_I2C->DAT = ICDATA;
LPC_I2C->DAT |= TEST_LED1;//DAT
delay(20);
LPC_I2C->DAT &= ~TEST_LED1;
delay(20);
LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
while(LPC_I2C->STAT != 0X28);
LPC_I2C->CONSET = I2C_FLAG_STO;
LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
}
But my question is how to set the address pin for I2C in qt1050 controller and communicate that with target board[master & slave],
So can any one tell me how to communicate between this two controller.
Thanks in advance.