Questions tagged [structured-text]

Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs).

From Wikipedia: Structured text is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal, on which it is based. All of the languages share IEC61131 Common Elements.

126 questions
1
vote
2 answers

How to call function every Nth seconds in IEC61131-3 structured text (TwinCAT3)?

What I want to do in the code? I want to create a function block that is made up out of 4 methods: start, stop, run, calculate. Start method will call a run method that has an while loop that periodically calls calculate method. The while loop…
Jakub Szlaur
  • 1,852
  • 10
  • 39
1
vote
2 answers

Twincat 2: Initial values are not zero

In my TwinCat 2 project, when I am initializing variables, their default value is not zero. TPS750 : BOOL; TPS750_OEE : REAL; TP750_Perf : REAL; TP750_Aval : REAL; TP750_Qual : REAL; When I start the project, the values are: TPS750 =…
ZhivkoPetkov
  • 33
  • 1
  • 5
1
vote
1 answer

How to find a length and used elements in array structured text

Array_Length_u8:=SIZEOF(SkippedElements_au8)/ SIZEOF(SkippedElements_au8[0]); I am using this formula to find the array length but its doesn't execute and always showing 256 as result
jeram .j
  • 11
  • 3
1
vote
3 answers

Are there something like classes in Structured Text?

I'm working with a Beckhoff PLC and I am trying to make a couple of POU's that are exactly the same except for the IO. I am looking for a way so I have to write the code only ones but be able to run it more than ones with different IO. For example…
plclearner
  • 11
  • 2
1
vote
2 answers

In Codesys, how to define pre-processors parameters?

I need create certain amount of struct type pairs which will be further used as const parameters and has essentially the same set of values, but scaled in half, something like this (given a n constant): TYPE ADDR_1 : STRUCT …
aluis.rcastro
  • 46
  • 1
  • 7
1
vote
2 answers

TwinCAT CoE: Write to SDO

I'm pretty new to the EtherCAT/CANopen universe and trying to implement a custom slave. The slave is passing conformance test so far and want to write to one of my Slave Data Objects, the slave is attached to a CX5120, which is found by the XAE and…
DK999
  • 33
  • 1
  • 7
1
vote
2 answers

What is the best way to clear an entire structure in Structured text

This is how I have it now TYPE MyType: STRUCT name: STRING[20]; input: INT; output: INT; END_STRUCT END_TYPE PROGRAM PLC_PRG: VAR struct: MyType; struct_NULL: MyType; error: BOOL; END_VAR IF…
tomatoeshift
  • 465
  • 7
  • 23
1
vote
1 answer

Running structured text files in Raspberry pi 3

I have my raspberry pi3 and I did a small basic code in a text editor in structured text language. I don't know how to run the code in the terminal. I'm running OPEN PLC in raspberry pi. So there should be some way to run the structured text…
Rajesh10
  • 33
  • 4
1
vote
1 answer

PLC: Convert structured text (ST) to function block diagram (FBD)

Is there a know way to convert an existing structured text PLC code to a function block diagram? (Or even CFC with Beckhoff) I know this is difficult because of the different flows the languages are based on. Maybe only partialy or atleast some…
Markus Wurm
  • 53
  • 1
  • 11
1
vote
1 answer

Get mutool to output "structured text (as xml)"

Following mutool's instructions for the draw command https://mupdf.com/docs/manual-mutool-draw.html How do I output "structured text (as xml)" when one of the output "vector formats" is "debug trace (as xml)" and the "output format is inferred from…
Clay
  • 2,584
  • 1
  • 28
  • 63
1
vote
1 answer

How to sync operations between AST and DOM in haskell?

To implement a visualized arithmetic expression editor in Haskell, I defined the following things: data AST = Lit Int | Add AST AST | Neg AST eval :: AST -> Int type TagName = String type Attrs = M.Map String String data DOM =…
1
vote
1 answer

How to avoid literals in case labels in CCW using structured text?

I'm using Connected Components Workbench (CCW) and the syntax for a case statement that is given in the documentation is: CASE OF : ; ; :…
Sparkler
  • 2,581
  • 1
  • 22
  • 41
1
vote
4 answers

Iterating over structures in Twincat PLC (Structured text)

Say I have the following structure that is filled with information about an Axis: TYPE AxisInfo : STRUCT AxisStatus : ARRAY [0..3] OF BYTE; DriveStatis : ARRAY [0..3] OF BYTE; FeedRate : ARRAY [0..3] OF BYTE; Inputs : BYTE; …
youngEngineer
  • 51
  • 2
  • 5
1
vote
2 answers

How to set baudrate on TwinCAT3 PLC for EL6002 or EL6001 comport?

I cannot find how to set baudrate for the Beckhoff EL6002. I got a hint that I should use CoeWrite block for that but as I am bit new to TwinCAT I cannot find the correct function block. Could someone send a code example (on structured text) how to…
RamiR
  • 139
  • 2
  • 8
1
vote
1 answer

Structured Text - dereference table pointer with offset

Regarding the Structured Text Programming Language: If I have a pointer to a table: crcTable : ARRAY [0..255] OF WORD; pcrcTable : POINTER TO WORD; pcrcTable := ADR(crcTable); and I want dereference the table at a certain index, what is the syntax…
user2913869
  • 481
  • 2
  • 5
  • 23
1 2
3
8 9