I'm trying to add my own enum in MotionWorks.
After creation of new data type the only available types are ARRAY,STRING,STRUCT.
Writing the following code:
TYPE SimulationType:
(
Passing := 0,
Random := 1,
Failing := 2
) INT :=…
Does anybody know about a LLVM backend which outputs IL (instruction list, also known as AWL) according to IEC 61131-3?
Background: I have an algorithm written in C and want to run it on an industrial PLC, which unfortunatelly is not capable to…
I inherited a PLC program written in IEC 61131-3 structured text. I just noticed that it has a mixture of STRING variables, and a few STRING(15) variables. It suggests that IEC61131-3 declares its strings with a pre-defined length (does it?) and…
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…
I wonder if it is allowed by the standard (IEC 1131-3) to mix different data types in an expression.
Example
VAR A : BOOL;
B : INT;
(* ... *)
IF (B AND C) THEN
...
END_IF
In IEC 61131-3 implementations (e.g. CoDeSys, TwinCAT, Unity), what actually happens when you use the assignment operator on variables of Function Block type? I've looked at the TwinCAT and CoDeSys docs without finding any kind of clear description;…
I have the problem that the CONCAT(str1, str2) function does not take two wstrings and I have not found a concat function for wstring. So how should I do it?
I cannot convert the input to string and then back to wstring as I then loose information…
I am very new to PLC programming. Can anyone help with explaining how I can perform a SHR/SHL operation on an array of INT of lets say 10 elements using TwinCAT3. They way I thought I would do this is by moving the shift register one place so that…
Is it possible to write function blocks with some static parameterization? Specifically, can I make a buffer with a static capacity, but such that different instances can have different capacities?
Ideally, I'd imagine some constant parameters, like…
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…
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
…
This is how I have it now
TYPE MyType: STRUCT
name: STRING[20];
input: INT;
output: INT;
END_STRUCT
END_TYPE
PROGRAM PLC_PRG:
VAR
struct: MyType;
struct_NULL: MyType;
error: BOOL;
END_VAR
IF…
So I have a problem where in my SFC it jumps to an inital step but the commands written in the step would not register.
At the end of the SFC a step inputs 5 into A_Status(INT).
The very next transition checks if the value of A_Status is 5.
No…
I have a machine learning and advanced control application in Python (TensorFlow + Gekko) that I need to integrate with a Programmable Logic Controller (PLC) that provides the data acquisition and final element control. Can I use a rack-mounted…
Beckhoff's TwinCat-3, as well as Codesys 3 it's based on, adds references as an extension to IEC-61131-3 languages. I'm wondering what is the exact grammar and semantics of this non-standard addition (that's the problem with them: nobody bothers…