ser_sr24_input_byte


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

Summary

The ser_sr24_input_byte function reads the value on an entire port of the serial port, as opposed to reading just a single bit. This function may time out if a response is not received within 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. This has slightly different implications than for the output function. First, if this function is used to read a port that is in digital output mode, the function will provide the value that is currently present on the port. If the port is in analog input mode, this function behaves as normal and simply reads the digital value respresented on the port.

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.
value:
    This is a pointer to the integer variable where you want to store the value read from the port.

Return Values

Function returns 0 upon success (byte was successfully read and stored in value parameter). Possible error codes include:

Visual Basic Notes

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

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

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



Back to Contents Winford Engineering (2000)