Navigation:  Equipments (Devices) > PLC200 > Program > String >

STR_LENGTH

Tamanho de Strings

Previous pageReturn to chapter overviewNext page

Block that calculates the size of a STRING.

 

Ladder Representation

 

STR_LENGTH_block

 

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

 

STR_LENGTH_flowchart

 

Example in Ladder

 

STR_LENGTH_example01

 

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.

 

STR_LENGTH_example02

 

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);