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
4
votes
1 answer

Is there a way to print to output console? (twincat3)

Is there a way to print to output to console like debug.print() in VB.NET using structured text? (twincat3)
Jess
  • 76
  • 1
  • 8
4
votes
2 answers

How to write an ASCII value into a string in Structured Text for a PLC?

For a PLC program written in Structured Text I need a string which starts with the ASCII values 0x01 0x01 0x01 0x00 0x12. In Java I would do this with: String literal = "\x01\x01\x01\x0\x12"; How can I achieve the same in Structured Text for a PLC?
BetaRide
  • 14,756
  • 26
  • 84
  • 153
3
votes
1 answer

B&R Automation Studio "Error 9340: Project contains Visual Component objects but no version definition"

When compiling an B&R project in Automation Studio this error is thrown. Error 9340: Project contains Visual Component objects but no version definition How to solve this compile error? Automation Studio V 4.0.29.87.
fishjd
  • 1,415
  • 1
  • 16
  • 28
3
votes
2 answers

Defining Arrays in Codesys

I'm using Codesys to create an array. The example below is what I'm using to create an array for 5 values ARRAY [1..5] OF INT := [1,2,3,4,5]; That's fine for an array of 5 but if I needed an array for 100 values? Is there a quicker way of doing an…
darnbar
  • 33
  • 1
  • 1
  • 5
3
votes
5 answers

Pausing Timers In Structured Text

I need to be able to pause a timer and retain it's ET value when the timer is no longer being asked to run. The timer times when the input from a proximity switch is not present, but I only want it to time when the pump that forwards on the material…
SilverShotBee
  • 1,480
  • 3
  • 23
  • 46
2
votes
1 answer

How do I run a Twincat program without PLC?

I am a beginner in Twincat and have been playing around with it. I watched this playlist where this guy explain structured text and successfully runs a program on his system. However when I try to run on my system, I get error 0x1028. Then I read…
Piper
  • 105
  • 5
2
votes
2 answers

In structured text: is it possible to write to a multi dimensional array with a single line in the cyclic code?

The following works fine: PROGRAM PLC_PRG: VAR MyArray : ARRAY[0..1,0..5]OF USINT := [1,2,3,4,5,6,7,8,9,10,11,12]; i : INT; j : INT; END_VAR // change to random values FOR i:=0 TO 1 DO FOR j:=0 TO 5…
tomatoeshift
  • 333
  • 1
  • 10
2
votes
1 answer

Is there a way to use Methods in Structured Text (ST) to program a PLC

So I am new to PLC programming and I come from a traditional Object Oriented programming background. I am used to programming languages having guides/references on how to use the languages but I cannot find any readily available online. I want to…
1
vote
3 answers

Twincat 3: Giving names to array bits

Beginner in the whole PLC stuff, so corrections are welcome. I am trying to tidy up my project and current situation is thus: I receive 16 byte arrays from modbus. These act as buttons, lights, conveyors what have you in Factory…
1
vote
1 answer

Twincat 3 Using FB_MBReadRegs Modbus

I cant get FB_MBReadinputs to work in Twincat, when Factory IO is sending/receiving Input and Holding registers. First off here's my currently working snip of handling Modbus from Factory IO: VAR GAB_FactoryIO_Inputs AT %I* : ARRAY [0..15]…
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,190
  • 3
  • 20
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 =…
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
  • 1
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
1 answer

Unknown Type Errors when using functionblocks from my own library project

So I have a library project where I defined a couple of functionblocks and interfaces. Now I want to use this library in a plc project (in the same twincat solution). So I do the whole save all, rebuild, save and install as a library spiel. If I try…
Daanvl
  • 598
  • 1
  • 8
  • 24
1
2 3 4 5 6