GT911 capacitive touch screen and lpc1768

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GT911 capacitive touch screen and lpc1768

1,322 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Mon Jul 27 04:18:48 MST 2015
Hi ,
I  want to run GT911 capacitive touch screen by i2c 
int xflag = 0;
static I2C_XFER_T xfer;
uint8_t tx[10], rx[10];
//******************************

i2c_app_init(I2C1, SPEED_400KHZ);

i2c_set_mode(i2cDev, 0);

//****************************************************

/* Setup I2C parameters to send 3 bytes of data */
xfer.slaveAddr = 0xBa;
tx[0] = 0x81;
tx[1] = 0x4B;

tx[2] = 0x00;
tx[3] = 0x00;
xfer.txBuff = &tx[0];

/* Send data */
Chip_I2C_MasterSend(i2cDev, xfer.slaveAddr, xfer.txBuff, 3);
//Chip_I2C_MasterSend(i2cDev, xfer.slaveAddr, tx, 4);


/* Setup I2C parameters to receive 2 bytes of data */
xfer.slaveAddr=0xbb;
xfer.rxBuff = &rx[0];
 xfer.rxSz = 2;
 Chip_I2C_MasterRead(i2cDev, xfer.slaveAddr, xfer.rxBuff, xfer.rxSz);

But last function(Chip_I2C_MasterRead) return 0 that means nothing received

If any body has experience of working with any kind of capacitive touch screen and can help me , It will be of his/her kindness .
Labels (1)
0 Kudos
1 Reply

604 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 04 00:44:13 MST 2015
Actually I 'm not sure of my I2C commands and protocol .
I have experience of I2C working by AVRs( ATMEL)  and in that case I had to send codes like this :
/****************************************************************************/
unsigned int eeprom_read(unsigned char address)
 {
i2c_start();
i2c_write(0xd0); //i2c address of DS1307
i2c_write(address);                          // address
i2c_start();
i2c_write(0xd1);                              //i2c address of DS1307 + ONE 
dcc=i2c_read(0);
i2c_stop();
return dcc;
} 
/****************************************************************************/
void eeprom_write(unsigned char address, unsigned char datar) 
{
//#asm("wdr") 
i2c_start();  
i2c_write(0xd0);                                   //i2c address of DS1307
i2c_write(address);                                // address
i2c_write(datar);
i2c_stop();
delay_ms(10);
}

to read and write .
Now in LpcOpen I can't compare this to that . and I can't really follow up .

how I can write and read in i2c eeproms like 24c512 by LpcOpen ?
0 Kudos