Block that calculates the size of a STRING.
Ladder Representation
![]()
Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
STR1 |
STRING |
Input STRING |
|
VAR_OUTPUT |
DONE |
BOOL |
Output enabling |
LEN |
BYTE |
STRING size |
Operation
This block remains active as long as EN is at TRUE level, updating the value of LEN according to the identified size of STR.
The DONE value forwards to the next Ladder block the EN value when the operation is completed.
Compatibility
Device |
Version |
PLC300 |
2.10 or higher |
Block Flowchart

Example in Ladder

In the above example, the length of STRING in STR is calculated and the result is sent to LEN. The block ends successfully, Done output is activated.

In the above example, the length of STRING in STR is calculated and the result is sent to LEN. The block ends successfully, Done output is activated. Note that null STRINGS have length zero.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR STR1 : STRING := ''; LEN : BYTE; END_VAR
LEN := FB_STR_LENGTH( EN:=DI1, STR:=STR1, Done=>DO1);
|
|---|