Hello all,
I have an LCD module TM240320B9NFWUGWC and it has inbuilt ILI9325 controller. MPU-Interface Mode is through 8-bit parallel interface.
I'm trying to read its device code but its not working, I always getting 0x0000. If any body can help on this, that will be very appreciated.
My code is as follow ------------------------------------------------------------------ void TSLCDInit(void) //initial LCD { TSLCDOutIns(TS_INS_START_OSC); driver_code = TSLCDInDat(); if (driver_code == 0x9320) //ILI9320 { TSLCDInit9320(); } else if (driver_code == 0x9325) //ILI9325 { TSLCDInit9325(); } } -------------------------------------------------------------------- But I am getting driver_code = 0x0000
And my write command, write data and read data as follow
void TSLCDOutIns(unsigned short ins) //write instruction to LCD { LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
LCD_CS_LOW(); LCD_RS_LOW(); LCD_RD_HIGH();
LCD_WR_HIGH(); LCD_WR_LOW(); delay_ms(1); LPC_GPIO0->FIOPIN &= ~LCD_DATA_MASK; LCD_WR_HIGH();
LCD_WR_LOW(); delay_ms(1); LPC_GPIO0->FIOPIN |= ins<<2; LCD_WR_HIGH();
delay_ms(1); }
void TSLCDOutDat(unsigned short dat) //write data to LCD { LCD_RS_HIGH(); LCD_RD_HIGH(); LCD_WR_LOW();
LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR |= LCD_DATA_MASK; LPC_GPIO0->FIOCLR = LCD_DATA_MASK; LPC_GPIO0->FIOSET = (dat >> 8 ) << 2;
LCD_CS_LOW(); LCD_CS_HIGH();
LPC_GPIO0->FIOCLR = LCD_DATA_MASK; LPC_GPIO0->FIOSET = dat << 2;
LCD_CS_LOW(); LCD_CS_HIGH(); LCD_WR_HIGH();
LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK; }
unsigned short TSLCDInDat(void) //read data from LCD { unsigned short retval = 0;
LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
LCD_CS_LOW(); LCD_RS_HIGH();
LCD_RD_LOW(); delay_ms(1); retval = (LPC_GPIO0->FIOPIN & LCD_DATA_MASK); LCD_RD_HIGH(); delay_ms(1);
LCD_RD_LOW(); delay_ms(1); retval = (retval << 8 ) | (LPC_GPIO0->FIOPIN & LCD_DATA_MASK); LCD_RD_HIGH(); delay_ms(1);
LCD_CS_HIGH();
return retval; }
Note: For data lines I am using P0.2 to P0.9 and that's why I am shifting 'ins' and 'dat' left by 2.
-Prakash 9886545216
Do you really think _anyone_ is going to bother to try to read that jibberish?
If you want people to look at your code, then you better follow the instructions for how to post source code.
Hello Per Westermark,
Thanks for your suggestion:)
Resending my previous mail...
My code is as follow
void TSLCDInit(void) //initial LCD { TSLCDOutIns(TS_INS_START_OSC); driver_code = TSLCDInDat(); if (driver_code == 0x9320) //ILI9320 { TSLCDInit9320(); } else if (driver_code == 0x9325) //ILI9325 { TSLCDInit9325(); } }
But I am getting driver_code = 0x0000
And my write command, write data and read data functions as follow
void TSLCDOutIns(unsigned short ins) //write instruction to LCD { LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR |= LCD_DATA_MASK; LCD_CS_LOW(); LCD_RS_LOW(); LCD_RD_HIGH(); LCD_WR_HIGH(); LCD_WR_LOW(); delay_ms(1); LPC_GPIO0->FIOPIN &= ~LCD_DATA_MASK; LCD_WR_HIGH(); LCD_WR_LOW(); delay_ms(1); LPC_GPIO0->FIOPIN |= ins<<2; LCD_WR_HIGH(); delay_ms(1); } void TSLCDOutDat(unsigned short dat) //write data to LCD { LCD_RS_HIGH(); LCD_RD_HIGH(); LCD_WR_LOW(); LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR |= LCD_DATA_MASK; LPC_GPIO0->FIOCLR = LCD_DATA_MASK; LPC_GPIO0->FIOSET = (dat >> 8 ) << 2; LCD_CS_LOW(); LCD_CS_HIGH(); LPC_GPIO0->FIOCLR = LCD_DATA_MASK; LPC_GPIO0->FIOSET = dat << 2; LCD_CS_LOW(); LCD_CS_HIGH(); LCD_WR_HIGH(); LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK; } unsigned short TSLCDInDat(void) //read data from LCD { unsigned short retval = 0; LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4); LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK; LCD_CS_LOW(); LCD_RS_HIGH(); LCD_RD_LOW(); delay_ms(1); retval = (LPC_GPIO0->FIOPIN & LCD_DATA_MASK); LCD_RD_HIGH(); delay_ms(1); LCD_RD_LOW(); delay_ms(1); retval = (retval << 8 ) | (LPC_GPIO0->FIOPIN & LCD_DATA_MASK); LCD_RD_HIGH(); delay_ms(1); LCD_CS_HIGH(); return retval; }
Have you verified that your 1ms delay gives a 1ms delay?
Have you checked the status of all pins, to make sure that the correct signals gets toggled? A scope would at the same time verify the required delays for setup and hold times.
Ya I have verified the delay_ms and checked the status of all pins, ensured that the correct signals getting toggled.
Hi
Maybe here is not the place of my question but I have a really simple question:
what's part number of LCD which is used on MCB1700?
it's serial but it's the same as ELT240320 (without touch screen type) and in ili9320's datasheet mentioned that we can drive it by serial interface but in ELT240320 has never mentioned which pins are about serial interface?(except interface selection)
please help because I need to drive an LCD in serial mode to reduce PIN usage ...
thanks a lot