#SERIAL PORT PROBLEM
3 messages in this thread
I am having trouble reading from the serial port. I have two test
programs one sends data out of the serial port and the other reads data from
the serial port. I run the two programs together and use the modem to mirror
the output back for the input program to read. This works fine.
Now I have added a wait function to wake up when anything arrives at
the serial port. Now the program will not work. The information is read if the
wait is satisfied with a CTRL_F but appears not to recieve the serialMP message
or it ignores it.
Below is the gist of the wait and read section. Can anyone tell me what
I am doing wrong? Thanks in advance.
Nev.
WaitMask = SIGBREAKF_CTRL_C| SIGBREAKF_CTRL_F|1L << serialMP->mp_SigBit;
while (continueloop) {
waitsignalsreturn = Wait(WaitMask);
if( SIGBREAKF_CTRL_C & waitsignalsreturn)
{
continueloop = FALSE;
break;
}
serialIO->IOSer.io_Command = SDCMD_QUERY;
DoIO((struct IORequest *)serialIO);
lengh = serialIO->IOSer.io_Actual;
serialIO->IOSer.io_Command = CMD_READ;
serialIO->IOSer.io_Length = lengh;
serialIO->IOSer.io_Data = SerialReadBuffer;
DoIO((struct IORequest *)serialIO);
printf("%s",SerialReadBuffer);
}
It looks like you are calling Wait() before you call DoIO(). The Wait()
function waits for a signal. The signal is set when the IO message returns to
your reply port, not when the serial hardware receives a character. You must
put the Wait() call after the DoIO() that reads the serial.device. I hope this
clears things up for you.
Herbert L. Crowder
Manchester, Tennessee
I need to ammend that last advice. The DoIO() function has a built in
Wait(). If you need to wait for other signals use SendIO() and Wait(). Sorry I
type faster than I think sometimes.
Herbert L. Crowder
Manchester, Tennessee