
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 ...
        }
    }
}