×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | What is structured text language in PLC?
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


What is structured text language in PLC?

Structured text is a high level text-based programming language that uses series of statements to define complex and sophisticated control algorithms for industrial systems. Structured Text (ST) language used in Programmable Logic Controllers (PLCs) to write logic for industrial automation applications. Structured Text have set of Expression, assignment, loops, conditional statements, and functions for making a program. by using a structured text language possible to make reusable code blocks and use in different program. Some of the following benefits of structured text


  • Flexibility
  • Reusability
  • Readability
  • self-documenting
  • Portability
  • high level language


What is the difference between Ladder Diagram(LAD) and Structured Text (ST)?

Structured Text (ST) is a text-based programming language while Ladder Diagram(LAD) is a graphical programming language that uses ladder-like rungs to represent logical functions. It uses structured control statements, such as IF-THEN-ELSE, WHILE-DO, and FOR-TO-DO loops, to define the control logic of the system. LAD consists of vertical power rails, representing the positive and negative power supply, and horizontal rungs, representing the logical functions. Structured Text (ST) is more flexible and powerful than LAD, but it requires more programming knowledge and experience. Ladder Diagram (LAD) is easier to understand and use, but it is less flexible and limited in terms of programming capability.

What is the difference between Ladder Diagram(LAD) and Structured Text (ST)

what is assignment operator of Structured Text (ST)

assignment operator(:=) used to assign a value to the tag. this is ":=" assignment operator. terminate assignment by semi colon ';'. below is the some example of assignment operator.

above is the simple example of assignment operator in first line tag value of preset_temp which have DINT is 12 and second line pushbutton tag which has bool data type and assign to 1(true/ON).


what is expression?

An expression is part of a complete assignment or construct statement. An expression may be a number, string, condition, tag or bool. below is the list of expression
  • Tag Expression:Tag expressions are a way of selecting specific memory area and store the value in selected memory area. tag may be type of BOOL, SINT, INT, DINT, REAL, String for example if our tag have bool data type so it reserve some memory from memory. in above example preset_temp and pushbutton is tag expression.
  • Immediate Expression: for assign a constant value is known as immediate expression. for example "preset_temp:=24;"
  • Operators Expression::A symbol or mnemonic that specifies an operation within an expression for example "total:=value1+value2;"
  • Function Expression:When executed, a function yields one value. Use parentheses to contain the operand of a function. Even though their syntax is similar, functions differ from instructions in that functions can be used only in expressions. Instructions cannot be used in expressions. for example sqrt(2);

what is assignment operator of Structured Text (ST)

what is BOOL expression in structured text:

BOOL expression in structured text: a tag expression that have two value 1 for True or 0 for false. data type always bool. for example "temp ≤11".A bool expression uses bool tags, relational operators, and logical operators to compare values or check if conditions are true or false. Typically, use bool expressions to condition the execution of other logic

Numeric expression in structured text : An expression that store and calculates an numerical value. A numeric expression uses arithmetic operators, arithmetic functions, and bitwise operators.

String expression in structured text: An expression that store a string in memory area.

what is BOOL expression in structured text

what is arithmetic operators in structured text

arithmetic operators in structured text this operator perform math operations of non boolean value.

  • '+' operator for addition.
  • '-' operator for subtraction.
  • '*' operator for multiply.
  • '/' operator for division.
  • '**' operator for Exponent.
  • 'MOD' operator for Modulo-divide.
for example total:=(value1)/value2+value3; in this example / is a divisional operator, + addition operator


what is arithmetic operators in structured text

what is Relational operators in structured text

Relational operators in structured text it perform comparison of two values or strings and provide a result in the form of true or false. The result of a relational operation is a BOOL value.

  • '=' operator for equal.
  • '<' operator for lessthan.
  • '>' operator for greater than.
  • '<=' operator for less than equal to.
  • '>=' operator for greater than equal to.
  • '<>' operator for Not equal.

what is Relational operators in structured text

what is logical operators in structured text

these operator used for perform verify if multiple conditions are true or false. The result of a logical operation is a BOOL value.
  • '&, AND' operator for AND. result is true only if both condition are true, and false otherwise.
  • 'OR' operator for OR. Result is true if at least one of the condition is true, and false if both condition are false.
  • 'XOR' operator for XOR. Result is true if the condition result is different Boolean values (one is true and the other is false), and false if the condition have the same Boolean value (both true or both false).
  • 'NOT' operator for NOT.

what is logical operators in structured text
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

comment