RS-232 Library Chapter 5
LabWindows/CVI Standard Libraries 5-16 © National Instruments Corporation
for ComRdTerm. If both count and terminationByte are disabled, the function terminates on
error (which can include a time-out).
Using This Function
The function returns an error 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.
ComWrtint nbytes = ComWrt (int COMPort, char buffer[], int count);
Purpose
Writes count bytes to the output queue of the specified port. Returns an integer value indicating
the number of bytes placed in the queue. Returns immediately without waiting for the bytes to
be sent out of the serial port.
Parameters
Input COMPort integer Range 1 through 32.
buffer string Buffer containing data to be written, or actual
string.
count integer 0 value places no bytes in queue.
Return Value
nbytes integer Number of bytes placed in the output queue.
<0 Error code; See Table 5-6. Byte not placed in
the output queue.
Using This Function
This function times out if the output queue has not been updated in the specified time-out period.
This can occur if the output queue is full and no further data can be sent because XON/XOFF is
enabled and the device has sent an XOFF character without sending the follow-on XON
character. It can also occur if Hardware Handshaking is enabled and the Clear To Send (CTS)
line is not asserted.
Bytes are sent from the output queue to the serial device under interrupt control without program
intervention. If you close the port before all bytes have been sent, you lose the bytes remaining in
the queue. To guarantee that all bytes have been removed from the output queue before closing