Questions tagged [st]

Structured Text is a high level text based programming language for PLCs. DO NOT USE this tag for questions regarding products from ST Microelectronics! For questions about the simple terminal (st) for X, use [x-st].

Structured Text is a high level text based programming language for PLCs based on Pascal. It is one of the five IEC 61131-3 programming languages.

Tag usage:

  • Make sure that your question specifies which PLC model you are using.
  • Always use this tag together with or your question will not draw attention from the right kind of people who can answer it.
  • DO NOT USE this tag for questions regarding products from ST Microelectronics! Instead use the relevant product tags such as for example or .
  • Do not use this tag for questions about the simple terminal (st) for X, use instead.
107 questions
0
votes
0 answers

Twincat3 ST variables conversion

I have some complicated array of structures and I want to write it into CSV file. So I need "variable to string" conversion. Beckhoff as always doesn't care about documentation and their INT_TO_STRING function doesn't work (UNEXPECTED INT_TO_STRING…
Mirek
  • 13
  • 3
0
votes
0 answers

Codesys Structured Language, how to get current visu block X,Y position?

I am learning how to use Codesys visualisation blocks. I can't find any information on how to get block X, Y positions. For example I want to assign current X and Y position values to var_x, and var_y after a button click, but I do not know how to…
0
votes
2 answers

Linear Interpolation in TwinCAT

I'm trying to use FB_CTRL_LIN_INTERPOLATION, which exists in Controller Toolbox in TwinCAT3 as described in this link. Unfortunately, the examples on the Infosys site are not practical; for example, there is no data type FLOAT on twincat3 at all; it…
asys
  • 667
  • 5
  • 20
0
votes
1 answer

CoDeSys - Unable to write to internal variable

I'm currently working on a demo project from LinMot. The problem I ran into is that I'm unable to write the values I get of the fieldbus to the variables I have to work with. As you can see in the image I'm able to grab the correct values of the…
flyingchris
  • 316
  • 4
  • 10
0
votes
1 answer

How to export Event logger events in twincat 3 and write the logged events into a file?

As of now I have created a few events and used a FB_tcmessage function block to fetch the diplay text of the event and concatenated time stamp in string format and trying to write it into a txt file, but after the write operation the txt file shows…
0
votes
1 answer

Adding 1 to a byte in Structured Text

I'm trying to implement the logic below: if bcc = STX or bcc = CR, then bcc := +1 (increment of 1). bcc is a byte and i'm trying to increment it by 1 if this condition above is true. my code is: IF message_byte[11] = 16#0D OR message_byte[11] =…
opol
  • 1
  • 1
0
votes
2 answers

Name for "get ready to run" mode

This is a vocabulary question. I do now know where else to ask a question like that, because forums related to the English language are not filled with people who would be aware of what terms feel right to use in a plant. I have a concept of a "get…
Fred
  • 6,590
  • 9
  • 20
0
votes
1 answer

Beckhoff PLC with pro-face HMI, change between displays

We have recently started to work with Beckhoff PLCs in combination with pro-face HMIs. The communication goes over ADS. PLC and HMI exchange information using certain variables. On the UI of the HMI I can switch between several screens by pressing…
bask185
  • 377
  • 1
  • 3
  • 12
0
votes
1 answer

FIFO list using arrays in ST (PLC)

I'm working on a conveyor-sorter solution and need to store data about items in some organised manner. My first guess was FIFO. Do you know if there is any "good practice" way to program efficient FIFO list in Structured Text (PLC)? Or have you…
0
votes
2 answers

Multi independent input timer

Imagine that we have independent boolean variables that can occur independently. Now, if at least one of the variables occurs for a certain period of time, an alert will be activated. The common solution is that we use a timer for each variable. Is…
asys
  • 667
  • 5
  • 20
0
votes
2 answers

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,852
  • 10
  • 39
0
votes
1 answer

Usage of VAR RETAIN PERSISTENT

I'm using WAGO PLC PFC200 in my home automation project. I've plenty of POUs, each for one room. Each room implements IRoom interface and uses base POU for common logic like turning off all lights. For lights management, I'm…
Dawid Rutkowski
  • 2,658
  • 1
  • 29
  • 36
0
votes
0 answers

Table of pointers

I'm using Wago PLC - PFC200 - for home automation. I already did most of the things like lights or blinds automation. Recently I decided to do some refactoring and I started to think that such PLC is not a PC with a garbage collector and it might be…
Dawid Rutkowski
  • 2,658
  • 1
  • 29
  • 36
0
votes
4 answers

How to pass variable type as an argument to an function in IEC61131-3 structured text (TwinCAT3)?

This is what I would like to have (this is a constructor for FB object): METHOD FB_init : BOOL VAR_INPUT bInitRetains : BOOL; bInCopyCode : BOOL; //My variables: typeOfVariable : TYPE; // This obviously doesn't…
Jakub Szlaur
  • 1,852
  • 10
  • 39
0
votes
2 answers

Need to optimize code (Reduce the size) CODESYS ST (TwinCat 2) to save memory

The code size (CODESYS ST, TwinCat 2) for the beckhoff BC9000 PLC (64 kB max) should be reduced to a minimum: var word_CO2: word; (code skipped) Need to reduce the size of this…