Post by corriibme on JSON Utilities and SetArray
CODESYS Forge
talk
(Post)
Hello @florian, Could you please help with how to set an array value? I've been trying to use the with the setKeyWithArray method which creates the key with an empty array value. But I have been unable to set items in this array? objindex:= fb_JBuilder.SetKeyWithArray("Key6", diParentIndex := diRootIndex); objindex2:= fb_JBuilder.SetValue(value:= iValue2, diParentIndex:= objindexx); //iValue: array[0..n] of int; Best regards
Last updated: 2024-05-11
How to stop execution when a table index goes outside the table size range.
CODESYS Forge
talk
(Thread)
How to stop execution when a table index goes outside the table size range.
Last updated: 2019-11-06
Wrong font size after installation on Windows 7 64-bit
CODESYS Forge
talk
(Thread)
Wrong font size after installation on Windows 7 64-bit
Last updated: 2011-06-14
How to change visualization size, or initiate automatic detection at runtime?
CODESYS Forge
talk
(Thread)
How to change visualization size, or initiate automatic detection at runtime?
Last updated: 2020-04-08
How to adjust Maximun packet size in the parameter list? (MQTT)
CODESYS Forge
talk
(Thread)
How to adjust Maximun packet size in the parameter list? (MQTT)
Last updated: 2022-11-07
What is the bitmap size and resolution to add in PLC_Visu
CODESYS Forge
talk
(Thread)
What is the bitmap size and resolution to add in PLC_Visu
Last updated: 2009-08-03
Is it possible to change the code font size in Codesys 2.3 ?
CODESYS Forge
talk
(Thread)
Is it possible to change the code font size in Codesys 2.3 ?
Last updated: 2022-04-16
Post by peterned on Array to String
CODESYS Forge
talk
(Post)
max. string length in Codesys is 255 chars. It's not possible to cram 20,000 things in a string. If you need to send the data to another device, send the whole data[] array (as byte array, without doing anything to it) and extract the information on the other end. As each struct member has a fixed size (81 bytes, as per you declaration), this will be easy. To save some resources, consider declaring string lengths - e.g. if the max possible length for key is 10 chars, declare it key: STRING(10); and it will occupy 11 bytes instead of 81
Last updated: 2024-07-20
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 damian177 on Persistence variables PFC200
CODESYS Forge
talk
(Post)
Hi, I using persistence variables like below: VAR_GLOBAL PERSISTENT RETAIN id_worker1: ARRAY [0..3] OF INT := [231,234,176,222]; id_worker2: ARRAY [0..3] OF INT := [211,129,125,221]; Initial values can cause some problems?
Last updated: 2023-12-08
Post by fless on FB having single input but initialized with Array
CODESYS Forge
talk
(Post)
with every call of the FB500 it keeps adding the INTs of the array to the sum variable. set sum to 0 before you start the loop.
Last updated: 2024-05-06
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 eschwellinger on Code Size
CODESYS Forge
talk
(Post)
see here:
Last updated: 2023-09-07
Post by viktorr on Shared Memory Requested Size
CODESYS Forge
talk
(Post)
Last updated: 2024-07-04
Post by ben1 on Alarm Table rows font size not change
CODESYS Forge
talk
(Post)
Last updated: 2024-10-23
Post by budd7566 on Text size suddenly changed
CODESYS Forge
talk
(Post)
Iv been working with a Deep Sea Electronics DSE840 for about 6 months. I have a development version of my program working with a state machine and a basic gui interface. I went to implement CAN and suddenly the text on the gui on the controller is much larger than before. I could flash old versions of my project and the text was the correct size, but if i renamed the project file, the text displayed would be large. The visualization in CODESYS always shows the expected size, but not the controller. I did a fresh install of CODESYS and even a new project with only one text box, I cant get the text size on the controller to match what is displayed in codesys to match. Any advice?
Last updated: 2023-12-09
Post by mubeta on STRUCT AT %MW1000
CODESYS Forge
talk
(Post)
This is normal and correct since in CoDeSys static addressing of variables uses the IEC method. A LONG tag has the size of 8 bytes, so %ML0 coincides with %MB0 ... %MB7; %ML1000 with %MB8000 ... %MB8007. (Similar reason for word and other formats). Also the reason the compiler won't let you map the structure to a %MW depends on the fact that the individual base elements are manipulated to 64 bits regardless of the smaller size. That said, it makes me strange that you cannot write a parser without making use of static memory allocation.
Last updated: 2024-08-13
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
Post by garrian on How to write multiple coils (Modbus FC15)
CODESYS Forge
talk
(Post)
Thanks for your reply. I belive it is contiguous, I'm writing to adress 0 to 4. Or, do you mean something else? Well, something is happening. If I on the client set adress 1,2,3 to true, only 1 is set to true on the server side. On the client side, the data is array of word. But on the server side, the coils are array of bool. Holding register is array of word on server side. Can this be a problem? Attached screenshot of how it looks at the server side.
Last updated: 1 day ago
OPC UA Server limitations, large array crashes runtime
CODESYS Forge
talk
(Thread)
OPC UA Server limitations, large array crashes runtime
Last updated: 2023-08-23
Codesys 2.3.9.28 Webvisu Tabelle mit Array 1..12,1..31 edit
CODESYS Forge
talk
(Thread)
Codesys 2.3.9.28 Webvisu Tabelle mit Array 1..12,1..31 edit
Last updated: 2012-05-11
Exporting Array from Codesys to Text or Excel
CODESYS Forge
talk
(Thread)
Exporting Array from Codesys to Text or Excel
Last updated: 2018-10-10
Mit UNION Bit-Array auf WORD verknüpfen
CODESYS Forge
talk
(Thread)
Mit UNION Bit-Array auf WORD verknüpfen
Last updated: 2016-09-09
Fehler: Falscher Index für Array! Aufrufhierarchie aufrufen
CODESYS Forge
talk
(Thread)
Fehler: Falscher Index für Array! Aufrufhierarchie aufrufen
Last updated: 2012-03-23
DINT adds 2 additional empty bytes in array/union
CODESYS Forge
talk
(Thread)
DINT adds 2 additional empty bytes in array/union
Last updated: 2021-10-12
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
.