??? 12/11/11 17:47 Read: times |
#185069 - software Responding to: ???'s previous message |
I finished my touch screen prototype board (video will be shown later), and it is impressive. with just four wires I can have almost infinte keys. (close to 1024 x 1024 using 10 bit ADC)
here is a sample code: void main() { initialize(); for(;;) // Round Robin Multitasking { if(mSecFlag) // do these functions every 1 msec interval { mSecFlag = 0; // reset msec flag to be set by timer1 interrupt Ypos = getY(); // get y position of touch screen on AN0 Xpos = getX(); // get x position of touch screen on AN2 if((Ypos > 0x50) && (Ypos < 0x80)) // y location of Sunday touch button { if((Xpos > 0x2d0) && (Xpos < 0x303)) // x location of sunday button touched { Sunday = 0; // turn Sunday LED on Monday = 1; // turn other days LEDs off Tuesday = 1; Wedensday = 1; Thursday = 1; Friday = 1; Saturday = 1; click(); // make click sound. } } if((Ypos > 0x50) && (Ypos < 0x80)) // y location of Monday touch button { if((Xpos > 0x269) && (Xpos < 0x29c)) // x location of Monday touch button { Sunday = 1; // turn all other weeks LEDs off Monday = 0; // turn Monday LED on Tuesday = 1; Wedensday = 1; Thursday = 1; Friday = 1; Saturday = 1; click(); // make click sound. } } . . . etc ... } } } Is there a more ellegant way of doing this type of menu? something like lookup tables with two dimensional arrays or any other ideas? Mahmood |
Topic | Author | Date |
Resistive touch screen | 01/01/70 00:00 | |
Good for you! | 01/01/70 00:00 | |
re: Resistive touch screen | 01/01/70 00:00 | |
Thanks | 01/01/70 00:00 | |
re: Thanks | 01/01/70 00:00 | |
GND reference | 01/01/70 00:00 | |
Hardware or software | 01/01/70 00:00 | |
re: Hardware or software | 01/01/70 00:00 | |
oh, you do | 01/01/70 00:00 | |
analog in instead of open drain | 01/01/70 00:00 | |
re: analog in .. | 01/01/70 00:00 | |
tough to love :) | 01/01/70 00:00 | |
software | 01/01/70 00:00 | |
When I did Touch Screen Stuff | 01/01/70 00:00 | |
GUI | 01/01/70 00:00 | |
If you have ... | 01/01/70 00:00 | |
Article | 01/01/70 00:00 | |
Let Chinese do that | 01/01/70 00:00 |