Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Mahmood Elnasser
12/11/11 10:47
Read: 312 times
Sacramento
USA


 
#185069 - software
Responding to: Mahmood Elnasser'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

List of 18 messages in thread
TopicAuthorDate
Resistive touch screen      Mahmood Elnasser      11/29/11 01:41      
   Good for you!      Rob Klein      11/29/11 01:56      
   re: Resistive touch screen        Andy Peters      11/29/11 09:57      
      Thanks      Mahmood Elnasser      11/29/11 13:46      
         re: Thanks      Andy Peters      11/30/11 09:31      
      GND reference      Mahmood Elnasser      11/29/11 14:09      
         Hardware or software      Mahmood Elnasser      12/23/11 07:37      
            re: Hardware or software      Andy Peters      12/23/11 09:48      
               oh, you do      Erik Malund      12/23/11 11:51      
      analog in instead of open drain      Maarten Brock      11/29/11 15:16      
         re: analog in ..      Andy Peters      11/30/11 09:32      
   tough to love :)      Erik Malund      11/30/11 09:39      
   software      Mahmood Elnasser      12/11/11 10:47      
      When I did Touch Screen Stuff      Michael Karas      12/11/11 11:28      
         GUI      Mahmood Elnasser      12/11/11 11:54      
            If you have ...      Michael Karas      12/11/11 21:21      
               Article      Mahmood Elnasser      12/12/11 02:03      
   Let Chinese do that      JecksonS Ben      12/12/11 05:11      

Back to Subject List