Search talk: cds data type array

 
<< < 1 .. 11 12 13 14 15 .. 53 > >> (Page 13 of 53)

Data Source Error 418 CODESYS Forge talk (Thread)
Data Source Error 418
Last updated: 2025-11-15

wEBCLIENT Post data api CODESYS Forge talk (Thread)
wEBCLIENT Post data api
Last updated: 2025-12-25

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

Error 'Library not found' and 'Unkown type' CODESYS Forge talk (Thread)
Error 'Library not found' and 'Unkown type'
Last updated: 2024-10-10

The default ramp type selection in SoftMotion V4.18.0.0 is Quadratic CODESYS Forge talk (Thread)
The default ramp type selection in SoftMotion V4.18.0.0 is Quadratic
Last updated: 2025-10-02

Exception when controlling a Task with type Status CODESYS Forge talk (Thread)
Exception when controlling a Task with type Status
Last updated: 2015-10-15

String type object length in CANopen OD? CODESYS Forge talk (Thread)
String type object length in CANopen OD?
Last updated: 2010-01-09

Using ENUM type variables in a recipe CODESYS Forge talk (Thread)
Using ENUM type variables in a recipe
Last updated: 2015-09-16

Exception when controlling a Task with type Status CODESYS Forge talk (Thread)
Exception when controlling a Task with type Status
Last updated: 2015-10-15

Declare and dereference pointer of unknown type CODESYS Forge talk (Thread)
Declare and dereference pointer of unknown type
Last updated: 2016-10-12

How to determine the type of a pointer indexed member CODESYS Forge talk (Thread)
How to determine the type of a pointer indexed member
Last updated: 2022-06-02

ANY type when integer has a subrange CODESYS Forge talk (Thread)
ANY type when integer has a subrange
Last updated: 2022-02-24

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

What about Vendor ID and device type when developing drivers CODESYS Forge talk (Thread)
What about Vendor ID and device type when developing drivers
Last updated: 2013-12-17

PERSISTENT RETAIN variable type & Declaration in table f CODESYS Forge talk (Thread)
PERSISTENT RETAIN variable type & Declaration in table f
Last updated: 2009-05-05

Is there any Key/Value list or dictionary type available? CODESYS Forge talk (Thread)
Is there any Key/Value list or dictionary type available?
Last updated: 2014-03-24

R/W retain variables in external i2c EEPROM type 24xxx CODESYS Forge talk (Thread)
R/W retain variables in external i2c EEPROM type 24xxx
Last updated: 2016-04-01

type conversion from ANY_NUM to REAL don't work CODESYS Forge talk (Thread)
type conversion from ANY_NUM to REAL don't work
Last updated: 2020-04-14

Is there a 'deepcopy' type function in Codesys STL? CODESYS Forge talk (Thread)
Is there a 'deepcopy' type function in Codesys STL?
Last updated: 2022-10-06

HMI access to REFERENCE type variables CODESYS Forge talk (Thread)
HMI access to REFERENCE type variables
Last updated: 2020-12-19

Modbus RTU using the Trigger type Application CODESYS Forge talk (Thread)
Modbus RTU using the Trigger type Application
Last updated: 2023-03-02

How to use CharBufferString type from StringUtils.lib? CODESYS Forge talk (Thread)
How to use CharBufferString type from StringUtils.lib?
Last updated: 2017-07-17

Symbol Configuration / Datasource enum type on HMI CODESYS Forge talk (Thread)
Symbol Configuration / Datasource enum type on HMI
Last updated: 2019-09-18

Property that returns REFERENCE TO Interface type? CODESYS Forge talk (Thread)
Property that returns REFERENCE TO Interface type?
Last updated: 2021-11-23

C0032 Error to type Pointer to IoConfigParameter CODESYS Forge talk (Thread)
C0032 Error to type Pointer to IoConfigParameter
Last updated: 2024-03-25

<< < 1 .. 11 12 13 14 15 .. 53 > >> (Page 13 of 53)

Showing results of 1304

Sort by relevance or date