The setparam command sends the SET PARAMETER message to the unit and parses the response.
The command takes 2 parameters: the parameter ID and the new parameter value. Only numeric values are counted as parameters.
Example 1
Setting an integer value. Only integer values are accepted.
/> setparam 0x11 1
/> Unit ID: 1, Client ID: 0, ID: 0x41, Nb: 22, Len: 2, icd_version: D, Err: 0
/> getparam 0x11
/> Unit ID: 1, Client ID: 0, ID: 0x40, Nb: 23, Len: 5, icd_version: D, Err: 0
ID: 0x11 Value: 1 (Send CRC ack)
/> setparam 0x11 0.5
Value given in wrong format
/> getparam 0x11
/> Unit ID: 1, Client ID: 0, ID: 0x40, Nb: 24, Len: 5, icd_version: D, Err: 0
ID: 0x11 Value: 1 (Send CRC ack)
Example 2
Setting a floating point value.
/> setparam 0x40 0.95
/> Unit ID: 1, Client ID: 0, ID: 0x41, Nb: 25, Len: 2, icd_version: D, Err: 0
/> getparam 0x40
/> Unit ID: 1, Client ID: 0, ID: 0x40, Nb: 26, Len: 8, icd_version: D, Err: 0
ID: 0x40 Value: 0.95000 (Road T offset)
Example 3
Assigning an invalid ID.
An invalid ID causes an invalid data error (error code = 4).
/> setparam 0x16 1
/> Unit ID: 1, Client ID: 0, ID: 0x41, Nb: 27, Len: 2, icd_version: D, Err: 4
Example 4
Using an invalid value.
An invalid value causes an invalid data error (error code = 4).
/> setparam 0x31 2
/> Unit ID: 1, Client ID: 0, ID: 0x41, Nb: 28, Len: 2, icd_version: D, Err: 4
Example 5
Setting a value to a read-only parameter.
An attempt to change the value of a read-only parameter causes an invalid data error (error code = 4).
/> setparam 0x12 1
/> Unit ID: 1, Client ID: 0, ID: 0x41, Nb: 29, Len: 2, icd_version: D, Err: 4