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
5
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,617
  • 1
  • 18
  • 31
5
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
  • 88
  • 2
  • 8
4
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
  • 149
  • 11
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
  • 16,207
  • 29
  • 99
  • 177
3
votes
1 answer

What is the difference between "Action" and "Method" in TwinCAT 3?

I see options to make an action instead of a method when using function blocks in TwinCAT 3. I am only familiar with methods. What is the difference between the two, and when should you use one instead of the other? I would like to know why the FIFO…
Robert S
  • 33
  • 3
3
votes
1 answer

TwinCAT Motion record travel distance

I need some help writing a function block which I can use to record the travel distance of an axis. This should record every time the axis moves sort of like an odometer, this value will be used for preventative maintenance on the axis. ie greasing…
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…
LBPLC
  • 1,570
  • 3
  • 27
  • 51
3
votes
5 answers

I need to concatenate several strings

I am new to stuctured text and I would like to know how to concatenate several string. The cleanest way possible. I this instance I only need to change one variable when creating the string. I have another where I need to do 2. That number will…
TheColonel26
  • 2,618
  • 7
  • 25
  • 50
2
votes
1 answer

Are there any cons to using TO_ conversion instead of _TO_?

TwinCAT and (I think so) every other IEC61131-3 language supports both conversion types _TO_ and TO_. I am wondering, is there any cons to using the latter, so TO_? For example, I have a calculation and we all know, that…
ziga
  • 159
  • 1
  • 6
2
votes
1 answer

How to assign variable length to an array in twincat3

I need to change the length of the array dynamically.Right now the code looks like this: VAR arrData : ARRAY[1..200] OF INT; length : INT := 200; END_VAR The size of the array depends on the length variable.Here the value of length variable…
2
votes
2 answers

Why do I not receive any data from Factory IO in my TwinCAT 3 project through Modbus?

I've set up the first Factory IO tutorial scenario, with only one input and one output (coil). I have Factory IO configured to use the "Modbus TCP/IP Server" with the following settings: Host: 127.0.0.1 Port: 502 Slave ID: …
Alex Kelly
  • 21
  • 4
2
votes
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…
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
  • 465
  • 7
  • 23
2
votes
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
  • 608
  • 1
  • 9
  • 24
1
2 3
8 9