Post by ahuckphin on Issues with Modbus Slave with Raspberry Pi
CODESYS Forge
talk
(Post)
I have a DFRobot RS485 temperature & humidity sensor (SEN0438) connected to my Raspberry Pi via a USB to RS485 adapter. I am able to connect and read the sensor data when running a python code locally. However in Codesys, I encounter this error "A bus error has occurred." and "There was no response in time". Could this be because of Modbus Server Channel and Modbus Server Init configuration on my part? Admittedly I am new to Codesys. To get to this stage, I: 1. added some lines to CODESYSControl_User.cfg 2. added "Modbus_COM" in Codesys and set "Serial Port Configuration" under "General" 3. added "Modbus_Master_COM_Port" in Codesys and checked transmission mode is set to "RTU" 4. added "Modbus_Slave_COM_Port" in Codesys and checked server address is set to 1 (also set 1 in my sensor) 5. added 1 channel and 1 init for "Modbus_Slave_COM_Port" under "Modbus Server Channel" and "Modbus Server Init"
Last updated: 2024-07-10
Post by mxj262 on FB having single input but initialized with Array
CODESYS Forge
talk
(Post)
I am adding elements of an ARRAY using pointer to access each element inside a FOR loop and the FOR loop does not stop! What is the right way to use pointers in such case?? I have another loop that is not using pointer and it stops but the loop using pointer keep on adding. METHOD FB_Init: BOOL VAR_INPUT bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold) bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change) END_VAR VAR_IN_OUT // basically REFERENCE TO window_buffer: ARRAY [*] OF INT; // array of any size END_VAR THIS^.windowPtr := ADR(window_buffer[0]); THIS^.windowSize := UPPER_BOUND(window_buffer, 1) - LOWER_BOUND(window_buffer, 1) + 1; FUNCTION_BLOCK FB500 VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR windowPtr: POINTER TO INT; windowSize: DINT; currentIndex: UINT; element1:INT; element2:INT; i:INT; j:INT; sum:DINT:=0; END_VAR element1:=windowPtr[0]; // read the first element of the Array dynamic memorry element2:=windowPtr[1]; FOR i:=0 TO (TO_INT(windowSize-1)) BY 1 DO // this loop does not stop Sum:=sum + windowPtr[i]; END_FOR FOR j:=0 TO 5 BY 1 DO // this loop stops j:=j+1; END_FOR https://ibb.co/k3DhkZT
Last updated: 2024-05-06
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 simover on TCP/IP client
CODESYS Forge
talk
(Post)
I want to send a string to a tics TCP/IP server. I got i working with the Net Base lib. for communication good with this tcis i need to by array of byte I want to include a string in the third position of the array TCIS_Send[1] :=254; //this valus is fix for evry communication TCIS_Send[2] :=80; //this valus is fix for evry communication TCIS_Send[3] := ; here I put my and my string is lik this 5806509-DRAP10#AB#3452302073 TCIS_Send[4] :=252; //this valus is fix for evry communication
Last updated: 2023-12-18
Post by damian177 on Codesys and SMS in RPi
CODESYS Forge
talk
(Post)
Hi, I try use IIoT library to send and receive SMS by Raspbery PI and Codesys. I installed IIoT package and added the SMS library, But something is wrong, when I init communication it doesn't work, When I sniffer my communication (AT commands) beetwen RS232 RaspberryPi and my GSM modem I have only below commands: AT+CMEE=1 OK AT+CPIN? +CPIN: READY Anyone have idea what can be wrong ?
Last updated: 2023-09-28
Post by installwhat on What is the solution for "Application stopped on recovery switch request"?
CODESYS Forge
talk
(Post)
<Entry severity="information" component="<10>" user="nobody" timestamp="2024-07-04 ?? 5:10:47" infoId="1">Axis#=121 , Error=30014 , Emergency 2 <Entry severity="information" component="<10>" user="nobody" timestamp="2024-07-04 ?? 5:10:23" infoId="1">TCP Server : WaitClient <Entry severity="information" component="<10>" user="nobody" timestamp="2024-07-04 ?? 5:10:23" infoId="1">TCP Server : Init What is "component="<10>"? Is this system a vanilla CODESYS RTE or is it a modified installation. I think more details are required.
Last updated: 2024-07-08
Post by pernockham on Is there a pragma for init/instantiation of local variables in FB (like in Methods)
CODESYS Forge
talk
(Post)
Im using a pointer as input for a FB and for convenience I like to use 'referenced' variable internally. I use this setup in methods which works because internal variables are instantiated for each call. In a FB these variables are instantiated and initiated for the first call only. Is there a pragma/attribute available that changes this behaviour to mirror a 'method'-call?
Last updated: 2024-10-31
Post by timvh on Sorting array of any-sized structure
CODESYS Forge
talk
(Post)
Look all the way at the end of the link below. This provides a way to use arrays with various lengths: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_datatype_array.html
Last updated: 2023-08-18
Post by jegerjon on Find index based on values
CODESYS Forge
talk
(Post)
Hi, I need to figure out witch indexes of an Array containing the highest and lowest values. Typically search for the 5 lowest values and result the indexnumbers containing the 5 lovest values. is there a library for this, or codeexample?
Last updated: 2023-08-20
Post by jegerjon on Find index based on values
CODESYS Forge
talk
(Post)
Hi, I need to figure out witch indexes of an Array containing the highest and lowest values. Typically search for the 5 lowest values and result the indexnumbers containing the 5 lovest values. is there a library for this, or codeexample?
Last updated: 2023-08-20
Post by naidureginald on creating a visualization table
CODESYS Forge
talk
(Post)
hi all im trying to create a visualisation table for a axis alarms list. upon entering the data array, i recieve a message as attached. any help would be much appreciated.
Last updated: 2024-01-03
Post by apurv on Cannot pass array of constant size to a function as a reference
CODESYS Forge
talk
(Post)
Could not find the solution to this issue but I have side stepped this by creating a global variable MAX_SIZE.
Last updated: 2024-01-08
Post by gurkan on OPCUA array max length?
CODESYS Forge
talk
(Post)
2000 works. When testing with UA Expert there is a timeout from the OPCUA Server when trying to subscribe to the variable CPU do not seems to be to affected. The memory(RAM) however is building up
Last updated: 2024-02-19
Post by rafaelbrito on Error while processing the visualization: Client id not present or no longer valid
CODESYS Forge
talk
(Post)
I'm having the same problem after configuring array in Alarm Group (I configured only one item per line, since Alarm Group does not work with structures / arrays). Can someone help us?
Last updated: 2024-02-20
Post by rafaelbrito on Error while processing the visualization: Client id not present or no longer valid
CODESYS Forge
talk
(Post)
I'm having the same problem after configuring array in Alarm Group (I configured only one item per line, since Alarm Group does not work with structures / arrays). Can someone help us?
Last updated: 2024-02-20
Post by rafaelbrito on Error while processing the visualization: Client id not present or no longer valid
CODESYS Forge
talk
(Post)
I'm having the same problem after configuring array in Alarm Group (I configured only one item per line, since Alarm Group does not work with structures / arrays). Can someone help us?
Last updated: 2024-02-20
Post by rafaelbrito on Error while processing the visualization: Client id not present or no longer valid
CODESYS Forge
talk
(Post)
I'm having the same problem after configuring array in Alarm Group (I configured only one item per line, since Alarm Group does not work with structures / arrays). Can someone help us?
Last updated: 2024-02-20
Post by dominggus on Recipe Manager - RecipeManCommands, load & write wrong values, Bug?
CODESYS Forge
talk
(Post)
I've workaround it by not using an array but 30 instances of the struct and putting these in the recipe, and then using converter functions to save and load
Last updated: 2024-03-02
Post by kuuki on Losing focus of variable
CODESYS Forge
talk
(Post)
Hi. Does anyone know how to fix a problem with losing focus of a variable in FBD editor. Sometimes when trying to edit variable name, array index, etc. in network, editor randomly exits "text edit mode" and variable is replaced by text you were typing.
Last updated: 2024-03-26
Post by damian177 on Raspbery Pi and Calendar
CODESYS Forge
talk
(Post)
Hi, In my visualisation I have a "Calendar" control. I would like save day and month which will be clicket by operator on this control . forexample save in string array. How do this ?
Last updated: 2024-04-23
Post by damian177 on Visualization - table element
CODESYS Forge
talk
(Post)
Hi, In my application I use table elemnt with filled by STRING ARRAY. I would like to implement the following functionality : When I click on second row, that this row will be cleared. Anyone can help me?
Last updated: 2024-04-25
Post by mxj262 on FB having single input but initialized with Array
CODESYS Forge
talk
(Post)
Ok yes now the loop has stopped when I set sum to zero before the for loop. Why will it retain the sum value from the last call?
Last updated: 2024-05-06
Post by drml on Array to String
CODESYS Forge
talk
(Post)
If a size is not specified, CODESYS allocates 80 characters by default for a string. After 7 seconds, does your Json_string contain all of your 20000 key/values? Or is the result truncated to 80 characters?
Last updated: 2024-07-19
Post by mmpl on Array to String
CODESYS Forge
talk
(Post)
Hi Thank you for you reply. Yes I can concatenat longer string. I am using string_Util_Intern libraray for concat. The issue is abot plc performance. It takes 7 second. I am looking to improve time.
Last updated: 2024-07-23
Post by timvh on Readable IO names
CODESYS Forge
talk
(Post)
IF you create an ENUM {attribute 'qualified_only'} {attribute 'strict'} TYPE E_IO : ( FIRST := 0, SECOND := 1 ); END_TYPE You should be able to access the array items like: IOCard_OUTPUT[E_IO.FIRST]
Last updated: 2024-09-28
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
.