Actually you gotta be careful with this one.  This will return when
the transfer to the serial driver is complete, which is not always the
same as when the physical transmission is complete.  For example, the
UART FIFO may contain outbound data that hasn't yet shifted out.  The
driver has done its job by moving the data to the UART and thus
returns, but the data has not yet left.

Another example is with some Ethernet Serial ports.  The driver may
return when the packet of TX data is sent via ethernet to the remote
port.  This means that the write can complete in the local system
before the serial data reaches its destination (ie: transmitted out
the serial port).

The problem is that there is no set way to handle this issue (what I
called the "FIFO effect"), and different serial drivers will all
handle this differently.

This is one reason why the "2-Wire Auto" 485 transmission mode
available on NI RS-485 interfaces is extremely helpful.  Since the
transmitter is turned on and off at the serial port and the mechanism
is independant of the serial driver and application, you're able to
immediately (or within a bit time or two) and automatically disable
the tranmitter as soon as the last bit of your data shifts out.

Reply via email to