×

Subscribe to newsletter

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




PLC BLOG | B&R Automation | Structured Text | < B&R Automation Studio Structured Text Programing Language
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


B&R Automation Studio Structured Text Programing Language

In B&R Automation Studio Structured Text Is A High Level Text-Based Programming Language based on the IEC 61131-3 standard. That Uses Series Of Statements To Define Complex And Sophisticated Control Algorithms For Industrial Systems. each statement of Structured Text are separated by semicolons(;). One statement can span several lines, and an end-of-line is handled as a space character. Structured Text (ST) Language Used In Programmable Logic Controllers (PLC's) 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.


Add Structured Text program in B&R automation Project

open your B&R automation studio and Create A New Project if you don’t have physical plc than is a pc based simulation for making a program during a project setup select pc based simulation. to making a program in Structured Text for a plc in a B&R automation studio, In A Menu Bar Select Insert Than Add Object Or Right Click on logical view Than Add Object.

a add object dialog select program than select new program or existing program click next

add object in the B&R automation studio

enter name of program and local data type name and add a description of your program click next

enter name of program and local data type

enter the initialization part of the program, select Language as Structured Text in program from drop down menu click to next

Language as Structured Text in program

select an option if you want to assign object to cpu than click finish

select an option if you want to assign object to cpu

new program add in a logical view it have following file
  • Cyclic code : A cyclic object is executed in a cycle time.
  • initialization code : program that execute during start up
  • local data type : declarations of Custom data types.
  • local variable: declarations of local Variable for a program

B&R automation Structured Text program files

declarations of variable for Structured Text program

variable are two types local variable and global variable. for declaration of global variable open Global.var file than add variable for local variable declarations in your new program open .var file as shown below image and add required variable select data type or instance name.

declarations of variable for Structured Text program

B&R automation Structured Text program layout

open your inserted Structured Text program, in B&R automation Structured Text program have predefined layout which start with a file header section after file header section main program section is start from PROGRAM _CYCLIC to END_PROGRAM

B&R automation Structured Text program layout

file header section Structured Text program

file header section contain information of source code file like copyright, module name, file name, author of program, date of file creation, description of source code file and file history. all part of this section only for information, file header section not executed during program execution because it is commented statement. you also add or modify any details like revision, your company name, author name, date, company website or developer email etc.

file header section Structured Text program

main program section of Structured Text program

main program start from PROGRAM _CYCLIC to END_PROGRAM. in this section we write statements and each statement separated by semicolons.

main program section of Structured Text program

Structure text B&R automation examples

below is the simple example of two momentary push button two start and stop motor one momentary push button declare as Pb_start and another push button declare as pb_stop to stop motor. if the pb_start is pressed than motor start if the pb_stop pressed than motor stop. so in this example have if else statement. if else is a conditional statement in a programming. for joining multiple condition in if else statement we use logical operator in this example we use AND, OR and Not Logical operator. try make some another program if any difficulty comment below.

B&R automation studio Structured Text Programing example

B&R automation studio timer program in Structured Text

B&R automation studio timer program in Structured Text

above is the timer example in Structured Text. timer is functional block so these function block have Instance name. declare proper instance name when make a program for function block. in this example on delay timer declare as ton_1. ton_1 is instance name of on delay timer function block and declare as local variable. after declaration of function block next to declare function parameter for execution of function. pb_start are assign for timer Input(IN) and output parameter of timer declare as timer_output and timer_et.

Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


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

comment