int __stdcall SM_WriteDigitalOutputs ( SM_HANDLE  handle,
int  start,
int  number,
unsigned char *  values 
)

Writes the state of one or more digital outputs.

Parameters
[in]handleValid handle returned by SM_Open().
[in]startStarting output (zero-indexed).
[in]numberQuantity of outputs to write.
[in]valuesDesired output state(s).
Return values
>=0Number of bytes successfully written.
-1Invalid SeaMAX handle.
-2Modbus: Connection is not established. Check the provided Connection object state.
-3Modbus: Read error waiting for response. Unknown Modbus exception.
-4Modbus: Illegal Modbus Function (Modbus Exception 0x01).
-5Modbus: Illegal Data Address (Modbus Exception 0x02).
-6Modbus: Illegal Data Value (Modbus Exception 0x03).
-7Modbus CRC was invalid. Possible communications problem.
-20SeaDAC Lite: Invalid model number.
-21SeaDAC Lite: Invalid addressing.
-22SeaDAC Lite: Error writing to the device.

The desired output state(s) parameter ('values') should be an array of bytes, where each byte represents 8 output states. The LSB of the first byte (values[0]) should contain the first 8 output states and should be ordered from LSB to MSB.

For instance, a write of 18 outputs should be an array of 3 bytes as such:

    values[0] = Outputs 7 to 0 (MSB to LSB)
    values[1] = Outputs 15 to Outputs 8
    values[2] = 6 padded bits followed by outputs 17 - 16.

Referenced by SM_WriteCoils().

 
 
Generated on Mon Nov 26 2018.