RobG 1,892 Posted October 26, 2012 Author Share Posted October 26, 2012 Another test, this time some simple on/off buttons.Once I polish this a little, I will add it to GitHub so that users can contribute. username, CorB, GeekDoc and 1 other 4 Quote Link to post Share on other sites
totoetsasoeur 0 Posted November 5, 2012 Share Posted November 5, 2012 Hi, Would you mind telling me what are the current consumptions? Quote Link to post Share on other sites
RobG 1,892 Posted November 5, 2012 Author Share Posted November 5, 2012 There's no datasheet for the 2.2" LCD with touch panel, but looking at ILI9225B's specs and comparable 2.2" LCD, I believe the logic current is 3-5mA, back light current is 60-75mA (3 LEDs with no current limiting resistors,) touch panel 3-8mA when active. I will try to confirm those tonight. Also, you can put the display to sleep and turn the backlight off (will require some tweaks to the board.) Quote Link to post Share on other sites
SugarAddict 227 Posted November 7, 2012 Share Posted November 7, 2012 You must now make a lights out game! MUST! DO IT! Quote Link to post Share on other sites
RobG 1,892 Posted November 7, 2012 Author Share Posted November 7, 2012 I think I have enough on my plate for now.... hmmm, 5 squares by 5 squares.... tempting. SugarAddict 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 7, 2012 Share Posted November 7, 2012 This is sweet Rob! Quote Link to post Share on other sites
RobG 1,892 Posted November 7, 2012 Author Share Posted November 7, 2012 Challenge accepted... and completed SugarAddict, GeekDoc and bluehash 3 Quote Link to post Share on other sites
SugarAddict 227 Posted November 7, 2012 Share Posted November 7, 2012 See, now you have a nice touch demo and it wasn't all that hard was it? I totally look forward to implementing an RGB light control system with this for the bar lights 8-) :thumbup: Quote Link to post Share on other sites
RobG 1,892 Posted November 7, 2012 Author Share Posted November 7, 2012 Now with color Code attached. main.c Quote Link to post Share on other sites
RobG 1,892 Posted November 16, 2012 Author Share Posted November 16, 2012 Looks like Seeed screwed my boards up and had to remake them. All other boards came in red as ordered, those came green :-( Well, PENIRQ works, but I cannot get any readings from touch controller. I hope it's a software issue. If all goes well, those will be available next week. Quote Link to post Share on other sites
RobG 1,892 Posted November 18, 2012 Author Share Posted November 18, 2012 OK, good news, touch controller is working. I don't have the fully functional code yet, but I do get some readings from it. I will have 8 of them available on Monday. They will come with LCD only, no touch controller, you will have to get and solder one yourself. The controller part number is TSC2046EIPW. If you choose not to use the controller (there are pros and cons,) you can cut JP6, short JP5, JP11-14, and use MCU's ADC for touch screen. CorB and xpg 2 Quote Link to post Share on other sites
rbevers 0 Posted November 19, 2012 Share Posted November 19, 2012 Hi, Awesome work. Just a few questions. How much will they cost? Can I order one from you, Or will they become available in stores? Kind regards, Richard Quote Link to post Share on other sites
RobG 1,892 Posted November 19, 2012 Author Share Posted November 19, 2012 OK, here's the deal. The first batch will be available directly from me and will come without touch controller chip. The price is $15 + $3 shipping in US PM me if you want one. For the next batch (which will be available from the 43oh store,) I will consider including the controller chip, but that will bump the price by $1.50-$2 Quote Link to post Share on other sites
RobG 1,892 Posted November 20, 2012 Author Share Posted November 20, 2012 Example TSC2046 code /* * Created on: Mar 19, 2012 * Author: RobG * * main.c */ #include "msp430g2553.h" #include "colorLCD.h" void testILI9225B(); unsigned int readTouchController(char command); void readTouch(unsigned int * xy); void binaryToASCII(unsigned int n, char * digits); unsigned int xy[2] = { 0, }; char xValue[] = " "; char yValue[] = " "; void main(void) { WDTCTL = WDTPW + WDTHOLD; // disable WDT BCSCTL1 = CALBC1_16MHZ; // 16MHz clock DCOCTL = CALDCO_16MHZ; P1OUT |= LCD_SCLK_PIN + LCD_SCE_PIN + LCD_SD_PIN + LCD_DC_PIN; P1DIR |= LCD_SCLK_PIN + LCD_SCE_PIN + LCD_SD_PIN + LCD_DC_PIN; P2OUT |= BIT2; P2DIR |= BIT2; P2OUT |= BIT0; P2DIR &= ~BIT0; P2REN |= BIT0; P2IES |= BIT0; //hi-lo P2IFG &= ~BIT0; P2IE |= BIT0; _delay_cycles(16000); // wait before reading IDs _bis_SR_register(GIE); testILI9225B(); } #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { if (P2IFG & BIT0) { // // single read // P2OUT &= ~BIT2; xy[0] = readTouchController(0xD0); P2OUT |= BIT2; P2OUT &= ~BIT2; xy[1] = readTouchController(0x90); P2OUT |= BIT2; // // display results // binaryToASCII(xy[0], xValue); binaryToASCII(xy[1], yValue); setColor16(0); fillRect(10, 10, 150, 18); setColor16(0xFFFF); drawString(10, 10, "x: "); drawString(30, 10, xValue); drawString(100, 10, "y: "); drawString(120, 10, yValue); } P2IFG &= ~BIT0; } void testILI9225B() { _delay_cycles(16000); initILI9225B(); clearScreen(1); setColor16(0xFFFF); while (1) { } } /* * 0xD0 - read x 12bit, enable PENIRQ * 0x90 - read y 12bit, enable PENIRQ * 0xD8 - read x 8bit, enable PENIRQ * 0x98 - read y 8bit, enable PENIRQ * 0xD1 - read x 12bit, disable PENIRQ * 0x91 - read y 12bit, disab;e PENIRQ * 0xD9 - read x 8bit, disable PENIRQ * 0x99 - read y 8bit, disable PENIRQ * * For multiple readings, enable PENIRQ only on the last read * 0xD1, 0xD1, 0xD1...0x91, 0x91, 0x90 * */ unsigned int readTouchController(char command) { 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_SD_PIN) : (P1OUT &= ~LCD_SD_PIN); returnValue <<= 1; P1OUT |= LCD_SCLK_PIN; if (P1IN & BIT6) returnValue |= BIT0; P1OUT &= ~LCD_SCLK_PIN; command <<= 1; c--; } return returnValue; } // this is not needed, it's just used to convert int to string so that we can show the value on LCD void binaryToASCII(unsigned int n, char * digits) { __asm(" clr R14"); __asm(" rla R12"); __asm(" rla R12"); __asm(" rla R12"); __asm(" rla R12"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" rla R12"); __asm(" dadd R14, R14"); __asm(" mov.b R14, 3(R13)"); __asm(" swpb R14"); __asm(" mov.b R14, 1(R13)"); __asm(" rra R14"); __asm(" rra R14"); __asm(" rra R14"); __asm(" rra R14"); __asm(" mov.b R14, 0(R13)"); __asm(" swpb R14"); __asm(" mov.b R14, 2(R13)"); __asm(" and #0x0F0F, 0(R13)"); __asm(" and #0x0F0F, 2(R13)"); __asm(" add.b #0x30, 3(R13)"); __asm(" tst.b 0(R13)"); __asm(" jnz l1"); __asm(" mov.b #0x20, 0(R13)"); __asm(" tst.b 1(R13)"); __asm(" jnz l2"); __asm(" mov.b #0x20, 1(R13)"); __asm(" tst.b 2(R13)"); __asm(" jnz l3"); __asm(" mov.b #0x20, 2(R13)"); __asm(" jmp l4"); __asm("l1:"); __asm(" add.b #0x30, 0(R13)"); __asm("l2:"); __asm(" add.b #0x30, 1(R13)"); __asm("l3:"); __asm(" add.b #0x30, 2(R13)"); __asm("l4:"); return; } Quote Link to post Share on other sites
RobG 1,892 Posted November 23, 2012 Author Share Posted November 23, 2012 There are 2 ways to make touch panel work: 1. Touch controller chip - solder TSC2046 (IC2) 2. MSP430's ADC - cut JP6, short JP5, JP11-JP14 Other options: R2-R4 LCD backlight resistors, shorted by default USCI - short JP1 & JP4, shorted by default USI - short JP2 & JP3, cut JP1 & JP4 which are shorted by default IC1 - 23Kxxx or 25AAxxx series memory Memory HOLD - short JP10 (shorted by default) when unused, short JP9 and cut JP10 when used. JP9 connects HOLD to P2.5 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.