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_configuration function ---- no poroblem
then i use two functions; transmit, receive as follow:
Expand|Select|Wrap|Line Numbers
- void transmit (char ch)
- {
- do{
- int y = inportb(0x3fd);
- y = y & 0x40;
- }while (y == 0);
- outportb(0x3f8, (int) ch);
- }
Expand|Select|Wrap|Line Numbers
- 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.