LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication timeout

Based on CVI6.0,Windows98, I used Windows API: SetCommTimeouts() and ReadFile() to receive a data frame from serial port (9.6k,10bits), There is no interval between the arrival of any two bytes in the frame. But I found if I set ReadIntervalTimeout less than 12 mS, the ReadFile() operation will be completed before whole frame be received, for example only get first 8 bytes of all 15 bytes.You will get the remainder in next ReadFile().

How do I decrease the interval timeouts setup and receive whole data frame one time?
0 Kudos
Message 1 of 2
(3,247 Views)
You aren't using the CVI serial functions, so I can't tell you a whole lot about how the API works. Basically though, what you are doing seems to make sense. The timeout you are setting tells the Windows API functions how long to wait before timing out the read operation. When you set that timeout low, then the read completes without receiving the entire sent frame. Serial is a data stream and doesn't package "frames" based on write operations. You will have to set the timeout for a higher read interval, or deal with reconstructing the data frames from multiple read function calls.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 2
(3,247 Views)