char K;
char T;
void MainMenu()
{
do
{
K = kbd_getc();
T = K - 48;
lcd_gotoxy(1,1);
printf(lcd_putc,"A)MOD B)SET HOUR");
delay_ms(5);
if((K=='A') || (K=='B') ||(K=='C') || (K=='D'))
{
printf(lcd_putc,"\f U is zero now");
U=0;
}
}while(U==1);
}
void AltMod()
{
lcd_gotoxy(21,1);
printf(lcd_putc, "\fPRESS * FOR MAIN MENU\n");
delay_ms(5);
lcd_gotoxy(1,2);
printf(lcd_putc,"ENTER NUM=>\n");
}
void AltModRun()
{
do
{
K = kbd_getc();
T = K - 48;
if((K!=0) && (K!='A') && (K!='B') && (K!='C') && (K!='D')&& (K != '*') && (K != '#'))
{
A = (A*10) + T;
//Don't add Y=20 here, it resets it to 20 in every cycle
Y++;
lcd_gotoxy(Y,1);
printf(lcd_putc,"PRESS # FOR SUBMIT %d",T);
delay_ms(5);
}
if(K=='#')
{
num= A;
lcd_gotoxy(21,2);
printf(lcd_putc,"%d NUM IS CHOSEN", num);
delay_ms(5);
}
if(K == '*')
{
printf(lcd_putc,"\fINSIDE MOD STAR");
Y=20;
Z=0;
A=0;
}
}while(Z==1);
void main()
{
kbd_init();
port_b_pullups(true);
set_tris_b(0xF0);
rtc_init();
lcd_init();
MainMenu();//To display Main menu when program starts
while(true)
{
K = kbd_getc();
T = K - 48;
switch(K)
{
case 'D':
Z=1;
AltMod();
AltModRun();
break;
case '*':
U=1;
printf(lcd_putc, "\fINSIDE CASE STAR");
//MainMenu();
break;
}
}
}