int __stdcall SM_SelectDevice ( SM_HANDLE  handle,
int  slaveID 
)

Targets a new Modbus device.

Parameters
[in]handleValid handle returned by SM_Open().
[in]slaveIDNew Modbus slave ID to be used in future SeaMAX operations. Valid values are 0 - 247.
Return values
0Success.
-1Invalid SeaMAX handle.
-2Invalid slave ID.

After calling SM_SelectDevice, all future SeaMAX operations will be directed at the indicated slave ID parameter. For instance, if COM3 has been opened with SM_Open() the default slave ID is 247, all reads and writes through SM_ReadDigitalInputs() and SM_WriteDigitalOutputs() will be directed at the SeaI/O module with slave ID 247.

However, if there is another module chained to the first module, and it has a slave ID of 4, that module can be read from and written to by calling SelectDevice with a value of 4. Afterward, all operations will directed at the second module (slave ID 4) until the port is closed or SelectDevice is called again.

Note
Calling this function will terminate any outstanding notify on input change requests.

References SM_NotifyInputState().

Referenced by CSeaMaxW32::Ioctl(), CSeaMaxW32::Read(), and CSeaMaxW32::Write().

 
 
Generated on Mon Nov 26 2018.