Hello everyone,
What I'm trying to do is a basic messenger (char receiver/ transmitter) via serial port in a console application.
in main function i call setup_configura tion function ---- no poroblem
then i use two functions; transmit, receive as follow:
I've no error, but the problem is i check if there is a received char in the register and print it or not, but for transmitting a char i should use cin, or getch, getche.
any function of them i have to wait until the user enter a char, so i stopped from receiving.. i have to execute only one statement at a time.
I use console so there is no events and event handler, i don't want to go to threads to monitor both transmit and receive.
If anyone can help me, I'll be thankful.
What I'm trying to do is a basic messenger (char receiver/ transmitter) via serial port in a console application.
in main function i call setup_configura tion function ---- no poroblem
then i use two functions; transmit, receive as follow:
Code:
void transmit (char ch)
{
do{
int y = inportb(0x3fd);
y = y & 0x40;
}while (y == 0);
outportb(0x3f8, (int) ch);
}
Code:
char receive ()
{
if( inport (0x3fd) & 1 == 1)
return inport (0x3f8);
return -1;
}
any function of them i have to wait until the user enter a char, so i stopped from receiving.. i have to execute only one statement at a time.
I use console so there is no events and event handler, i don't want to go to threads to monitor both transmit and receive.
If anyone can help me, I'll be thankful.
Comment