Real time clock with ladder logic and ComFilePi
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Real time clock with ladder logic and ComFilePi
    
    Last updated: 2021-02-25
    
    
      
        Operating systems, and Real Time applications
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Operating systems, and Real Time applications
    
    Last updated: 2005-10-07
    
    
      
        Cyclic written REAL gets shifted value on RPi MC
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Cyclic written REAL gets shifted value on RPi MC
    
    Last updated: 2022-10-27
    
    
      
        Visu - example from a real process
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Visu - example from a real process
    
    Last updated: 2009-03-04
    
    
      
        how do I save real values every houre
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      how do I save real values every houre
    
    Last updated: 2016-11-30
    
    
      
        Post by kishan on OSCAT Scale_r function not working in LD 4.60 works in LAD2 on 3.5.21sp3
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      here is formula for scale function you can impliment your own scale function Output=OutMin+(Input−InMin)×(InMax−InMin)(OutMax−OutMin) FUNCTION_BLOCK FB_Scale VAR_INPUT xIn : REAL; // Input value (e.g., raw sensor) xInMin : REAL; // Input range minimum xInMax : REAL; // Input range maximum xOutMin : REAL; // Output range minimum xOutMax : REAL; // Output range maximum END_VAR VAR_OUTPUT xOut : REAL; // Scaled output END_VAR VAR xGain : REAL; xOffset : REAL; END_VAR // Implementation xGain := (xOutMax - xOutMin) / (xInMax - xInMin); xOffset := xOutMin - xGain * xInMin; xOut := xGain * xIn + xOffset;
    
    Last updated: 5 days ago
    
    
      
        Post by abinvest579 on COP instruction
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hi All, I have hands on rockwell software like rslogix 5000 and studio 5000. Currently started working on codesys i want to know is there any COP instruction with similar functionality in codesys like rockwell. I want to use it to split REAL into 2 INT,DINT to 2 INT also reverse 2 INT into DINT and 2 INT into REAL. Thanks in advance
    
    Last updated: 2024-03-18
    
    
      
        Post by shabroz-gill on Data Sources Manager causing exception due to float or double type in OPC server
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Was this ever resolved? I see the same issue with the version 3.5.19.5
    
    Last updated: 2024-07-01
    
    
      
        Post by solidlogicguy on Little endian to Float from Modbus RTU
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hello, I got a device from which I require to read values from I am using a WAGO PLC 750-8212 and I am communicating through Modbus Master FUNCTION BLOCK from library WagoAppPLCModbus in Codesys 3.5 to this device. I already receive data from the device that is a CVM to monitor voltage from a fuel cell. The technical support of the company that makes these devices says that the data is sent in little endian form. And I want to convert it to a float value. The tech support sent me the next instructions of how to do it but I am new using codesys, so any advice or help I will really appreciate so much. Message from tech support: The process is complicated, better to do it with already implemented library in the language/program you use. Basically the process should be next: To convert the two Modbus registers containing parts of a 32-bit float in little-endian byte order to a floating-point number using mathematical operations, you first need to combine the two 16-bit integers (assuming reg1 is the lower word and reg2 is the higher word) and then interpret the result according to the IEEE 754 standard. Given: - Register 192 (reg1) = 4096 - Register 193 (reg2) = 14884 Step 1: Combine the two registers. Since we are dealing with little-endian byte order, reg2 is the high word, and reg1 is the low word: combined = reg2 * 2^16 + reg1 combined = 14884 * 65536 + 4096 combined = 975175680 + 4096 combined = 975179776 Step 2: Convert the combined value to binary: combined_binary = '1110101101011100000000000000000' Step 3: Split the binary into IEEE 754 components: Sign bit (1 bit): 0 Exponent (8 bits): 11101011 Mantissa (23 bits): 01011100000000000000000 Step 4: Convert the binary exponent to decimal and subtract the bias (127 for 32-bit floats): exponent = int('11101011', 2) - 127 exponent = 235 - 127 exponent = 108 Step 5: Calculate the mantissa as a fraction: The mantissa in IEEE 754 format is the fractional part after the leading 1 (which is implicit). Therefore, we need to convert the binary mantissa to decimal and add the implicit leading 1: mantissa_fractional = 1 + int('01011100000000000000000', 2) / 2^23 mantissa_fractional = 1 + 18688 / 8388608 mantissa_fractional = 1 + 0.002227783203125 mantissa_fractional ≈ 1.002227783203125 Step 6: Combine the sign, exponent, and mantissa to get the float value: float_value = (-1)^0 * mantissa_fractional * 2^exponent float_value = 1 * 1.002227783203125 * 2^108 Because the exponent is quite large, the resulting float value is a very large number.
    
    Last updated: 2023-12-15
    
    
      
        Post by rckalex on Changing Trace Variable at Runtime
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Is it possible to change the variable being traced during runtime? I would like to use the CURRENTCLIENTID in combination with an array of real numbers to alter the traced variable in a display window, without needing to create separate visualizations for each variable.
    
    Last updated: 2025-01-22
    
    
      
        Read real values in a .txt files with SysFileRead: possible?
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Read real values in a .txt files with SysFileRead: possible?
    
    Last updated: 2013-01-30
    
    
      
        Codesys Control RTE V3 - Network Adapter configuration for Ethercat real time bus
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Codesys Control RTE V3 - Network Adapter configuration for Ethercat real time bus
    
    Last updated: 2021-10-07
    
    
      
        Real wert soll zb. einen wert 7,3 anzeigen, zeigt aber nur 7
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Real wert soll zb. einen wert 7,3 anzeigen, zeigt aber nur 7
    
    Last updated: 2010-04-13
    
    
      
        Post by ruobian on Analog Input Delay Timer
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hello there, I am new here and in programming. I need help with the basics. I am trying to do what I mentioned in the title. I have an analog input. So I have a real or integer data type value. I want to delay it. TON and TOF only work with bool. I think there is a function block that has two inputs, 1 for real or int and 1 for bool. And if bool is true, it will give the output as real or int. I don't know but I need something like this. Actually, it is not exactly like that. In other words, it will not show the real value at the input at the output after a certain period of time. I want it to show the real value from 2 seconds ago continuously. The purpose of doing this is to compare the real value I received with the value from 2 seconds ago and find out whether it went up or down. I am using only FBD. Please help me with this. Thanks in advance.
    
    Last updated: 2024-08-20
    
    
      
        Post by sebastianrapi on Bibliothek: floatingpointutils
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      @Strucc.c: thanks very mutch. Yes, I think that was the problem. I tried yesterday a similar function, i have found: IEEE32 in REAL FUNCTION IEEE32_TO_REAL : REAL VAR_INPUT IN:DWORD; END_VAR VAR PTREAL:POINTER TO REAL; END_VAR PTREAL:=ADR(IN); IEEE32_TO_REAL:=PTREAL^; END_FUNCTION REAL in IEEE32 FUNCTION REAL_TO_IEEE32 : DWORD VAR_INPUT IN:REAL; END_VAR VAR PTDWORD:POINTER TO DWORD; END_VAR PTDWORD:=ADR(IN); REAL_TO_IEEE32:=PTDWORD^; END_FUNCTION http://www.oscat.de/community/index.php/topic,357.0.html And this works perfect. Now, the only thing that isn't clear is the libary "FloatingPointUtils, 3.5.17.0 (System)"... For me, the libary doesn't work. But the problem is now solved. Thanks a lot.
    
    Last updated: 2024-11-21
    
    
      
        Post by andrebrandt on BACnet dynamic create bacnet object
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hi. I want to create a FB with bacnet objects. FUNCTION_BLOCK PT1000 VAR_INPUT System: STRING; In: REAL; Name:STRING; END_VAR VAR_OUTPUT Out: REAL; Out_St: Struct_PT1000; END_VAR VAR {attribute 'instance-path'} {attribute 'noinit'} Tag: STRING; Instance:DINT; //AnalogInn : WagoSysBACnet.FbAnalogInput_large(1); This works. Objectname is AnalogInn. identifier is 1 END_VAR I want to name object based on FB PT1000. In FB P1000, I want to write eUnits, Name and so on. How can i do this???
    
    Last updated: 2025-01-15
    
    
      
        Post by ferrim on IEC 61499
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hello otdeveloper, I am very interested in this topic. I have been dedicated to IEC 61499 for some time and I would like to understand if the time has come to adopt it in the real world of automation or if it will continue to fill up research papers only.
    
    Last updated: 2024-02-09
    
    
      
        Post by calviniscoding on Publish a JSON payload via MQTT Publish (using IIot Libraries)
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Are you able to dynamically change the JSON message? As in, if wsValue or iValue is linked to some real telemetry that varies over time, will the JSON message reflect these changes? I am only able to send the values that I initialize the JSON message to
    
    Last updated: 2024-06-18
    
    
      
        Post by stribor on Passing properties as VAR_IN_OUT variables.
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      if i only use it as input variable I won't be able to update its state within the visu object. Lets say i have real value as a property, i would like the slider object to display this value and also modify it.
    
    Last updated: 2025-04-30
    
    
      
        Post by andrea199403 on Assigning Modbus addresses to a structure in a dynamic way
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hello everyone, I am new to this forum and I am also new to Codesys programming. My problem is this: I have a STRUCT of 64 bool and 30 real, this STRUCT is assigned in the programme 9 times. Now I need to communicate with an HMI via Modbus and I have defined the slave device and created the holding registers for communication. I would like to declare the first call of the STRUCT on the Modbus registers %QX2000.0 to %QX2007.7 for the booleans and on the registers %QW1004 to %QW1034 for the real registers. That said, I would like to change an index and set an offset of 100 bytes for the calls of the other 8 assignments, so that the result is: %QX2100.0 to %QX2107.7 for the booleans and on the %QW1104 to %QW1134 registers for the Real registers, etc. Is there a way to declare this? Thank you very much.
    
    Last updated: 2025-10-21
    
    
      
        Post by alexgooi on Codesys virtual control redundancy
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Dear Forum, I’m currently investigating the possibilities of Codesys virtual control (Linux). The research rig consists of a PC (Debian with real time kernel) with a docker server installed on it. The PC is communicating with a Remote I/O and I have to say the performance is great. The process in the container is running (soft) real time. Currently I’m checking if it is possible to replace physical controllers by remote I/O’s and run the Codesys applications on a docker server. If I’m going into this route the reliability of the server is very important (server down, complete installation down), is it possible to make the server redundant without needing 2 separate containers (including licenses), and maintaining the real time behavior? I’m not only expecting direct answers, if you have any idea or thought they are very welcome. Kind regards Alex
    
    Last updated: 2025-09-03
    
    
      
        Struggling to connect to EK1100 to Raspberry Pi
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Struggling to connect to EK1100 to Raspberry Pi
    
    Last updated: 2025-03-30
    
    
      
        How to use matlab to send parameters to codesys
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      How to use matlab to send parameters to codesys
    
    Last updated: 2018-10-10
    
    
      
        Post by john-robinson on Limiting Memory Access of an Array to Within its Bounds
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Recently we had an issue regarding some simple code to calculate a rolling average. The code indexes from zero to 199 to properly store the current input into a circular buffer which then allows us to calculate a rolling average: VAR input_5s : REAL; outs_arr : ARRAY[0..199] OF REAL; i : USINT := 0; END_VAR ___ //this code runs every five seconds, calculating a rolling average outs_arr[i] := input_5s; i := i + 1; output := OSCAT_BASIC.ARRAY_AVG(ADR(outs_arr), SIZEOF(outs_arr)); IF i >= SIZEOF(outs_arr) THEN i := 0; END_IF There is a simple bug in this code where the index will be set to 0 when it has surpassed the length of the array in bytes (800 in this case) rather than larger than the number of reals in the array (200). The solution here is simple, replacing i >= SIZEOF(outs_arr) with i >= SIZEOF(outs_arr)/SIZEOF(outs_arr[0]). In this example when the index increased to 201 and the line outs_arr[201] := input_5s was called, codesys arbitrarily wrote to the address in memory that is where outs_arr[201] would be if the array was that long. I would like to find a way to wrap the codesys array inside of a wrapper class that checks if an input is within the bounds of an array before writing to that value. I know how I would implement that for a specific array, I could create a method or class that takes an input of an array of variable length, ie. ARRAY[*] OF REAL, but I don't know how to make this for any data type. I am wondering if anyone has ever done anything similar to this, or has any better suggestions to ensure that none of the programmers on this application accidentally create code that can arbitrarily write to other locations in memory.
    
    Last updated: 2024-03-05
    
    
      
        Unable to connect to this device
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Unable to connect to this device
    
    Last updated: 2024-06-28
    
To search for an exact phrase, put it in quotes.  Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it.  Example: docs -help
To search on specific fields, use these field names instead of a general text search.  You can group with AND or OR.