CODESYS is an IDE for application development on programmable logic controllers (PLCs) distributed by the CODESYS Group in Germany. Use this tag only for questions about CODESYS installation and usage as well as related CODESYS software like CODESYS Control Runtime System and CODESYS Automation Server. Use the tags [structured-text], [ladder-logic], and [sfc], for (ide-agnostic) questions about [plc] or [servo] programming.
Questions tagged [codesys]
240 questions
3
votes
3 answers
How to place an instance of a custom Function Block in CoDeSys?
I'm learning CoDeSys (using V3.5 SP2) and I'm stuck with a rather beginner-level problem that I can't seem to find any resources for.
I have defined a simple Function Block (by going to Add Object -> POU -> Function Block and using the FBD…

Theodoros Chatzigiannakis
- 28,773
- 8
- 68
- 104
2
votes
1 answer
Pointers and online change in TwinCAT and CoDeSys
Are pointers safe against online change of running PLC program in TwinCAT 2.10 and in CoDeSys 2.3 on which the first one is based? What happens if memory block gets reallocated as part of online program change and there are pointers pointing to that…

Taras Boyko
- 81
- 1
- 9
2
votes
1 answer
Unexpected Functionality in Codesys REAL_TO_STRING
On an IFM CR1203:
For most 3-decimal REAL values, REAL_TO_STRING outputs the expected value.
For others, it outputs the expected value with '0001' at the end.
Why is this happening, and what is a good workaround?

Tyler Braun
- 75
- 9
2
votes
0 answers
How does IO-Link handle compatibility between different sensor brands and models
I am starting to study the application of IO-Link Sensors in a machine, in this case I will apply several types, such as inductive, optical, flow and pressure, this technology will help me to standardize the types of connections... but well...
Once…

dwpessoa
- 440
- 4
- 15
2
votes
2 answers
R_TRIG, F_TRIG and TOF not working correctly
I have VARs declared
trigger_pos_sensor_left : BOOL;
trigger_ticks : INT := 0;
trigger_sensor_rtrig : R_TRIG;
trigger_sensor_ftrig : F_TRIG;
delay_timer …

user3742046
- 171
- 12
2
votes
2 answers
Callbacks using methods in CODESYS v3
** TLDR; Is it possible to create pointers to methods, store them and then call them? **
This question is related to this question: how to create pointer to function in codesys v3, but my question is about methods, and, since the referenced question…

Cédric Moers
- 395
- 1
- 10
2
votes
1 answer
REAL / LREAL to String with Scientific Notation Structured Text
I am looking for a way to convert a floating-point value to scientific notaiton string in Beckhoff TwinCAT or codesys. The documentation for their FB_FormatString says this is not currently supported. Does anyone have a "goto" approach for this?

Mark Lazarides
- 366
- 2
- 13
2
votes
1 answer
How to determine the type of a pointer indexed member
How to determine the type of a pointer indexed member.
I intend to use:
TYPE DUT_DemoStruct :
STRUCT
Member_1: BOOL;
Member_2: INT;
END_STRUCT
END_TYPE
PROGRAM Prg_Main
VAR
DemoStructPointer:
Obj_DemoStruct1:…

Alex Samrt
- 21
- 2
2
votes
2 answers
TwinCAT Pointer to Pointer of undefined type?
I'm trying to build a function that sums a single dimension array of any type in TwinCAT.
I'm relatively inexperienced with pointers so the answer may be obvious, but I could not find any solutions. I read through all these and they helped a…

Gene Parmesan
- 211
- 2
- 8
2
votes
0 answers
Accessing OPC UA ExtensionObject (Struct, Dict and Array) in Codesys
I'm using a Python OPC UA-server (asyncua) to provide data to a CODESYS (V3.5.17.10) program. In CODESYS I'm able to add 'Data Source Manager' and then a 'Data Source' which is the Python OPC UA-server. Now CODESYS connects as client to the server,…

Nando
- 31
- 1
2
votes
0 answers
Codesys 3 : Return variable address and size from string containing symbol name of said variable?
I want to take a string that contains the symbol name of a variable and somehow get the address and size of the variable with that symbol name.
MyDINT:= 5;
MySymbolName:= `MyDINT`;
VariableInfo:=…

CapinWinky
- 748
- 7
- 8
2
votes
3 answers
How can define enumerator in Methods?
There is a problem when u define an enum in a method.
I was trying to do this:
VAR
enumA:(A,B,C);
END_VAR
and there is the compiler reaction when I used this in TwinCAT3 Shell (TcXaeShell).
any help would be appreciated.

asys
- 667
- 5
- 20
2
votes
1 answer
OPCua Subscribe to specific item / index of array
I have a OPCua server that consists of an array[1000] of objects (4 x reals, 2 x int, 2 x Enumerators).
I am trying to subscribe to
Object[104].real2
I can subscribe currently to object and receive all 1000 objects every time there is an update.
But…

Canadian Wire
- 21
- 1
2
votes
3 answers
TwinCat3 how to efficiently setup the EventLogger in an OOP?
I'm still very new to OOP and TwinCat so please bear with me. I'm currently developing the software for a small machine that will be used combined with the TF2000 HMI. Because the Event Grid takes away a lot of work I want to set up the TC3…

faultvault
- 23
- 3
2
votes
1 answer
Trying to get Codesys to run a batch file from the HMI
So currently, I am trying to pick up this code that an intern left off for this project. I have a batch file that is run when clicked, and will execute a powershell script that will convert a generated CSV file from collected data to an Excel file.…

QueenLexi13
- 33
- 4