Post by corriibme on Setting array values with JSON Utilities SL
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      I have been trying to set an array value to a JSON structure of this form: {"key": [1,2,3,4]} While I have been able to create the key and set its value to an empty array, I've not had any luck in putting any value in that array. objindex:= fb_JBuilder.SetKeyWithArray("Key6", diParentIndex := diRootIndex); objindex2:= fb_JBuilder.SetValue(value:= iValue2, diParentIndex:= objindex); iValue2: ARRAY[0..3] OF INT:= [1,2,3,4]; The two lines of code above produce {"key6": []} . The second line essentially has no effect.
    
    Last updated: 2024-05-12
    
    
      
        IO Mapping Analog Inputs with real values
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      IO Mapping Analog Inputs with real values
    
    Last updated: 2023-06-23
    
    
      
        Read Modbus Variable as float(Real) in codesys
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Read Modbus Variable as float(Real) in codesys
    
    Last updated: 2018-06-22
    
    
      
        Am I crazy? A-B [REAL] give wrong result?
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Am I crazy? A-B [REAL] give wrong result?
    
    Last updated: 2017-09-28
    
    
      
        Formatting real data type into strings (not visualization)
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Formatting real data type into strings (not visualization)
    
    Last updated: 2011-06-21
    
    
      
        Conversion of analogue input into Real measurement value
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Conversion of analogue input into Real measurement value
    
    Last updated: 2011-04-18
    
    
      
        Real time codesys runtime on raspberry pi
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Real time codesys runtime on raspberry pi
    
    Last updated: 2021-09-12
    
    
      
        Problem with Real type in CoDeSys 2.3
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Problem with Real type in CoDeSys 2.3
    
    Last updated: 2010-06-25
    
    
      
        Real- Wert zu 2 unterschiedlichen Zeitpunkten speichern
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Real- Wert zu 2 unterschiedlichen Zeitpunkten speichern
    
    Last updated: 2023-06-30
    
    
      
        Fehler 4010: "Kann REAL nicht in DWORD konvertieren" ??????
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      Fehler 4010: "Kann REAL nicht in DWORD konvertieren" ??????
    
    Last updated: 2012-03-01
    
    
      
        darfs ein bischen mehr sein bei REAL ?
    
    
       CODESYS Forge
    
    
      talk
    
    (Thread)
    
    
      darfs ein bischen mehr sein bei REAL ?
    
    Last updated: 2006-12-22
    
    
      
        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: 2025-10-26
    
    
      
        Post by mmpl on Array of UDT Compare
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hi I am trying to compare value of Array. I am getting an error. I attached picture. Please help.
    
    Last updated: 2024-04-08
    
    
      
        Post by tvm on Cannot pass array of constant size to a function as a reference
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      It will be a reference, because it's a VAR_IN_OUT. it's a little weird debugging the array online. It just shows as a POINTER TO INT, and you can't actually see the array from the function side. But you can still work with it as a normal array, not a pointer.
    
    Last updated: 2024-01-09
    
    
      
        Post by rickj on Defining local variables that can be independent with several users.
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      You need to create an array with one element for each possible user. I usually define these arrays in the root screen. FrameIndex : Array [0..MaxUsers] OF INT; Then use the global CurrentClientId (defined by one of the VISU libraries) to index the array element used to select the frame. FrameIndex[CurrentClientId]
    
    Last updated: 2023-10-21
    
    
      
        Post by mmpl on Array to String
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      I would like to create one large JSON string from an array of objects, where each object contains a value. My current approach involves using a for loop and string concatenation, but with 20,000 elements in the array, this method takes almost 7 seconds and negatively affects the PLC scan time. Is there a more efficient way to accomplish this?
    
    Last updated: 2024-07-18
    
    
      
        Post by mmpl on Array to String
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      I would like to create one large JSON string from an array of objects, where each object contains a value. My current approach involves using a for loop and string concatenation, but with 20,000 elements in the array, this method takes almost 7 seconds and negatively affects the PLC scan time. Is there a more efficient way to accomplish this?
    
    Last updated: 2024-07-18
    
    
      
        Post by janber on REFERENCE TO in an array
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Hi all, in the online help it written, that array of reference to data type is not possible. Ok... but if I create array of struct of reference to - everything works fine - please see the screenshots: and it works this way OK. Is it intention or error in compiler 3.5.18.20 and we should avoid it? Thanks a lot, Jan.
    
    Last updated: 2024-10-14
    
    
      
        Post by ph0010421 on How to manage variable types larger than 64 bits - Ethernet/IP
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      So it's currently mapped to an array of BYTES? Can you create a UNION? TYPE sBytesString : UNION AsBytes: ARRAY[0..127] OF BYTE; AsString: STRING(128); END_UNION END_TYPE Map it to the bytes, read it in the STRING!
    
    Last updated: 2024-09-23
    
    
      
        Post by timvh on displaying all incoming CAN bus messages
    
    
       CODESYS Forge
    
    
      talk
    
    (Post)
    
    
      Create a (global) array of Messages: aMessage : ARRAY[0..NR_OF_MESSAGES-1] OF CAN.RxMESSAGE; Then add each received message to the array. IF UserVarGlobal.g_countMsg_RPMset < NR_OF_MESSAGES THEN aMessage[UserVarGlobal.g_countMsg_RPMset] := Message; UserVarGlobal.g_countMsg_RPMset := UserVarGlobal.g_countMsg_RPMset + 1; END_IF
    
    Last updated: 2024-07-22
    
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.