I'm new to programming and I'm trying to put a pause in my code before my while(1) loop in in my main(). The pause will be broken after the state of a push button is change. I'm not sure how this is achieved using the pause or getchar, I've seen it done with a key press but not sure how to achieve it with state change of a push button.
#define _XTAL_FREQ 16000000
#pragma config WDT = OFF
#include <xc.h>
#include <stdio.h>
#include <math.h>
#include "lcd.h"
#define UI_Go PORTCbits.RC5 //Go button
void main(void) {
lcd_init();
lcd_cmd(L_L4);
sprintf(Start, "'Go' to Start"); //Start while loop
lcd_str(Start);
__delay_ms(10);
while(1){
Refill();
}
}
not having the hardware i cannot test but taking your comment as gold
you need
while(UI_Set==1);
this will loop waiting for the button to be pressed
or maybe
while(UI_Set==0);
not sure which way round the logic is