int ComRdByte (int COMPort);
Reads a byte from the input queue of the port you specify.
Returns an integer whose low-order byte contains the byte read. Returns on timeout, when the byte is read, or when an error occurs. If an error or a timeout occurs, ComRdByte returns a negative error code. This is the only case in which the high-order byte of the return value is nonzero.
ComRdByte times out whenever the input queue remains empty for an entire timeout period. On a timeout, ComRdByte returns -99. You can set the timeout period by calling SetComTime.
ComRdByte returns an error code if you have not opened the port, if you pass an invalid parameter value, or if a timeout occurs.
![]() |
Note When executing a transfer less than 8 bits, LabWindows/CVI does not guarantee the value of the invalid high bits. For a 7 bits transfer, the value of the 8th bit is undefined. 7 bit value "0x60" can be passed back as "0x60" or "0xE0"(0x60|0x80). This depends on the device driver. Most drivers set the value to 0. |
Input | ||
Name | Type | Description |
COMPort | integer | A number that indicates the COM port on which to operate. This number is paired with deviceName, which represents the COM port, during the OpenComConfig function call. Default Value: 1—COM1 Valid Range: 1—1,000 |
Name | Type | Description |
byte | integer | The byte read from the selected port, unless an error occurs. If an error occurs the return value is a negative error code. |