Hardware PropertiesInterfacing devices
Types of UARTs
Loop Back Plug
Before starting your work with the port it is desirable to clear the buffers; sometimes there's also need to clear the buffers when working with ports. For these purposes PurgeComm function can be used. This function can also stop read and write operations.
BOOL PurgeComm(HANDLE hFile, DWORD dwFlags);
hFile - descriptor of the open communication port file;
dwFlags - task to be performed.
This function can perform two tasks: clear the I/O queue in the driver or finish all the I/O operations. The tasks to be performed are specified by the following parameters:
These values can be combined with the help of bitwise OR operation. It is recommended to clear the buffers when I/O errors occur and after the work with the port is finished.
fCoder © 1998 - 2002