Search talk: cds data type array

 
<< < 1 .. 10 11 12 13 14 .. 52 > >> (Page 12 of 52)

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

Cache data CODESYS Forge talk (Thread)
Cache data
Last updated: 2020-12-22

Multiple application data manager CODESYS Forge talk (Thread)
Multiple application data manager
Last updated: 2019-03-12

PERSISTENT DATA CODESYS Forge talk (Thread)
PERSISTENT DATA
Last updated: 2012-01-23

Data conversion+ CODESYS Forge talk (Thread)
Data conversion+
Last updated: 2017-01-04

Data breakpoints CODESYS Forge talk (Thread)
Data breakpoints
Last updated: 2019-08-23

I/O Data alignment CODESYS Forge talk (Thread)
I/O Data alignment
Last updated: 2017-08-11

modbus data types CODESYS Forge talk (Thread)
modbus data types
Last updated: 2016-06-14

data source question CODESYS Forge talk (Thread)
data source question
Last updated: 2018-09-12

Sharing data between applications CODESYS Forge talk (Thread)
Sharing data between applications
Last updated: 2021-09-14

Data source port CODESYS Forge talk (Thread)
Data source port
Last updated: 2021-10-21

Serial communication - received data. CODESYS Forge talk (Thread)
Serial communication - received data.
Last updated: 2022-02-11

Data transfer between tasks CODESYS Forge talk (Thread)
Data transfer between tasks
Last updated: 2016-03-14

CANopen new pdo data CODESYS Forge talk (Thread)
CANopen new pdo data
Last updated: 2022-09-08

TREND DATA CALLING CODESYS Forge talk (Thread)
TREND DATA CALLING
Last updated: 2011-04-18

Trends from database data CODESYS Forge talk (Thread)
Trends from database data
Last updated: 2017-12-31

store data in file CODESYS Forge talk (Thread)
store data in file
Last updated: 2018-02-26

OPC UA Data Types CODESYS Forge talk (Thread)
OPC UA Data Types
Last updated: 2023-05-09

G code Line Data CODESYS Forge talk (Thread)
G code Line Data
Last updated: 2023-04-12

DI4 USB - Transfer Data CODESYS Forge talk (Thread)
DI4 USB - Transfer Data
Last updated: 2024-02-22

Data Source Limit CODESYS Forge talk (Thread)
Data Source Limit
Last updated: 2024-03-06

Data to server CODESYS Forge talk (Thread)
Data to server
Last updated: 2025-11-11

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: 2 days ago

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

<< < 1 .. 10 11 12 13 14 .. 52 > >> (Page 12 of 52)

Showing results of 1283

Sort by relevance or date