National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 5 RS-232 Library
© National Instruments Corporation 5-29 LabWindows/CVI Standard Libraries
SetComTime
int
result = SetComTime
(int
COMPort
,
double
timeoutSeconds
);
Purpose
Sets time-out limit for input/output operations.
Parameters
Input
COMPort
integer Range 1 through 32.
timeoutSeconds
double-precision Time-out period for all
read/write functions.
Return Value
result
integer Refer to error codes in
Table 5-6.
Using This Function
This function sets the time-out parameters for all read and write operations. The default value of
timeoutSeconds
is 5.
For an RS-232 read operation,
timeoutSeconds
specifies the time allowed from the start of the
transfer to the arrival of the first byte. It also specifies the time allowed to elapse between the
arrival of any two consecutive bytes. An RS-232 read operation waits for at least the specified
amount of time for the next incoming byte before it returns a time-out error.
For an RS-232 write operation,
timeoutSeconds
specifies the time allowed before the first byte
is transferred to the output queue. It also specifies the time allowed between the transfer of any
two consecutive bytes to the output queue. The transfer of bytes to the output queue can become
stalled if the output queue is full and hardware or software handshaking is held off. If the hold-
off is not resolved within the time-out period, the RS-232 write operation returns a time-out
error.
If the
timeoutSeconds
parameter is zero, it disables time-outs and the read or write functions
wait indefinitely for the operation to complete.
The function returns an error if the port is not open or parameter values are invalid.