ser_sr24_output_bit


int   ser_sr24_output_bit(
     ser_sr24 handle,   //serial board handle
     int port,   //serial board port to write to
     int bit,   //port bit to write to
     int value   //value to write to the bit
     );

Summary

The ser_sr24_output_bit function is used to write to an individual bit of the port, as opposed to writing a byte value to the entire port.

Note that in order to give the programmer maximum flexibility, no checks are made to determine that the port is in digital output mode or that the buffer is enabled. See the description of ser_sr24_output_byte() for an example. Also note that checks are made on the port number and the bit number. These two values 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 written to; valid range is 1 - 3.
bit:
    This identifies which bit of the port to write to; valid range is 0 - 7.
value:
    This is the value to be written to the bit. Any non-zero value will turn the bit on. Zero turns it off.

Return Values

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

Visual Basic Notes

The Visual Basic equivalent of this function is the OutputBit method. Return values are listed above.

Prototype:
object.OutputBit(
     ByVal port As Long,   'serial board port to write to
     ByVal bit As Long,   'port bit to write to
     ByVal value As Long   'value to write to the bit
     );

Example
result = object.OutputBit(3, 0, 1)   'turn on Port 3 Bit 0



Back to Contents Winford Engineering (2000)