RobG 1,892 Posted January 12, 2015 Author Share Posted January 12, 2015 @@CarlW, see the first post. Quote Link to post Share on other sites
CorB 64 Posted January 29, 2015 Share Posted January 29, 2015 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 Quote Link to post Share on other sites
RobG 1,892 Posted January 31, 2015 Author Share Posted January 31, 2015 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. Quote Link to post Share on other sites
CorB 64 Posted February 1, 2015 Share Posted February 1, 2015 Hi Rob, Thanks for the additional details. I was using older code from you but it did not mention anything on the max SPI of the TSC controller. I will wait with my further attempts. cheers Cor Quote Link to post Share on other sites
CorB 64 Posted February 9, 2015 Share Posted February 9, 2015 Hi Rob, Can you share the code you have been working on thusfar ? regards Cor Quote Link to post Share on other sites
RobG 1,892 Posted April 23, 2015 Author Share Posted April 23, 2015 FYI, some BPs with touch panel may have been shipped with JP7 open. JP7 should be shorted by default as it is needed for touch controller. Quote Link to post Share on other sites
CorB 64 Posted April 25, 2015 Share Posted April 25, 2015 Hi Rob, I checked my 2.4" board and do only see JP1 ... JP6 ... no JP7. Cor Quote Link to post Share on other sites
RobG 1,892 Posted April 25, 2015 Author Share Posted April 25, 2015 Early versions of 2.4 BP had only JP1-6. JP7-9 was added later on, one of the users requested it because J1.9 conflicted with another function he needed. Missing bridge on JP7 would affect only BPs shipped in the last 2 months. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.