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
0
votes
0 answers

How can I know if dhcp is enabled for ETH1 at runtime

I'm logged to an Eaton XC-303 PLC, via codesys 3.5. I can run a plc shell command isdhcpenabled 1, and get ETH1: DHCP disabled. I would like to do it at runtime via the iec code. So, is there a way to execute plc shell command via iec code? The…
coolWater
  • 1
  • 1
0
votes
0 answers

Codesys Structured Language, how to get current visu block X,Y position?

I am learning how to use Codesys visualisation blocks. I can't find any information on how to get block X, Y positions. For example I want to assign current X and Y position values to var_x, and var_y after a button click, but I do not know how to…
0
votes
1 answer

Does anyone have an example of how to use IQueue in codesys?

I'm trying to get the median value of an array in codesys, however the array is fifo, so as a new value is added to the array the first value is deleted and the median is rechecked. The array is always going to be odd in size and I think IQueue will…
0
votes
1 answer

Manipulation of Excel files in TwinCAT

Is there an available library for reading/writing of Excel files, particularly XLSX or XLSM for TwinCAT 3? How about TDMS files? Obviously I'd prefer something open source and free, if available. Thank you
busarider29
  • 185
  • 5
  • 18
0
votes
2 answers

Convert Hex bytes to an ASCII string (Codesys)?

I have 4 bytes: Byte_0=0x31 Byte_1=0x32 Byte_2=0x33 Byte_3=0x34 And I would like to get a word_1=0x1234, where 1 is the conversion from hex to ASCII. Any ideas about how to get this?
Soul1986
  • 3
  • 3
0
votes
2 answers

Function block not updating variable

Alright, so I'm learning codesys in school and I'm using Function-Blocks. However they didn't seem to update when updating local variables, so I made a test, the one you can see below. As you can see, in the FB below, "GVL.sw1" becomes True, but "a"…
Axroxx
  • 53
  • 4
0
votes
2 answers

Linear Interpolation in TwinCAT

I'm trying to use FB_CTRL_LIN_INTERPOLATION, which exists in Controller Toolbox in TwinCAT3 as described in this link. Unfortunately, the examples on the Infosys site are not practical; for example, there is no data type FLOAT on twincat3 at all; it…
asys
  • 667
  • 5
  • 20
0
votes
1 answer

Codesys opc ua connection

I wanted to read and write data in codesys with the help of codesys opc ua and ua expert client. I wanted to generate certificate for the opc ua server and i went through the instructions present in…
0
votes
1 answer

FB with FB_Init cannot be a return type

Codesys 3.5.16.70 There appears to be no way to return a type of function block if the function block has an FB_Init method. Please see the image below for a simple contrived example. I can return a reference to the function block but I would like…
0
votes
1 answer

Array multiplication in codesys

I wanted to multiply 2 matrices in codesys. I have implemented the code in the structured text language. However I am not able to generate the results correctly. Below is the logic which i am trying to implement. Initialisation in codesys: …
0
votes
0 answers

CODESYS safety programming: SIL2 package and PLCopen specification

I ask here a question about the PLCopen specification over Codesys SIL2 package. I've already asked this on Codesys Forge Fourm, without reply. It seems that on that forum no-one reply to safety questions. Reading the Codesys SIL2 user manual I…
Francesco
  • 1
  • 2
0
votes
1 answer

CoDeSys - Unable to write to internal variable

I'm currently working on a demo project from LinMot. The problem I ran into is that I'm unable to write the values I get of the fieldbus to the variables I have to work with. As you can see in the image I'm able to grab the correct values of the…
flyingchris
  • 316
  • 4
  • 10
0
votes
1 answer

How to adjust the time in a trend object in Codesys?

I have a trend object which takes the time of the Raspberry Pi. In my project I take the time of the main board and now the time of the trend object, the date range selection and the time displayed on the screen are different. My question is how do…
SGKlee
  • 70
  • 6
0
votes
1 answer

C0222 error when opening project (then goes away)

I have many methods the return value of which is a REFERENCE TO in my libraries. When I open the library, I see a C0222 error in the message window for each of these. If I compile the library, the message goes away. The code compiles and works under…
Fred
  • 6,590
  • 9
  • 20
0
votes
1 answer

Connecting to target device in codesys

I want to connect my PLC with Codesys. When i scan for the network in communication settings, the gateway is green but it does not find any device. When I connect the same PLC with my laptop it works but when i try to connect with the monitor near…