From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to clear the COM port?

Attached is a snippet of our COM port code.

During our receive loop, we are getting the following problems:

1) we get spurrious noise from the incoming data (may be caused by hardware...)
2) we dont get the entire data, when size=25 bytes (we had to develop a workaround)
3) we cannot reset the receive buffer/comm port (when we timeout waiting for a receive, we want to clear everything there)
- if we dont clear it, the next "interrupt", will append the incoming message with partial of last message.

Are these Win2000 vendor driver (of our RS-422 board) issues? I thought by using ReadFile() this would simplify communications?
0 Kudos
Message 1 of 3
(2,789 Views)
I don't think we can really provide any help for these questions since you are using Windows SDK programming. CVI provides a library of functions for serial communications, but you aren't using it. You may find some information from Microsoft's web (msdn.microsoft.com) that helps.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(2,789 Views)
From an answer to a different question:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000B1BB0000&UCATEGORY_0=_318_&UCATEGORY_S=0&USEARCHCONTEXT_TIER_0=0&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=cviuser2003&USEARCHCONTEXT_QUESTION_S=0

It seems I can use the FlushFileBuffers() to flush the buffer, but not clearing the current values there.

Any ideas?
0 Kudos
Message 3 of 3
(2,789 Views)