National Instruments 320682C Musical Toy Instrument User Manual


 
RS-232 Library Chapter 5
LabWindows/CVI Standard Libraries 5-10 © National Instruments Corporation
Parameters
Input
COMPort
integer Range 1 through 32.
fileHandle
integer File handle returned by
OpenFile.
count
integer If 0, this value is ignored.
terminationByte
integer If -1, this value is ignored.
Return Value
nbytes
integer Number of bytes written to the
output queue.
<0
Error. Refer to error codes in
Table 5-6.
Parameter Discussion
Reads count bytes from the file unless it encounters terminationByte, reaches EOF, or
encounters an error. The function returns the number of bytes successfully written to the output
queue. The function returns immediately after placing all bytes in the output queue, not when
bytes have all been sent out the com port.
If count is zero, the function terminates on terminationByte, EOF, or error.
If terminationByte is -1, it is ignored, and the function terminates on count bytes written, EOF,
or error. If terminationByte is not -1, reading from the file stops when terminationByte is
encountered. It does not write terminationByte to the output queue. If terminationByte is CR
or LF, then the function treats CR-LF and LF-CR combinations just as ComRdTerm does.
If both count and terminationByte are disabled, the function terminates on EOF or error.
Using This Function
To guarantee that all bytes were removed from the output queue before closing the port, call
GetOutQLen to determine the number of bytes remaining in the output queue. If you close the
port before every byte has been sent, you lose the bytes remaining in the queue.
The function returns a negative error code if the output queue remains full for the duration of the
time-out period, the file handle is bad, a read error occurs, the port is not open, or the COMPort
is invalid.