GetComStat
- Updated2023-02-21
- 3 minute(s) read
int GetComStat (int portNumber);
Purpose
Returns information about the status of a COM port.
The library accumulates COM port conditions until you call GetComStat.
GetComStat returns a negative error code if you have not opened the port or if you pass an invalid value for portNumber.
Parameters
| Input | ||
| Name | Type | Description |
| portNumber | int | A number that indicates the COM port on which to operate. This number maps to the COM port specified by deviceName in the call to OpenCom or OpenComConfig. The portNumber 1, for example, may not necessarily map to COM1. (Linux) The portNumber 1, for example, may not necessarily map to /dev/ttyS0. Valid Range: 1—1,000 |
Return Value
| Name | Type | Description | ||||||||||||||||||||||||||
| comPortStatus | int | Hardware-specific information about the status of the selected port. The status word is comprised of individual bits, each with a different meaning. Several bits can indicate the presence of more than one condition. The following table shows the hexadecimal value of the bit and its corresponding description:
Notice the ambiguity in this status information. If an error occurs on the indicated port, your application program knows that one or more bytes are invalid. Your program cannot determine from the status word which byte read is invalid. GetComStat returns a negative error code if you have not opened the port or if you pass an invalid value for portNumber. |
Additional Information
Library: RS-232 Library
Include file: rs232.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later
Example
Refer to rs232\serial.cws for an example of using the GetComStat function.
