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
0
votes
0 answers

Error "An invalid device OR an invalid constant is being used" when compile simple GX Works 2 program in FX3G PLC

I have FXCPU PLC FX3G series and I create ST Structured Project in GX Works 2. The problem is I cannot loop through an array of bits. Here are my local variables. Now this code in a program compiles with error (* Do not compile! *) FOR iCount := 0…
Sergey Romanov
  • 2,949
  • 4
  • 23
  • 38
0
votes
2 answers

flowing lights in structured text

I am very new to structured text, so pardon my simple question. I am using OpenPLC to create this simple program. I have been following the example from the link below to create flowing lights simple program with structured text. In this video, they…
M. ahmed
  • 53
  • 2
  • 11
0
votes
1 answer

Strings in FB_init

Is there a way to declare a undefined length string as a constructor or a work around? I need to write a log file for a function block. The file name needs to be declared in the FB declaration but there are compiler errors which don't allow me to…
0
votes
0 answers

Inputs expected on function call in structured text

I'm working on a project with RightWON Configuration Suite. I use structured text to code and create functions (UDFB). My problem is that when I start the simulation, I get an error message telling me that there are inputs expected on the line where…
Simon F.-Smith
  • 781
  • 3
  • 8
0
votes
2 answers

Is there a difference when using function block rather than functions in TwinCat?

I started making the structure for a new PLC program, but I was wondering when is convenient to use a funtion rather than a function block, if there's any benefit on using them in TwinCat.
Bryan Hdez
  • 23
  • 5
0
votes
1 answer

How to adjust the time in a trend object in Codesys?

I have a trend object which takes the time of the Raspberry Pi. In my project I take the time of the main board and now the time of the trend object, the date range selection and the time displayed on the screen are different. My question is how do…
SGKlee
  • 70
  • 6
0
votes
0 answers

How to map a .usercontrol to a REFERENCE TO a STRUCT within a FunctionBlock in Twincat 3

PLC: ST_StopStatus: PLC custom type containing 5 boolean variables. ReferenceBlock: PLC function block containing two variables: stStopStatus: ST_StopStatus refStopStatus: REFERENCE TO ST_StopStatus refStopStatus is set to reference…
nah_ny
  • 37
  • 1
  • 8
0
votes
1 answer

How do I programm a PC as a PLC that has registers that are readable via Modbus using Beckhoff Twin CAT 3 TCP Modbus?

I would like to use Beckhoff Twin CAT 3 TCP Modbus module to make registers in a PC which is running as a PLC readable via Modbus. I have downloaded the function Modbus TCP from the Backhoff website. I have followed the example in the Manual TF6250…
0
votes
2 answers

Create Timed For Loop Structured Text

Im trying to create a FOR TO loop that has a time delay. But it doesn't seem to work correctly I can't figure out where the error is, but it seems that the loop runs intirely and doesnt look to the time delay. FOR vCount := 0 TO 800…
ElectricRay81
  • 121
  • 11
0
votes
1 answer

Best approach to program a PLC using dbc file? (CAN communication)

This is probably not the right forum to ask this, but I need to program a Phoenix Contact PLC in Structured Text. The PLC should communicate with a motor that uses CANOpen protocol. The only resource I have is the dbc file. I'm kinda lost about…
0
votes
2 answers

Difficulty initialising an array of strings in structured text

Structured text seems to delight in making the simple really difficult (much more used to C). Could somebody please rearrange this so it will compile. VAR_GLOBAL ErrorStg : Array[0 .. 10] of STRING[16] := "Good","Bad","Fsked"; END_VAR
0
votes
1 answer

How to append values to an Array in Structured text in PLC software like twincat

I have to sorting algorithm to sort out recipes from one of my machines. Is there a way to push/append values into my array?
alljo
  • 1
  • 1
0
votes
1 answer

Count machine runtime in PLC

I am working on a simple machine project in PLC using structured text programming language. Now, I want to count the runtime (hours, mins and seconds) of a machine after Start Command is pressed. As I am new, I struggle to develop an idea. I tried…
0
votes
1 answer

Converting LREAL to binary and interpreting it as base 10 LINT

Running "CODESYS V3.5 SP16" here, I am trying to implement the hashcode algorithm mentioned in Best implementation for hashCode method for a collection and had to built my own solution to replicate Java's Float.floatToIntBits(f) which resulted in…
void
  • 7
  • 3
0
votes
1 answer

SM3_Basic.IAxisRef.GetAxisRefPointer not working as expected

Running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title? PROGRAM PLC_PRG VAR itfAxisRef : SM3_Basic.IAxisRef; pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3; END_VAR pAxisRefSm3 :=…
void
  • 7
  • 3
1 2 3
8 9