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
0
votes
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
  • 333
  • 1
  • 10
0
votes
3 answers

Is it possible to indirectly index an array in structured text (IEC 61131-3 standard)

I have an array of a structure: myStructure[0..100] I would like to index that structure by name. It works by giving each index a name: P101_AI := 9 P102_AI := 10 P103_AI := 11 P104_AI := 12 So indexing a member in the structure:…
tomatoeshift
  • 333
  • 1
  • 10
0
votes
2 answers

Delay Timer in Structured Text

I have Just started working on PLC using Structured text, I have to store values in Array of Temperature variable after delay of 1 min every time but i am not able to do that. FOR i := 0 TO 5 DO Temp[i] := tempsensor; END_FOR; This is kind a…
0
votes
3 answers

How to init bool array with TRUE in ST (Twincat2)?

How to init a boolean array in Structured Text (Twincat 2) with TRUE? For example like this: VAR a_referenz_array : ARRAY[0..2] OF BOOL := TRUE, FALSE ; (* This does not work !! *) END_VAR
0
votes
1 answer

How to create a timing to to controller states in motors?

The timing can be used to create a delay in triggering or switching off the same motor or to create a delay in switching on or off between different motors. This is a feature used to protect the motors, avoiding drives with very short intervals. In…
Apach3
  • 3
  • 2
0
votes
5 answers

MQTT using TC3_IoT_Communication; no connection with MQTT broker but there is no error

I had a mqtt broker running on my computer and I could connect to it with twincat. I moved the mqtt broker to a server on the same network. I can connect with it by using Node-RED (so the hostname, hostport, username, and password must be correct),…
Louise
  • 3
  • 2
0
votes
2 answers

How to fix a bug on my queue of devices in PLC

I am trying to create a simple queue in .st with 6 devices that should be turned on and off in the queue order only the ones that are available should be connected. For example I did a test with 6 devices available and then I was unavailable one by…
Apach3
  • 3
  • 2
0
votes
2 answers

How to handle a lot of MQTT subscription topics in TwinCAT using Tc3_IoTBase

I'm able to read multiple subscription topics by using this code. However I'm subscribed to a lot of different topics and the long if statement is slowing down my code. I already had to up the amount of cycle ticks to 20 (this is probably overkill,…
Louise
  • 3
  • 2
0
votes
0 answers

Read WAGO PLC Status Register with Structured Text

I have a WAGO PFC100 PLC with a Structured Text application running. Now I want to read the PLC's status into a variable. From the handbook I found that the status register is 0xFA0D which can be 1 (STOP) or 2 (RUN) ... but I was not able to find an…
Bugfinger
  • 1,198
  • 1
  • 14
  • 29
0
votes
1 answer

Comparing 2 arrays of characters and finding a match on S7 1500 (PLC)

I am currently working on a small coding exercise on S7 1500 using ST(SCL) where 2 Arrays, A (being the bigger one in length) and B are compared with each other and checked for matching elements. However the array B consists of alphanumeric…
Arjun
  • 9
  • 7
0
votes
2 answers

plc structured text loop delay

I am trying to have a loop where it will start at 100 and drop until it hits to a point where the while condition no longer holds true. I started with While Solar_Power_House_W_Solar_PER <= OneHundred AND BatChargePercent < OneHundred DO …
tony1420
  • 1
  • 1
0
votes
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,019
  • 18
  • 43
0
votes
2 answers

How to memcpy into a two dimensional array in Structured Text?

Basically I have this Problem like in C decribed here for Structured Text. So in C I can do this to copy vector c into matrix rows a : int a[100][100]; int c[10][10]; int i; for(i = 0; i<10; i++) { memcpy(&a[i], &c[i], sizeof(c[0])); } How to…
0
votes
2 answers

How to convert a REAL (32-bit float) to an 8-bit byte array in IEEE 754 representation?

I'm using Rockwell Automation Connected Components Workshop (CCW). I need to convert a REAL type to a byte array to be sent over RS-232/ASCII. How can this be achieved?
Sparkler
  • 1,709
  • 1
  • 16
  • 31
0
votes
1 answer

Symbolic adressing of array elements

I have an array of objects, lets say MyArray[1..x] of Object. When programming I want to have a more "readable" way of addressing each object. Instead of saying MyArray[1] := ...etc. I would like to say MyReadableName :=... I've looked into…
krakers
  • 81
  • 7