I have a requirement for porting some existing C code to a IEC 61131-3 compliant PLC.
I have some options of splitting the code into discrete function blocks and weaving those blocks into a standard solution (Ladder, FB, Structured Text etc). But…
I'm trying to assign two initialized arrays evenNumbers and oddNumbers to an array of arrays integers:
PROGRAM ArrayInit
VAR
evenNumbers : ARRAY[1..3] OF INT := [2, 4, 6];
oddNumbers: ARRAY[1..3] OF INT := [1, 3, 5];
integers :…
I am trying to create a simple Hello World Modbus TCP/IP program using Twincat3 and virtual PLC (PLC running locally on my computer).
I have set up a LabVIEW Modbus TCP/IP master + slave program (both of which are working see screenshots below).
I…
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?
One of the features of the method based on the definition of Beckoff site is that:
All data of a method are temporary and are only valid while the method
is executed (stack variables). This means that TwinCAT re-initializes
all variables and…
I have made a function block using CODESYS to perform energy metering. The inputs of the function block is current and voltage and the output is energy.
Now, we need to have 1000 instances of this function block to run the code for 1000 meter we…
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…
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…
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?
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…
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…
How can it be determined that the time interval of the nth event of an event is not more than a certain period of time?
For example, an event can occur up to 5 times every 10 minutes.
In STL we can use this
VAR
counter:CTU;
timer:TON;
…
I'm trying to find information on how to program an embedded mobile controller such as the ifm R 360. Where could I find specific information on the programming language used, the required development environment and any other useful…
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…