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
0
votes
4 answers
Array as Type for Interface Property CoDeSys
I am attempting to implement the Observer design pattern in CoDeSys using structured text. I'm encountering an error where I can't call the ., [], nor [..] on an interface property. Is it possible to have an interface property that is an array? The…

Michael LeVan
- 528
- 2
- 8
- 21
0
votes
1 answer
Exporting Array to CSV in CODESYS
I am taking over a project with code from another person. I have a PLC that currently has inputs in from pressure sensors and thermocouples. It then scales that data to PSI and temperature in fahrenheit. The way the data is set up from each of those…

lt123
- 117
- 1
- 2
- 8
0
votes
1 answer
Throw Exceptions in CODESYS
How can I throw standard system exceptions (and if possible, create custom exceptions and throw them too).
The simplest thing that comes to mind, is to just divide a variable by zero, but that's just a hack at best.
I did find mentions of a function…

Guiorgy
- 1,405
- 9
- 26
0
votes
1 answer
Initialize a Function Block using __NEW that has explicitly defined the FB_init method
Suppose I have a function block (A) that has defined the FB_init method, for example:
{attribute 'enable_dynamic_creation'}
FUNCTION_BLOCK A
METHOD FB_init : BOOL
VAR_INPUT
bInitRetains : BOOL;
bInCopyCode : BOOL;
parameter:…

Guiorgy
- 1,405
- 9
- 26
0
votes
2 answers
How should I handle Codesys SYS_TIME overflow after only 49 days?
The SYS_TIME function in ABB PLC / codesys programming returns a DWORD indicating the number of milliseconds since the PLC was turned on. (or perhaps hard reset / other event? Cannot find documentation of this.)
The max size of a DWORD in Codesys…

Philip Jones
- 3
- 2
0
votes
2 answers
Codesys add elements to a derived struct
Is it possible to add elements to an instance of struct.
TYPE StructBase:
STRUCT
Start : INT;
Complete : INT;
END_STRUCT
END_TYPE
StructDerived : StructBase;
StructDerived.StateInit : INT;
StructDerived.StateMoveFwd : INT;
The elements of…

Wouter
- 29
- 2
0
votes
0 answers
Why am I getting an accumulator extension warning after all of my math?
I am writing a program that checks the temperature of the materials required to mix concrete. It then will execute a formula to determine what the water temperature needs to be to reach the desired concrete temperature. I have all of the correct…

Jackson148
- 115
- 1
- 2
- 9
0
votes
1 answer
What package contains the CAA_File library?
And where do I obtain the package from? I would imagine it comes from some package on the CoDeSys store but I can't seem to find which one.
Thanks,

Michael LeVan
- 528
- 2
- 8
- 21
0
votes
3 answers
CODESYS problems with edge detection (bounce)
I have a problem with my CODESYS program. I have three buttons, which are defined as input. For each button a number is stored. For example the number 1.
I have now created a program, which recognizes an edge on the button and stores the numerical…

lorex04
- 15
- 1
- 4
0
votes
1 answer
Execute Linux System Command from CoDeSys Runtime
I am attempting to resolve a bug where the memory on my PLC is not synced on an operating system level. When power is cycled to the PLC a file I have "on disk" doesn't save when the PLC boots up again. I have found that running the linux sync…

Michael LeVan
- 528
- 2
- 8
- 21
0
votes
2 answers
How to get ASCII code of char in Codesys?
I need to get a byte code of char in Codesys (using ST language). Is there a way to do it?
For example, in c++ it is quiet straightforward:
int c = 'h';

Perotto
- 194
- 1
- 14
0
votes
1 answer
Add Libraries from Backed Up Managed Libraries Folder in CoDeSys
Recently I had a computer failure that resulted in reinstalling the windows operating system. Fortunately, I was able to back up my machine before doing the reinstall. However, I am now trying to make my CoDeSys project compile but I can't seem to…

Michael LeVan
- 528
- 2
- 8
- 21
0
votes
0 answers
Is there a way to get RTC clock with nano-second precision in "CODESYS Control for Linux SL"
I have CODESYS Development SW version "3.5 SP15 patch 1" running on Windows PC and "CODESYS Control for Linux SL" Soft PLC version 3.5.15.10 running on Ubuntu 16.04.6 LTS in demo mode.
For my learning task I need to get the current RTC time with…
0
votes
1 answer
Make Sub-array in Array in Codesys?
I am trying to manipulate a sub-array of an existing array. Can Codesys do this? I guess this is more of a syntax question.
In Python, there is slice() is there a Codesys equivalent?
Here's some pseudocode of what I am trying to do
VAR
Array1:…

jibicax
- 25
- 5
0
votes
1 answer
Split the date and time from string in codesys v 3
i 'm working on codesys . I have a string which has the DATE AND TIME .I want to split the date and time .
currentTime: DATE_AND_TIME;
showing value like this
DT#2019-08-06-10:06:53
after concat Convert the currentTime…

M Taqi Haider
- 13
- 2