while (1) { // When the flag is cleared and Switch2 is pressed, the process starts if (START_RC5_GetValue() == 0 && start_flag == 0) { //printf("START\r\n"); start_flag = 1; __delay_ms(700); break; } }