LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

rs232, ComRdByte (COM_PORT);

Solved!
Go to solution

I am trying to write a program read byte by byte until return <0, then quit the while loop.  Somehow the program kept on show non-fatal errors telling me the the return -99, which made my program not usable.

 

Can anyone tell me what should I do.

 

I tried to reply on event,  eventMask = LWRS_RXFLAG | LWRS_BREAK ,  and use the following code, but the programm lost many messages. Unless it is a single line of message that is received.

 

/* read until time out or line feed or carriage */
rtn = ComRdTerm (COM_PORT, readBuf, 512, terminationByte);
while ( rtn > 0 )
{
 SetCtrlVal (panelHandle, PANEL_TEXTBOX_Output, readBuf);
 rtn = ComRdTerm (COM_PORT, readBuf, 512, terminationByte);
}

 

 

0 Kudos
Message 1 of 3
(2,244 Views)
Solution
Accepted by topic author qing22

Error -99 is simply the timeout error: it is possible that you are reading more characters that those effectively on the queue. Anyway, to avoid having interrupted you could remove the checkmark to Run >> Break on >> Library Errors menu option.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(2,203 Views)

Thank you ... removed the checkmark to Run >> Break on >> Library Errors menu option, the annoying break is gone.

0 Kudos
Message 3 of 3
(2,189 Views)