ser_sr24_output_byte
int ser_sr24_output_byte( |
|
ser_sr24 handle, |
//serial board handle
|
int port, |
//serial board port to write to
|
int value |
//value to write to the port
|
); |
Summary
The ser_sr24_output_byte function writes the specified value to the specified port
on the serial board. This function writes to the entire port, as opposed to writing
a single bit.
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. For example, if the port is currently in input mode, and this function is
called, the output command will still be sent to the board, even though it will have no immediate
effect because the port is in input mode. If the port is later changed to output mode,
the output value will then immediately appear on the port. Also note that validation checks
are made on the port number and the value written to the
port. 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.
|
value: |
This is the value to be written to the specified port; valid range is 0 - 255.
|
Return Values
Function returns 0 upon success (byte successfully written).
Possible error codes include:
-
SER_INVALID_PORT - port number specified is out of valid range
-
SER_INVALID_PORTVALUE - value is out of valid range
-
SER_INVALID_HANDLE - returned if a NULL pointer was passed for the handle
Visual Basic Notes
The Visual Basic equivalent of this function is the OutputByte method.
Return values are listed above.
Prototype:
object.OutputByte( |
|
ByVal port As Long, |
'serial board port to write to
|
ByVal value As Long |
'value to write to the port
|
) As Long |
Example:
result = object.OutputByte(3, 255) 'turn on all bits of Port 3