#define SER_NO_CHANGE -1
| SerialClose | |
|---|---|
| Purpose | Close an open serial port |
| Prototype | int SerialClose(SERIAL * port); |
| Parameters | -> port : Pointer to open serial port object |
| Result | Returns 0 if the serial connection is successfully closed or EOF if any error occurred. |
| Comments | Blocks until serial buffer is clear |
| See Also | SerialOpen |
| SerialOpen | |
| Purpose | Opens a serial connection |
| Prototype | SERIAL * SerialOpen(int portNo); |
| Parameters | -> portNo : Port number to open |
| Result | A pointer to the newly opened serial object or NULL if the port could not be opened. |
| See Also | SerialClose, SerialSetParams |
| SerialRead | |
| Purpose | Read a block of data from the serial port |
| Prototype | long SerialRead(SERIAL * port, BYTE * buffer, DWORD maxlen); |
| Parameters | -> port : Pointer to open serial object |
-> buffer : Receive buffer |
|
-> maxlen : Maximum length of receive buffer |
|
| Result | Returns the number of bytes read or -1 on error. |
| Comments | Non-blocking |
| See Also | SerialWrite |
| SerialSetParams | |
| Purpose | Set parameters for an open serial port |
| Prototype | int SerialSetParams(SERIAL * port, DWORD baudrate, DWORD bytesize, DWORD parity, DWORD stopbits); |
| Parameters | -> port : Pointer to open serial object |
-> baudrate : Baud rate for serial connection |
|
-> bytesize : Data byte size for serial connection |
|
-> parity : Parity for serial connection |
|
-> stopbits : Number of stop bits for serial connection |
|
| Result | Returns -1 on error. |
| See Also | SerialOpen |
| SerialWrite | |
| Purpose | Write a block of data to the serial port |
| Prototype | long SerialWrite(SERIAL * port, BYTE * buffer, DWORD len); |
| Parameters | -> port : Pointer to open serial object |
-> buffer : Byte buffer to be sent |
|
-> len : Length of buffer to be sent |
|
| Result | Returns the number of bytes written or -1 on error. |
| Comments | Non-blocking |
| See Also | SerialRead |
This page has been accessed times.
Copyright © 2005, Robert W. Lindeman (gogo [at] wpi.edu). All rights reserved.
This site uses valid HTML 4.01 and CSS
Last modified on .