Post by tomast on Communication PLC with HMI - how to send DUT via NVL.
CODESYS Forge
talk
(Post)
Hi everyone, I am working with project where i have DUT wihth struct. I would like to fill this data trough a form on HMI. I use NVL to communicate and i would like to know how is it possible to do this? Thanks for all your advice in advance.
Last updated: 2024-08-23
Post by tomast on Communication between PLC and HMI- sending DUT data
CODESYS Forge
talk
(Post)
Hi everyone, I am working with project where i have DUT wihth struct. I would like to fill this data trough a form on HMI. I use NVL to communicate and i would like to know how is it possible to do this? Thanks for all your advice in advance.
Last updated: 2024-08-23
Post by anlebr on Codesys Communication Manger - Required information model version exists in the model repository but is not found
CODESYS Forge
talk
(Post)
Hi I posted the same question at Wago Community. PatrickR told me to use an older version of the nodesets. I dont remember exactly what I did, but I am quite sure this somehow led to a solution. Hope this helps :)
Last updated: 2024-09-18
Post by timvh on FB string and naming
CODESYS Forge
talk
(Post)
Really not clear what you are trying to do, but isn't a Struct enough? So add an object of the type DUT to the Application. Then create a structure TYPE ST_Sensor : STRUCT sName : STRING; uiNumber : UINT; END_STRUCT END_TYPE Then in you application add an instance of this Structure stSensor1 : ST_Sensor := (sName := 'my sensor', uiNumber := 1); or use it like this stSensor1.sName := 'my sensor';
Last updated: 2024-09-28
Post by mrbartpawlowski on Codesys Crash
CODESYS Forge
talk
(Post)
Hi all, I’m new to codesys and working on some project. Codesy 3.5 V20 patch 3 Every time I try to use refactor codesys hang and not respond. I was trying to use repair function in installer but this is not helping at all. Wonder if anyone experience this behaviour? Sometimes I have Popup saying : Cannot insert ‘CreateTextFile’ bellow ‘<root>’</root>
Last updated: 2024-10-14
Post by lbartik on MPC predictive control
CODESYS Forge
talk
(Post)
Would this work? https://www.mathworks.com/hardware-support/codesys.html I'm also interested in real-world MPC and have no idea where to start. There is an exciting Python library that is also beyond my grasp: https://www.do-mpc.com/en/latest/index.html Step 1, get PhD(s). Step 2, get job in aerospace/robotics. Step 3, return 15 years later to share this knowledge?
Last updated: 2024-10-19
Post by phoward131 on Alarm Table Filtering
CODESYS Forge
talk
(Post)
I actually just found the solution maybe. If anyone else is running into this, go to your Project Settings > Visualization > Advanced (check 'Visible' to see advanced settings) > UNCHECK 'Activate property handling in all element properties.' I am not sure what else unchecking this might affect but it seems to allow the alarm table to be filtered as expected.
Last updated: 2024-10-28
Post by phoward131 on Alarm filtering latch variables
CODESYS Forge
talk
(Post)
I actually just found the solution maybe. If anyone else is running into this, go to your Project Settings > Visualization > Advanced (check 'Visible' to see advanced settings) > UNCHECK 'Activate property handling in all element properties.' I am not sure what else unchecking this might affect but it seems to allow the alarm table to be filtered as expected.
Last updated: 2024-10-28
Post by timvh on CAN Open Manager - varible of SYNC
CODESYS Forge
talk
(Post)
You can enable "Sync Producing" in the configuration of the CANopen Manager. Then this manager will send a SYNC message every interval you set. Depending on your PDO configuration, the CAN nodes can send a PDO on every Sync (cyclic-synchronous). If this is not possible, then as alternative you can send a low level CAN message with COB-ID 16#80.
Last updated: 2024-11-05
Post by andrax on CodeSys Raspberry pi I2C driver not found
CODESYS Forge
talk
(Post)
Ok, this is a test programme with ADS1115. It is currently configured for the TCA9548 muxboard. If you want to run the ADS1115 single, then change the settings to the default values: ‘Is Multiplex:’ False ‘Stage mux channel numbers:’ [0,0,0,0,0,0,0,0,0] It is also important that the libraries are installed correctly here. But should be in this project
Last updated: 2024-11-07
Post by bertcom on Converting each character to a string into ASCII
CODESYS Forge
talk
(Post)
@TimvH, Thank you, i think this way i can seperate the complete string to characters. Next part of the topic is converting the characters to an ASCII code. Is there an standerd function in Codesys for this? I alredy searched a few hours for it on the internet. no succes.
Last updated: 4 days ago
Post by timvh on VisuElems.CurrentUserGroupId is not stable
CODESYS Forge
talk
(Post)
I'm not sure what you are trying to do, but getting the CurrentUserGroupID like this will not work, because there could be multiple Visualization Clients and each can have a different user that is logged in. Also when you go online with CODESYS and open an Visualization, this is counted as a client. Probably this is the reason you see it changing. What you can to is "iterate" over all clients and then see which user is logged in on which visualization Client. For this you need to add the Visu Utils library to the project and call the FbIterateClients. See https://content.helpme-codesys.com/en/libs/Visu%20Utils/4.4.0.0/VisuUtils/VisuActionUtilities/Function-Blocks/FbIterateClients.html fbClientIteration( xExecute := x_Execute, itfClientFilter := VU.Globals.AllClients, itfIterationCallback := fbIterator, xDone => x_Done, xBusy => x_Busy, xError => x_Error, eError => e_Error); The fbIterator, in the example above, should be an instance of an FB which you have created yourself and this must implement VU.IVisualizationClientIteration. For example: FUNCTION_BLOCK FB_ITERATOR IMPLEMENTS VU.IVisualizationClientIteration Then automatically the corresponding methods will be called. In the HandleClient Method, you will get an interface to the client(s) and then you can get the current user through this interface: itfClient.UserGroupId You can also get the UserName: itfClient.UserName
Last updated: 2023-11-14
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 timvh on Detect "Cancel" Press in FileOpenSave Dialog
CODESYS Forge
talk
(Post)
Maybe there is a better way, but a long time ago I created a test application that worked like this: With a button I opened the dialog and I added a "Input configuration - OnDialogClosed" "Execute ST-Code" action to this same button which called the following Function when the dialog was closed: F_OnFileDialogClosed(pClientData); Below this Function which handled the result: // This function is called from the visualization when the dialog is closed. FUNCTION F_OnFileDialogClosed : BOOL VAR_INPUT pClientData : POINTER TO VisuElems.VisuStructClientData; END_VAR VAR dialogMan : VisuElems.IDialogManager; FileOpenCloseDialog : VisuElems.IVisualisationDialog; result : VisuElems.Visu_DialogResult; _sFileName : STRING(255); END_VAR // the DialogManager is provided via the implicitly available VisuManager dialogMan := VisuElems.g_VisuManager.GetDialogManager(); IF dialogMan <> 0 AND pClientData <> 0 THEN FileOpenCloseDialog := dialogMan.GetDialog('VisuDialogs.FileOpenSave'); // gets the FileOpenSave dialog IF FileOpenCloseDialog <> 0 THEN result := FileOpenCloseDialog.GetResult(); // gets the result (OK, Cancel) of the dialog IF result = VisuElems.Visu_DialogResult.OK THEN // Original code gvlFile.FileListProvider(); _sFileName := CONCAT(gvlFile.FileListProvider._stDirectory, gvlFile.FileListProvider.stFile); // do something with this file name... END_IF END_IF END_IF
Last updated: 2023-09-19
Post by timvh on License problem gateway
CODESYS Forge
talk
(Post)
What we are trying to explain is that, yes CODESYS creates the software, but Epis decides how they implement it on their hardware, which runtime version they use and they decide which functionality they support. So it is always a combination of the two. What CODESYS provides is a runtime with options for e.g. visualization or softmotion. Epis could add this softmotion license as default to their controller, but if they don't then CODESYS provides another option with a single license in a "Wibu CodeMeter" container. Eventhough the feature exists, Epis has to add this "CodeMeter" software on their controller to be able to access the licenses in the container. We don't know if they did this. Then finally it depends on what type of runtime is on this controller and which license Epis is using. So if they have an OEM license (not an application based license), then most likely you will need the Softmotion license (not a number of axis). See https://store.codesys.com/en/codesys-softmotion-sl-bundle.html. But to be sure if this is supported by the Epis controller, you must ask Epis.
Last updated: 2024-04-30
Post by egau on Hard shutdown: no code on device after power on
CODESYS Forge
talk
(Post)
This explanation aligns with the issues we’re experiencing with our machines. The scenario I described is happening with one of them (let’s call it Machine A). This machine is identical to another one (Machine B), except for some custom code that facilitates communication with an external Beckhoff PLC for MES integration in the production line. Machine B has been powered on and off daily for at least three months and has never had this problem. Given that, I highly doubt the MES custom code is the cause of the code corruption. This being said, your explanation does seem plausible. However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown? One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task?
Last updated: 2024-10-03
Post by jerry-sorrells on Find Function: Object reference not set to an instance of an object.
CODESYS Forge
talk
(Post)
Build: CODESYS 3.5 SP19 Patch 1 (64-bit) Host OS: Windows 10 Target: Linux SL I have a project with programs in Structured Text and Ladder Diagram. When I try to use the Find function, it works for the Active Editor; however, when I try to use Find for the Entire Project, I get the error "Object reference not set to the instance of an object." I know what this error means in the context of the program, but I have no idea why the find function is returning this error. The variable I am searching does not matter: it happens with all variables. Any help with this will be greatly appreciated. I generally use the Find function quite often as I am developing and not having it is really slowing me down.
Last updated: 2023-10-23
Post by royw on Profinet library for C#
CODESYS Forge
talk
(Post)
Hi, I don't know if I'm in the right place or if it's even possible... I'm looking for a way to address a Profinet device with Record Read and Write from my own PC. I actually only need very few commands to configure our device. This means setting the MAC address and a serial number. We would like to do this from a C# program. Now we are looking for a library or something similar. Since you can do it from Codesys, I thought there might be a DLL or something similar that you could use for this. As I said, we don't want real-time queries of the cyclic data but only record read/write. Does anyone have any helpful hint? Thanks in advance
Last updated: 2023-12-22
Post by anderson on function block output
CODESYS Forge
talk
(Post)
I'm trying to make a CNC machine, but I'm having problems because the drive I'm using only has the option of communicating through digital inputs. In this case, I should use the CLP's digital outputs to communicate with it, correct? However, in the function blocks it seems that they are already pre-programmed and I didn't find the pulse output options, for example, so that I could associate a digital output from the PLC to connect this to the drive's pulse input. My question is: is it possible to associate the pulse output of the function block with a digital output of the PLC? and how to do this?
Last updated: 2024-01-05
Post by jdjennings1962 on Trouble accessing Math functions in OSCAT library
CODESYS Forge
talk
(Post)
Hi all, I am trying to utilize the ARRAY_SDV standard deviation function, part of the Math group in the OSCAT library downloaded from the CODESYS store. My Codesys version is 3.5.19.10. When I add the OSCAT to my Library, it shows a subset of the library (Standard) as fully installed and signed (see pic). However, the Math functions are not in this Standard group. The Math functions I need can be viewed as source code in the full OSCAT_BASIC, though this the symbol next to this library suggests it is source only and not fully installed. When I try to declare an instance of the ARRAY_SDV function in a program, it is not known. I have tried reinstalling and Building . . . Any help would be greatly appreciated. Jeff
Last updated: 2024-01-06
Post by arundara on OPC UA Server Stops after 5 consecutive disconnections of ethernet port
CODESYS Forge
talk
(Post)
Hello Every one, During testing of OPC UA communication between UA Expert software and the CODESYS SoftPLC on a Linux environment, an observation was made. When the Ethernet cable was disconnected and reconnected with 2-minute intervals, on the 5th attempt, the OPC UA connection failed to establish in UA Expert software. At this juncture, restarting the CODESYS SoftPLC enabled the reestablishment of OPC UA communication. The same result was obtained when testing on a Raspberry Pi SoftPLC. What is the reason behind this phenomenon? and whether there are settings to stop this behavior? Please help. Thanks & Regards.
Last updated: 2024-02-13
Post by timvh on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
Are you using the Control Win SL (installed together with the development environment of CODESYS)? If yes, you might want to consider using the CODESYS RTE instead. This has real-time capabilities (running on separate core(s)). But to be able to use this, you have to install the CODESYS Ethernet driver for your network interface to be able to let the RTE access the network port also in realtime. See: https://store.codesys.com/en/codesys-control-rte-sl-bundle.html https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_windows_rts_v3.html PS, I haven't tested this myself yet, but you could try to use the SetCommunicationState method of the Profinet controller to see if you can reset and start the bus communication: result := PN_Controller.SetCommunicationState(eRequestedState := DED.DEVICE_TRANSITION_STATE.START); PS, if you are located in the Netherlands or Belgium, we could also provide the license(s) for you.
Last updated: 2024-02-28
Post by timvh on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
Are you using the Control Win SL (installed together with the development environment of CODESYS)? If yes, you might want to consider using the CODESYS RTE instead. This has real-time capabilities (running on separate core(s)). But to be able to use this, you have to install the CODESYS Ethernet driver for your network interface to be able to let the RTE access the network port also in realtime. See: https://store.codesys.com/en/codesys-control-rte-sl-bundle.html https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_windows_rts_v3.html PS, I haven't tested this myself yet, but you could try to use the SetCommunicationState method of the Profinet controller to see if you can reset and start the bus communication: result := PN_Controller.SetCommunicationState(eRequestedState := DED.DEVICE_TRANSITION_STATE.START); PS, if you are located in the Netherlands or Belgium, we could also provide the license(s) for you.
Last updated: 2024-02-28
Post by riccardo on Web Browser special tools errors
CODESYS Forge
talk
(Post)
Goodmoning everyone, I hope a codesys tecnichian will see this post. I serched on the forum and I found many topic about this tool but very few reaplies. I am tring to use the Web Browser tool, but it doesn't seem to work properly. I put several links in several forms: https://google.com http://google.com/ http://www.google.com http://www.google.com/ http://www.studiojomega.it/ . . . https://192.168.1.101/u-os-app-codesys/application/visualization/webvisu.htm But I obtain always errors; mainly 400 and 404 and in the normal visu this message appears "www.Google.com has refuse the connection". Is the codesys browser able to work as every other browser or has it some limitation? There is some particular precaution to consider when I pass the link to the codesys browser? Thanks in advance, Riccardo
Last updated: 2024-02-29
Post by struccc on Release SP20 - Changes in behaviour?
CODESYS Forge
talk
(Post)
Dear all, I've just started to migrate some of my ancient projects to SP20. There is one strange error (?) I have noticed so far. In a method call, depending on the circumstances I would like to return reference to an object, or an invalid reference: METHOD Add_EVT_OUT : REFERENCE TO FB_MSG VAR END_VAR IF __ISVALIDREF(refMSG_Entry) THEN Add_EVT_OUT REF= MANAGER.AddMsg_EVT_OUT( refMSG_Entry, _Get_EVT_Message(MSG_EVENT.OUT), _Get_EVT_AddCode(MSG_EVENT.OUT) )^; ELSE Add_EVT_OUT := 0; END_IF So far setting a reference variable to 0, did this. But now, the expression Add_EVT_OUT := 0; gives an error: [ERROR] DB_WTP_370: Add_EVT_ACK MSG_TRIGGER_EXT: C0032: Cannot convert type 'BIT' to type 'REFERENCE TO FB_MSG' Naturally... I can write: Add_EVT_OUT := DWORD#0; But is this the correct way? Is there any constant I could use instead, like "NULL"? Or this is totally wrong and to be avoided?
Last updated: 2024-03-24
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
.