Questions tagged [codesys]

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.

240 questions
5
votes
5 answers

PLC Structured text, convert decimal to real(float). Not getting the value I expect. (IEEE-754)

I have a hardware that is communicating with the PLC over Profibus DP, that sends me 4 bytes of data in hex that is "44 79 FF FF" and in the PLC program I have declared a BYTE array for this input data. The problem is in the PLC the data I receive…
hijack
  • 263
  • 2
  • 3
  • 11
4
votes
4 answers

What is the benefit of defining enumerators as a DUT?

The main goal of defining enumerators is to assign a variable to some numbers and their equal strings as I understand. We can define var a as an enum everywhere in the initializing section of our Program or Function Block like…
asys
  • 667
  • 5
  • 20
4
votes
3 answers

How to assign an initialized array to an array of arrays in TwinCAT

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 :…
Roald
  • 2,459
  • 16
  • 43
4
votes
3 answers

How do I pass an array of an extended type in codesys/twincat3?

Say I have an abstract function block AValve that I extend for various types of valve. I extend that AValve in order to implement it as a BasicValve. Also I have a function block that takes an array of AValve, which looks like this FUNCTION_BLOCK…
Taeo
  • 55
  • 7
3
votes
3 answers

How can link BIT2 type to a variable?

In most input cards of Beckhoff, there are two variables, Limit 1 and limit 2. They have a BIT2 datatype, size of 0.2 bytes, which means they have two bits, as shown in the following figure for Limit 1: Bit0: Value smaller/equal Limit 1 Bit1: Value…
asys
  • 667
  • 5
  • 20
3
votes
1 answer

In TwinCAT, is there a way to get the real time (isolated) CPU usage from outside of the PLC code?

The CPU usage of non-RT cores is available in MDP (either over ADS or UA), but I'm unable to find any way to get the CPU usage of isolated cores from user land (i.e. Windows). I feel like there should be an easy way to read this since TcXaeShell is…
Jay
  • 33
  • 4
3
votes
1 answer

TwinCat How To Initialize Functionblock with Reference to Global Variable

Hello StackOverflow Community, i have another question regarding the TwinCat/Beckhoff/Codesys Programming Language, maybe someone is able to help me with this problem. Here is the Problem: I want to initalize a functionblock with a reference to some…
manuel2705
  • 45
  • 4
3
votes
2 answers

Instantiating of numerous function block in CODESYS (IEC61131)

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…
aghd
  • 685
  • 2
  • 9
  • 20
3
votes
3 answers

how to create pointer to function in codesys v3

Can you give me an example of how can I declare a pointer to function in my library? And how can I pass a pointer to function to my external library?
Ksouri Wissem
  • 49
  • 1
  • 5
3
votes
3 answers

Creat an array in CoDeSys with changeable size

I am working on a moving average algorithm to analyze a sensor values and the values are stored in an Array. BUT, the length of Array is variabla (depends on speed of one motor). how can I Creat an array in CoDeSys with changeable size. It's wrong…
user2791484
  • 51
  • 1
  • 2
  • 4
3
votes
2 answers

Defining Arrays in Codesys

I'm using Codesys to create an array. The example below is what I'm using to create an array for 5 values ARRAY [1..5] OF INT := [1,2,3,4,5]; That's fine for an array of 5 but if I needed an array for 100 values? Is there a quicker way of doing an…
darnbar
  • 33
  • 1
  • 1
  • 5
3
votes
5 answers

Pausing Timers In Structured Text

I need to be able to pause a timer and retain it's ET value when the timer is no longer being asked to run. The timer times when the input from a proximity switch is not present, but I only want it to time when the pump that forwards on the material…
LBPLC
  • 1,570
  • 3
  • 27
  • 51
3
votes
1 answer

How to assign icon/pic to custom function block in Codesys?

I am creating Codesys library for public with common FBs. I wonder is there a way to add icon to the function block just like timer blocks have? Logically if there is icon on those blocks there should be a way to add icon to other blocks.
Sergey Romanov
  • 2,949
  • 4
  • 23
  • 38
3
votes
5 answers

I need to concatenate several strings

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…
TheColonel26
  • 2,618
  • 7
  • 25
  • 50
3
votes
2 answers

Communicate with CoDeSys program on a Linux-based WAGO PFC200 PLC

I'm currently getting familiar with PLC's, the WAGO 750-8206 PLC in particular. It offers a linux OS and can run CoDeSys programs. There are some I/O modules attached to the controller: 750-530, 750-430 and 750-600. What I would like to know is…
Rob
  • 11,492
  • 14
  • 59
  • 94
1
2 3
15 16