Search talk: cds data type array

 
<< < 1 .. 9 10 11 12 13 .. 51 > >> (Page 11 of 51)

Post by e13740e on Parameterized Property syntax for array element processing CODESYS Forge talk (Post)
Since parameterized (indexed) properties are not possible, I decided to use architectural approach "Indexing Property Adapter" to achieve the intended goal β€” avoiding code duplication for validated access to array elements. Essence: Create a Function Block Adapter (FB_PropertyAdapter) that encapsulates the logic for working with a single element of the target array (e.g., with one settings structure). Declare Properties inside the adapter block for accessing each individual field of the data structure. All validation logic is implemented within the Set accessors of these properties. Data Binding via VAR_IN_OUT: The adapter block receives a reference to a specific data element from the global array through its VAR_IN_OUT section, which ensures direct work with the original data without copying. Create an Array of Adapters: In the parent POU (e.g., FB_SettingsManager), an array of these adapter blocks is created β€” one for each element of the global array that needs to be managed. Initialize Bindings: In a FOR loop, each adapter instance from the array is given a reference to the corresponding data element. Result: This approach allows accessing the data via the index of the adapter array, and then through the property name, which simulates the behavior of an indexed property: MyAdapterArray[Index].MyProperty Thus, the validation and data access logic is written only once inside the adapter block and is then reused multiple times by creating instances of it in an array. This completely solves the problem of code duplication while providing a clean, scalable, and object-oriented architecture compatible with standard CODESYS features. Question closed.
Last updated: 2025-10-19

Post by dkugler on Reading a negative number CODESYS Forge talk (Post)
why not simply converting data type UINT to INT? Then avoid negative values with ... := MAX(0 , intTest); Good luck!
Last updated: 2025-05-28

Post by hazarath on How extract JSONElement containing Array data CODESYS Forge talk (Post)
I want to extract each element of an Array. Can someone help me with this. When I use JSONElementToString (part of JSON Utilities SL), I am seeing output as "ARRAY" instead of actual data. Here is the JSON content that I want to read : { "value1Unit": { "units": "M" }, "data": { "stepSize": 300.23, "points": [6,8] } } I would like to read each item of the element "points" i.e. 6 and 8. Here is the code I used, // Reading the content as JSON reader ( xExecute := execute , pwData := ADR ( converted_value ), jsonData := jsonDataStorage ); // Get the JSON Element jsonDataStorage.FindFirstValueByKey( wsKey := fidKeyVar, diStartIndex := searchElem, jsonElement => jsonElement ); JSON.JSONElementToString ( element := jsonElement , wsResult := valueWstring ); The content of the output of valueWstring is shown as "ARRAY" instead of the array items i.e. 6 and 8 Please can someone help me.
Last updated: 2024-07-30

Post by vladimirsmall on Send data to USB CODESYS Forge talk (Post)
Hello/ Need send some file ( for example Array of string) to USB. Which library need used for this. Thank you
Last updated: 2024-07-20

