while (1) 
{ 
   // Press Switch-1 to toggle the Mode (Reset Microcontroller after every  //  Mode change)  
    if (MODE_RB4_GetValue() == 0) 
    {  
        mode ^= 1;  
        LED_RA7_Toggle();  
        __delay_ms(700);  
    } 

   // When the flag is cleared and Switch-2 is pressed, the process starts  
    if (START_RC5_GetValue() == 0 && start_flag == 0) 
    {
        //Uncomment the line below for sending data to MikroPlot                
        //printf("START\r\n");  
        start_flag = 1;  
        __delay_ms(700);  

        break;  
    }  
}