int __stdcall SM_SetSoftwareAddress ( SM_HANDLE  handle,
int  slaveID 
)

Configure's a Sealevel I/O module's software selectable Modbus slave ID (Modbus devices only).

Parameters
[in]handleValid handle returned by SM_Open().
[in]slaveIDDesired slave ID of the Modbus compliant Sealevel I/O module.
Return values
0Successful completion.
-1Invalid SeaMAX handle.
-2Connection is not established. Check the provided Connection object state.
-3Error writing to Modbus device.
-4Failed to perform implicit 'Get Module Configuration (0x45)

This method attempts to set the software selectable address (slave ID) of a Sealevel I/O module, whose side rotary switch is set to the '0' position. By default, setting the side switch to zero will result in a Modbus slave ID address of 247.

The 'Set Software Slave ID' Modbus function requires a security key byte, received by performing a 'Get Module Configuration (0x45)'. If the security key has not previously been explicitly requested , the SetSoftwareAddress() method will automatically perform the 'Get Module Configuration' function prior to executing the 'Set Software Slave ID'

Note
If the side rotary switch is not in the zero position, this Modbus function will fail.

Referenced by CSeaMaxW32::Ioctl().

 
 
Generated on Mon Nov 26 2018.