LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

fopen and timeout-poblem

hi,

in a "c"-source the programmer used the ANSII - fopen() to build streams to serial ports RS232. Does anybody know how to set the timeout of the read-functions e.g. the fgetc() - function ? the system now waits about 5 sec if the buffer of the port is empty.

best regards

Simon
0 Kudos
Message 1 of 5
(3,652 Views)

The RS-232 library has functions that make com easier than using fopen and fgetc.  It has the SetComTime function to set the timeout.

SetComTime (int COMPort, double timeoutSeconds);

The default timeout is 5 seconds.

0 Kudos
Message 2 of 5
(3,643 Views)
ok, but the sources I got were written by using fopen() etc. do you know how to set the timeout there ?

simon
0 Kudos
Message 3 of 5
(3,611 Views)
Have you tried using SetComTime?
0 Kudos
Message 4 of 5
(3,593 Views)

I haven't tested it, but CVI RS-232 library contains GetSystemComHandle function that returns the system handle to the com port used: this value should be passed to SDK SetCommTimeouts function to set appropriate timeouts for both input and output: maybe you can give a try to it.

Hope this helps



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?
0 Kudos
Message 5 of 5
(3,564 Views)