SoftPLC
 
Font size:      

Usage

Ladder Instructions

TLI: SDI_CMD_M

The SDI_CMD_M instruction is used to perform a "Start Measurement" command and the necessary subsequent commands to retrieve the data measurements from the sensor.

There are five (5) parameters for this TLI:

SDI_CMD_M TLI Parameters
Parameter NameDescrption
"Control:"Control element (R) address. The ".CTL" word bits are used to indicate activity status for the TLI. When the instruction is triggered, the enable (EN) and queue (EU) bits are set. On completion of sending, either the done (DN) or error (ER) bit will be set: the DN for a successful send, the ER for any error. The ER bit will also be set if the message queue is currently full.
"Status:"Integer element (N) address. This is used to store the status code for the communication sequence.
"Sensor Adr:"String element (ST) address. This should be a single-character string; it is used to specify the address of the sensor to which the command should be sent. Valid addresses: 0-9, A-Z, a-z
"Results:"Float (F) block address. This is a block address (e.g. #F8:0) which will be used to store the data returned from the sensor. Data values are stored starting at the specified element, up to a max of 100 values (the file will automatically be resized such that it will support 100 elements if it does not already).
"Use CRC:"Integer element (N) address, or integer value. A '1' or '0' value: 1 means yes, 0 means no. If yes, the sensor will return its data values with CRC characters added (this is handled and checked automatically by the driver).


TLI: SDI_CMD_MX

The SDI_CMD_MX instruction is used to perform a "Additional Measurement" command and the necessary subsequent commands to retrieve the data measurements from the sensor.

There are six (6) parameters for this TLI:

SDI_CMD_MX TLI Parameters
Parameter NameDescrption
"Control:"Control element (R) address. The ".CTL" word bits are used to indicate activity status for the TLI. When the instruction is triggered, the enable (EN) and queue (EU) bits are set. On completion of sending, either the done (DN) or error (ER) bit will be set: the DN for a successful send, the ER for any error. The ER bit will also be set if the message queue is currently full.
"Status:"Integer element (N) address. This is used to store the status code for the communication sequence.
"Sensor Adr:"String element (ST) address. This should be a single-character string; it is used to specify the address of the sensor to which the command should be sent. Valid addresses: 0-9, A-Z, a-z
"Results:"Float (F) block address. This is a block address (e.g. #F8:0) which will be used to store the data returned from the sensor. Data values are stored starting at the specified element, up to a max of 100 values (the file will automatically be resized such that it will support 100 elements if it does not already).
"Use CRC:"Integer element (N) address, or integer value. A '1' or '0' value: 1 means yes, 0 means no. If yes, the sensor will return its data values with CRC characters added (this is handled and checked automatically by the driver).
"Meas. Num:"String element (ST) address. This should be a single-character string; it is used to specify the 'additional' measurement number. Valid values: 1-9


TLI: SDI_CMD_C

The SDI_CMD_C instruction is used to perform a "Start Concurrent Measurement" command and the necessary subsequent commands to retrieve the data measurements from the sensor(s).

There are five (5) parameters for this TLI:

SDI_CMD_C TLI Parameters
Parameter NameDescrption
"Control:"Control element (R) address. The ".CTL" word bits are used to indicate activity status for the TLI. When the instruction is triggered, the enable (EN) and queue (EU) bits are set. On completion of sending, either the done (DN) or error (ER) bit will be set: the DN for a successful send, the ER for any error. The ER bit will also be set if the message queue is currently full.
"Status:"Integer (N) block address. This is used to store the status code(s) for the communication sequence. Each element will hold a status corresponding to the sensor in the "Sensor Adr" parameter, by index in the string.
"Sensor Adr:"String element (ST) address. This is used to specify the address of the sensor(s) to which the command should be sent. Valid addresses: 0-9, A-Z, a-z. Each address specified in the string must be unique (no repeated characters).
"Results:"Float (F) block address. This is a block address (e.g. #F8:0) which will be used to store the data returned from the sensor. Data values are stored starting at the specified element, up to a max of 100 values PER SENSOR (the file will automatically be resized such that it will support 6200 elements (100 max values per sensor * 62 maximum sensors) if it does not already).

Each sensor's values will be offset into the block by 100 * the index of the address in the string, starting at 0. It is strongly recommended you specify this block starting at element 0.

Example: Sensor string of "04a" would have sensor 0's values starting at F8:0, sensor 4's values starting at F8:100, and sensor a's values starting at F8:200
"Use CRC:"Integer element (N) address, or integer value. A '1' or '0' value: 1 means yes, 0 means no. If yes, the sensor will return its data values with CRC characters added (this is handled and checked automatically by the driver).


TLI: SDI_CMD_CX

The SDI_CMD_CX instruction is used to perform a "Additional Concurrent Measurement" command and the necessary subsequent commands to retrieve the data measurements from the sensor(s).

There are six (6) parameters for this TLI:

SDI_CMD_CX TLI Parameters
Parameter NameDescrption
"Control:"Control element (R) address. The ".CTL" word bits are used to indicate activity status for the TLI. When the instruction is triggered, the enable (EN) and queue (EU) bits are set. On completion of sending, either the done (DN) or error (ER) bit will be set: the DN for a successful send, the ER for any error. The ER bit will also be set if the message queue is currently full.
"Status:"Integer (N) block address. This is used to store the status code(s) for the communication sequence. Each element will hold a status corresponding to the sensor in the "Sensor Adr" parameter, by index in the string.
"Sensor Adr:"String element (ST) address. This is used to specify the address of the sensor(s) to which the command should be sent. Valid addresses: 0-9, A-Z, a-z. Each address specified in the string must be unique (no repeated characters).
"Results:"Float (F) block address. This is a block address (e.g. #F8:0) which will be used to store the data returned from the sensor. Data values are stored starting at the specified element, up to a max of 100 values PER SENSOR (the file will automatically be resized such that it will support 6200 elements (100 max values per sensor * 62 maximum sensors) if it does not already).

Each sensor's values will be offset into the block by 100 * the index of the address in the string, starting at 0. It is strongly recommended you specify this block starting at element 0.

Example: Sensor string of "04a" would have sensor 0's values starting at F8:0, sensor 4's values starting at F8:100, and sensor a's values starting at F8:200
"Use CRC:"Integer element (N) address, or integer value. A '1' or '0' value: 1 means yes, 0 means no. If yes, the sensor will return its data values with CRC characters added (this is handled and checked automatically by the driver).
"Meas. Nums:"String element (ST) address. This should be a single-character string; it is used to specify the 'additional' measurement number. Valid values: 1-9. Each character in the string will be matched, by index, to the corresponding sensor character in the "Sensor Adr" string.


TLI: SDI_CMD_RX

The SDI_CMD_RX instruction is used to perform a "Continuous Measurement" command, to retrieve data from a sensor running in continuous mode (if supported). If the sensor does not support the requested 'R' measurement, the control element will have the ER bit set and the status will contain an error code indicating NO DATA.

There are six (6) parameters for this TLI:

SDI_CMD_RX TLI Parameters
Parameter NameDescrption
"Control:"Control element (R) address. The ".CTL" word bits are used to indicate activity status for the TLI. When the instruction is triggered, the enable (EN) and queue (EU) bits are set. On completion of sending, either the done (DN) or error (ER) bit will be set: the DN for a successful send, the ER for any error. The ER bit will also be set if the message queue is currently full.
"Status:"Integer element (N) address. This is used to store the status code for the communication sequence.
"Sensor Adr:"String element (ST) address. This should be a single-character string; it is used to specify the address of the sensor to which the command should be sent. Valid addresses: 0-9, A-Z, a-z
"Results:"Float (F) block address. This is a block address (e.g. #F8:0) which will be used to store the data returned from the sensor. Data values are stored starting at the specified element, up to a max of 100 values (the file will automatically be resized such that it will support 100 elements if it does not already).
"Use CRC:"Integer element (N) address, or integer value. A '1' or '0' value: 1 means yes, 0 means no. If yes, the sensor will return its data values with CRC characters added (this is handled and checked automatically by the driver).
"Meas. Num:"String element (ST) address. This should be a single-character string; it is used to specify the measurement number. Valid values: 0-9


Error Codes

 

SDI-12 TLI Error Codes
Error CodeNameDescrption
0SDIE_SUCCESS Successful command.
101SDIE_INSUFFICIENT_API (Not used for TLI status) Indicates that the SoftPLC version is out of date for the TLM and must be upgraded.
201SDIE_OLD_REQUEST The command was queued on a previous program run, ie: the runtime was transitioned to PROGRAM mode, then to RUN mode after this command was put in the queue.
202SDIE_BAD_CMD_TYPE The TLI's command type is not recognized by the TLM.
203SDIE_NO_MEMORY The TLM's FIFO queue for the TLI commands is full, so this command could not be added.
204SDIE_INVALID_ADDRS 1) The number of sensor addresses specified was invalid.
2) There was an invalid character specified as a sensor address.
3) There was a duplicate sensor address specified.
205SDIE_INVALID_ADTL_NUM 1) The number of additional cmd numbers did not match the number of sensors.
2) An invalid character was specified as an additional cmd number.
301SDIE_COMPORT_ERR There was an error relating to the serial port used for SDI-12 communication.
401SDIE_SENSOR_REPLY_NONE The sensor did not reply within the timeout.
402SDIE_SENSOR_REPLY_FAILED The reply from the sensor was incomplete or mangled and could not be handled.
403SDIE_SENSOR_REPLY_BADCRC The CRC in the reply did not match the calculated CRC.
404SDIE_SENSOR_REPLY_INVALID The sensor's reply did not match the expected format.
405SDIE_SENSOR_REPLY_NODATA The sensor's data reply did not contain any values.
406SDIE_SENSOR_SVCREQ_BAD The sensor did not send a service request when expected, or the service request message was invalid. (Only relevant to 'M' or 'MX' command types)