Hi,
I need some helping hand.
I have to display each message only once when a key is pressed.
The problem in this code is that the message flickers/runs infinite loop.
How should I go about making it run only once every key press?
Thanks.
Code:
do { c = inportb(COM1 + 5);
if (c & 1) {char = inportb(COM1);
if (char == 79) // if O press
{
clrscr();
printf("Letter O");
}
else if (char == 88) //if X press
{
clrscr();
printf("Letter X");
}
else if (char == 89) //if Y press
{
printf("Letter Y");
clrscr();
}
else if (char == 90) //if Z press
{
clrscr();
printf("Letter Z");
}
if (kbhit()){char = getch(); //if key pressed, get char
outportb(COM1, char);} //send char to serial port
} while (char !=27); // if ESC pressed exit
}