Jump to content
43oh

2.4" 320 x 240 Color LCD Booster Pack (with and without touch panel)


Recommended Posts

  • 3 weeks later...
  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

New LCD BoosterPacks are here. Both are 2.4" 320x240, one with touch panel, one without. Both feature the same pinout as their "little" 2.2" brother, same configuration options and SD socket. Can be

@@CorB, the pinout is the same as my 2.2" 320x240 LCD, touch controller same as 2.2" Touch LCD. I will add this information here later on and also update my lib (there are only 3 lines that have to b

Here's the pinout (LCDs are preconfigured for new pinout.) Pos/Pin CS_Dis CS_SD D/C New(1) P2.5 P2.4 P1.3 Legacy(2) P1.0 P2.5 P1.4 P2.0 Touch IRQ P2.1 Touch CS As for the library, u

Posted Images

Hi,

 

Ive started to see if I can finally get the touch functionality of this boosterpack working. Unfortunately there seems to be no code available for the latest revision. Using information (code from @RobG) from the forums Ive tried to see what I could achieve. .... its working but not yet as planned.

 

What did I do

 

Ive added this declaration

// touch defines
 #define TSC_PENIRQ_PIN BIT0
 #define TSC_CS_PIN BIT1

this routine

unsigned int readTouchController(char command) {
  	P2OUT &= ~TSC_CS_PIN;
  	char c = 21;
  	if (command & 0x08)
  		c = 17; // this makes it work with 8bit and 12bit, you can remove
  	unsigned int returnValue = 0;
  	while (c != 0) {
  		(command & BIT7) ? (P1OUT |= LCD_MOSI_PIN) : (P1OUT &= ~LCD_MOSI_PIN);
  		returnValue <<= 1;
  		P1OUT |= LCD_SCLK_PIN;
  		if (P1IN & BIT6)
  			returnValue |= BIT0;
  		P1OUT &= ~LCD_SCLK_PIN;
  		command <<= 1;
  		c--;
  	}
  	P2OUT |= TSC_CS_PIN;
  	return returnValue;
  }

during startup i setup the touch as

	P2OUT |= TSC_PENIRQ_PIN + TSC_CS_PIN;
	P2DIR |= TSC_CS_PIN;
	P2DIR &= ~TSC_PENIRQ_PIN;
	P2REN |= TSC_PENIRQ_PIN;
	P2IES |= TSC_PENIRQ_PIN; //hi-lo
	P2IFG &= ~TSC_PENIRQ_PIN;
	P2IE |= TSC_PENIRQ_PIN;


and ive added the IRQ 

#pragma vector=PORT2_VECTOR
__interrupt void Port2_ISR(void)
{
  __delay_cycles(10000); // IMPORTANT !!! needed for a proper function!!!

  if (P2IFG & TSC_PENIRQ_PIN)
  {
	touching = 1;
	P2IE &= ~TSC_PENIRQ_PIN;
	P2IFG &= ~TSC_PENIRQ_PIN;
  }
}

And after startup, the screen reacts to the IRQ, also runs the readtouchcontroller but the data I get from the readtouchcontroller is for both X and Y always 0 ...

 

Anybody with a guess ??

 

cheers

 

Cor

 

 

 

Link to post
Share on other sites

I will try to finish my touch library this weekend, if not, I will email you what I have.

Reading touch controller is not a problem, getting accurate position is :)

 

 

1. TSC controller's max SPI speed is 2MHz. If you are using bit banging, you should be fine (if your master clock is 16MHz.)

2. Make sure LCD's CS is high when reading from touch controller. 

Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...