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.

78 questions
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
  • 43
  • 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…
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
  • 1,709
  • 1
  • 16
  • 31
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
  • 87
  • 1
  • 7
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
  • 413
  • 4
  • 19
1
vote
2 answers

Defining a falling edge detection in Codesys

For one of my programs I need a normally closed, timed-closing (NCTC) relay in Ladder Diagram. I do not know of a standard method to implement such, so I'm trying to construct one myself. My current approach needs a falling-edge detection. The code…
Mast
  • 1,542
  • 4
  • 25
  • 42
1
vote
1 answer

Cx programmer-Structured text, Array assignement

i'm learning structured text, to program with Cx-programmer, an Omron software. i' ve looked around but i can't find a way to assign multiple element to an array, i've tried this soluion, but it doesn't work, this is Arrays declaration(internals…
1
vote
2 answers

PLC Object Oriented Programming - Using methods

I'm writing a program for a Schneider PLC using structured text, and I'm trying to do it using object oriented programming. Being a newbie in PLC programming, I wrote a simple test program such a this: okFlag:=myObject.aMethod(); IF okFlag THEN …
Marconi
  • 11
  • 5
1
vote
1 answer

Shift operation returning weird error

I'm programming a plc by ABB in the codesys environment, and I can't figure out why I'm getting this error: Error 4024: ... Expecting ELSIF, ELSE or END_IF before 'SHL' The code returning this error is something like: IF flag THEN iState :=…
clabacchio
  • 927
  • 1
  • 16
  • 27
1
vote
1 answer

How do I program an Interpolated Position Mode sequence in IEC-61131 Structured Text using the Maxon EPOS Libraries?

The Maxon EPOS libraries define some Function Blocks that seemingly handle Interpolated Position Mode, however there are no samples, as far as I can determine, that specify how to use them. Here is what I have so far but at the moment it just skips…
Brendan
  • 17,191
  • 17
  • 78
  • 103
0
votes
0 answers

How do you obtain the width of a visualization control in runtime

I am trying to create scrolling text on an HMI. I have generated a formula whereby I check the (length of the text, multiplied by the pixels/Char/Fontsize) against the width of the control. If the length of the text is > width of the control, I will…
0
votes
1 answer

How to save value of integer variable in TwinCat3?

I have a program in TwinCat where 5 integer variables are being updated every 10 seconds to represent the state of 5 pumps. I want to save these values that are being generated into either a textfile or CSV file that I can later extract from the…
0
votes
2 answers

True only when going from High to Low

I’m trying to think a generalized way to program something that is True( does some logic) only when a bit goes from high to low. The programming language doesn’t matter but I prefer JAVA or Structured Text. Any help would be appreciated.
0
votes
1 answer

Why can't I pass output variable as a parameter to function block constructor in IEC61131-3 structured text (TwinCAT3)?

I have a function block A that has one variable output (defined in the FUNCTION_BLOCK A method) and this FB_init method: METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; // if TRUE, the retain variables are initialized (warm start /…
Jakub Szlaur
  • 1,190
  • 3
  • 20