Post by alessandro on SysMemCmp SysMemCpy CODESYS Forge talk (Post)
VAR Data1:ARRAY[1..10] OF SINT ; Data2:ARRAY[1..10] OF SINT ; Data3:ARRAY[1..10] OF SINT ; Data4:ARRAY[1..10] OF SINT ; ex_1 : BOOL ; ex_2 : BOOL ; enable : BOOL :=0 ; END_VAR // PROGRAM // The scope of this example is compare and copy the values of two ARRAY only if some value is different using SysMemCmp and SysMemCpy. // In this 2 example we don't use a FOR cicle for do this, and pBuffer1 and pBuffer2 is just a pointer to ARRAY. See details in Library util.SysMem of Codesys // The compare funcion util.SysMem.SysMemCmp is bidirectional if Data1 chanege respect Data2 ex_1 go to 1 and if Data2 change respect Data1 also // but the copy function util.SysMem.SysMemCpy work only from source ARRAY pSrc:=ADR(Data1) to destination ARRAY pDest:=ADR(Data2) // Example 1 Full ARRAY compare and copy // This compare 2 different equal ARRAY and if there is some difference ex_1 go to 1 and if you give enable he copy Data1 in Data2 ex_1 := TO_BOOL(util.SysMem.SysMemCmp(pBuffer1:=ADR(Data1), pBuffer2:=ADR(Data2), udiCount:=SIZEOF(Data1))); IF ex_1 AND enable THEN util.SysMem.SysMemCpy(pDest:=ADR(Data2), pSrc:=ADR(Data1), udiCount:=SIZEOF(Data1)); END_IF // Example 2 Only selected area of the ARRAY compare and copy // This compare 2 different equal ARRAY starting from position number [3] for 4 byte in this case start at position [3] and finish at position number [6] // and if there is some difference only in area [3..6] of the ARRAY ex_2 go to 1 if you give enalbe he copy Data3[3..6] in Data4[3..6] // if something change in other array position[0..2] or [7..10] are ingnored ex_2 := TO_BOOL(util.SysMem.SysMemCmp(pBuffer1:=ADR(Data3[3]), pBuffer2:=ADR(Data4[3]), udiCount:=4)); IF ex_2 AND enable THEN util.SysMem.SysMemCpy(pDest:=ADR(Data4[3]), pSrc:=ADR(Data3[3]), udiCount:=4); END_IF // Attention udiCount input is intended in <byte> in the example 1 I pass to udiCount:=SIZEOF(Data1) for compare and copy the intere ARRAY and // SIZEOF pass the size of intere ARRAY in byte to the function input, in this 2 examples I used variable type SINT each one occupie 1 byte and one position in the ARRAY // and in the example 2 I pass udiCount:=4 for compare and copy only 4 position of Data3/4[3..6] if you want to extend this example and use it for an ARRAY OF WORD // remember that each WORD will occupe 2 byte (16 bit) and you will have to pass udiCount:=SIZEOF(Data1) if you need to compare intere ARRAY example 1 // but need udiCount:=(42) for the example 2 because need to compare and copy 4 word each occupie 2 byte (16 bit). // For REAL (32 bit) need udiCount:=SIZEOF(44) for LREAL or (64 bit) need udiCount:=SIZEOF(416) // a good rule is calculate the dimension of the ARRAY in byte without empty space at the end, multiple of data type number for variable bigger then 8 bit // Example : If you want to create an ARRAY for 5 REAL (32 bit) each occupie 4 byte the correct size is ARRAY[0..19] OF REAL 54=20 position. // NOTE : In the example the position of compare function util.SysMem.SysMemCmp is first and the copy function util.SysMem.SysMemCpy inside the IF is after // in one cycle of the program the two array is compared and if there is some difference and enable are copied. // If you move util.SysMem.SysMemCmp after the IF cycle he will copare the ARRAY in the current cycle but the copy of the value will do in the next cycle.</byte>
Last updated: 2025-10-24

Data consistency between tasks CODESYS Forge talk (Thread)
Data consistency between tasks
Last updated: 2013-12-27

General Data Transmission CODESYS Forge talk (Thread)
General Data Transmission
Last updated: 2012-08-05

Retentive data CODESYS Forge talk (Thread)
Retentive data
Last updated: 2019-11-08

Data Conversion CODESYS Forge talk (Thread)
Data Conversion
Last updated: 2012-08-20

Send data to USB CODESYS Forge talk (Thread)
Send data to USB
Last updated: 2024-08-05

Data Source Error 418 CODESYS Forge talk (Thread)
Data Source Error 418
Last updated: 2024-10-11

update data/tim CODESYS Forge talk (Thread)
update data/tim
Last updated: 2025-08-25

update data/tim CODESYS Forge talk (Thread)
update data/tim
Last updated: 2025-08-26

Trend data format CODESYS Forge talk (Thread)
Trend data format
Last updated: 2011-11-01

Data conversion CODESYS Forge talk (Thread)
Data conversion
Last updated: 2020-11-19

Saving application data CODESYS Forge talk (Thread)
Saving application data
Last updated: 2017-09-01

Saving data in powerfail CODESYS Forge talk (Thread)
Saving data in powerfail
Last updated: 2021-11-10

RFID data filtering CODESYS Forge talk (Thread)
RFID data filtering
Last updated: 2015-08-03

Test Manager Data Passing CODESYS Forge talk (Thread)
Test Manager Data Passing
Last updated: 2013-10-30

codesys3 data logger CODESYS Forge talk (Thread)
codesys3 data logger
Last updated: 2023-02-01

String Data Logger CODESYS Forge talk (Thread)
String Data Logger
Last updated: 2021-12-14

Sending data to InfluxDB CODESYS Forge talk (Thread)
Sending data to InfluxDB
Last updated: 2022-01-18

Logging data to SD CODESYS Forge talk (Thread)
Logging data to SD
Last updated: 2021-10-28

Data saving from Codesys? CODESYS Forge talk (Thread)
Data saving from Codesys?
Last updated: 2015-05-18

WORD DATA CODESYS Forge talk (Thread)
WORD DATA
Last updated: 2020-08-27

<< < 1 .. 9 10 11 12 13 .. 51 > >> (Page 11 of 51)

Showing results of 1254

Sort by relevance or date