ser_sr24_input_bit


int   ser_sr24_input_bit(
     ser_sr24 handle,   //serial board handle
     int port,   //serial board port to read from
     int bit,   //port bit to read
     int *value   //pointer to integer which receives the value read from the bit
     );

Summary

The ser_sr24_input_bit function is used to read an individual bit of a port, as opposed to reading the entire port. This function may time out, based upon the current timeout value (see the ser_sr24_set_timeout() function).

Note that in order to give the programmer maximum flexibility, no checks are made to determine that the port is in digital input mode or that the buffer is enabled. See the description of ser_sr24_input_byte() for more details. Also note that checks are made on the port number and the bit number. These must be in the correct range.

Parameters

handle:
    This is the handle to the serial board; it is actually a pointer to the data structure for the board.
port:
    This identifies the port on the serial board which is to be read; valid range is 1 - 3.
bit:
    This identifies which bit of the port to read; valid range is 0 - 7.
value:
    This is a pointer to the integer variable where you want to store the value read from the bit.

Return Values

Function returns 0 upon success (bit was successfully read). Possible error codes include:

Visual Basic Notes

The Visual Basic equivalent of this function is the InputBit method. Note that the 'value' parameter is passed ByRef; the value read from the specified bit will be stored in this variable. Return values are listed above.

Prototype:
object.InputBit(
     ByVal port As Long,   'serial board port to read from
     ByVal bit As Long   'port bit to read
     ByRef value As Long   'variable where the read value is stored
     ) As Long

Example
result = object.InputBit(2, 0, value)   'read Port 2 Bit 0 and store in 'value'



Back to Contents Winford Engineering (2000)