Targets a new Modbus device.
- Parameters:
-
| [in] | handle | Valid handle returned by SM_Open(). |
| [in] | slaveID | New Modbus slave ID to be used in future SeaMAX operations. |
- Return values:
-
| 0 | Success. |
| -1 | Invalid SeaMAX handle. |
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.