Hi Avdit,
I think which you problem is in a multiple inicializations, or glitches at I/O.
If you can use a simple debounce filter to avoid glitches at I/O, like the example code:
#define TRESHOLD 20 //Here you will define a treshold for the debounce filter
byte debounce = 0;
bool state = 0; //State of your input
void Main()
{
[...]
for(;;)
{
if(input && (debounce < TRESHOLD)) debounce++;
else
{
if(!input && debounce) debounce--;
}
if(debounce >= TRESHOLD) state = 1;
else state = 0;
if(state)
{
lcd_init(); //Initializes your lcd
break; //Get out from loop, to not initialize again
}
}
[...]
}
I hope it helps!