Post by clarenced on ERROR: Calling the program "AlarmStorage_Prg" is not allowed from multiple tasks
CODESYS Forge
talk
(Post)
Using codesys v3.5 SP21 Patch 1. We are using Visualization to display alarms. Other then the automatically created AlarmManagerTask, there is no code written to call AlarmStorage_Prg. Any ideas why we would be seeing this error in the log? The runtime actually shutdown. Not sure if that was caused by this error or not. 2025-08-03T02:45:35.444Z, 0x00001012, 4, 0, 0, * ERROR: Calling the program "AlarmStorage_Prg" is not allowed from multiple tasks. 2025-08-03T03:48:15.294Z, 0x00001012, 4, 0, 0, * ERROR: Calling the program "AlarmStorage_Prg" is not allowed from multiple tasks. 2025-08-03T04:38:11.557Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state * We recommend a reboot of the controller now! * 2025-08-03T04:38:11.576Z, 0x0000010f, 8, 1, 0, #### Exception: SysSemEnter - Semaphore deadlock detected - owner thread died [tid:726740] - system may be in an inconsistent state. 2025-08-03T04:38:11.576Z, 0x00000103, 65544, 1, 0, runtime received SIGABRT - system may be in an inconsistent state * We recommend a reboot of the controller now! 2025-08-03T04:38:11.576Z, 0x00000001, 8, 260, 3, #### Exception: HANDLED EXCPT* <excpt>NonContinuable</excpt> in CH_COMM_CYCLE 2025-08-03T04:40:12.308Z, 0x00000001, 1, 0, 35, CODESYS Control shutdown... 2025-08-03T04:40:13.436Z, 0x00000071, 1, 0, 13, Webserver stopped 2025-08-03T04:40:13.437Z, 0x00000114, 2, 1, 0, !!!! Warning: task_signalhandler_exit [MainTask] lost cycles: 14809 2025-08-03T04:40:13.497Z, 0x00000001, 1, 0, 10, [UNLOADED] IEC|Dynamic: <cmp>IecVarAccess</cmp>, <id>0x00001007</id> <ver>3.5.3.64</ver> 2025-08-03T04:40:13.506Z, 0x00000001, 1, 0, 10, [UNLOADED] IEC|Dynamic: <cmp>AlarmMgr</cmp>, <id>0x00001012</id> <ver>4.7.0.0</ver> 2025-08-03T04:40:13.513Z, 0x00000071, 2, 0, 14, !!!! Warning: Unbalanced calls to WebServerRequestRunning/WebServerReleaseRunning 2025-08-03T04:40:13.513Z, 0x00000001, 1, 0, 10, [UNLOADED] IEC|Dynamic: <cmp>IECVisualization</cmp>, <id>0x0000100c</id> <ver>4.7.0.0</ver> 2025-08-03T04:40:13.611Z, 0x00000124, 1, 0, 0, Provider 'AddressSpaceFragment Provider' (version 0x3051500) unregisterd at the OPC UA server. 2025-08-03T04:40:13.611Z, 0x00000124, 1, 0, 0, Provider 'OPC UA for IEC-61131-3' (version 0x3051500) unregisterd at the OPC UA server. 2025-08-03T04:50:17.708Z, 0x00000001, 1, 0, 36, CODESYS Control shutdown done
Last updated: 2025-08-04
Post by edvard-munch on How I can get "Done flag" for "Modbus Slave Channel"?
CODESYS Forge
talk
(Post)
This is from 10 years ago, I know. But I have been using (SLAVE_DEVICE.iChannelIndex = CHANNEL_NUMBER) AND (SLAVE_DEVICE.xDone) I suppose that it shows xDone for the channel that shows up in the iChannelIndex at the same cycle? It seems to be working properly for two devices that I have been using it before But now I have another device and using two write channels, for one register each. One channel works properly and returns DONE flag When another channel is triggered, I see that it shows up in iChannelIndex, but flag DONE not received, but no Error for the channel. Also, when i check the register in the device it's evident that data has been transferred. Is this could happen sometimes with CODESYS, so DONE flag not received? Or this is a problem with a given device? With this certain register
Last updated: 2024-12-19
Post by egau on Enable and Disable Project IO programmatically
CODESYS Forge
talk
(Post)
Hi @eschwellinger, I tried this with Modbus COM slaves. I was able to disable them (slave becomes greyed out in the device tree), but the DED.Reconfigure "eError" output shows "NOT_SUPPORTED". After this, when I tried to re-enable the slave, it did not work (device stayed greyed out in the device tree), and the DED.Reconfigure "eError" output also showed "NOT_SUPPORTED". Is there something to do about this, or the device just doesn't support reconfiguration? P.S: I tried this running locally on my computer (not in simulation mode). So of course I was not physically connected to the devices. I have two similar projects, but one of them doesn't have the Modbus_COM devices. I know I can "Exclude from build" the devices for that project, but I would really prefer not to do this if possible. I would prefer to dynamically toggle a configuration variable that would enable or disable the slaves.
Last updated: 2025-03-14
Post by christoph--b on Probleme mit Speicheraufteilung nach Wechsel von Wago 750-841 zu 750-891
CODESYS Forge
talk
(Post)
Hallo, ich habe in meiner Hausautomation eine Wago 750-841 mit einem doch mittlerweile umfangreichen Programm. Diese wollte ich nun gegen eine 750-891 der 4. Generation austauschen. Aufgrund der Programmgröße hatte ich damals die Speichergröße für Retainvariablen von 16#4000 auf 16#7000 vergrößert und so läuft sie nun seit Jahren fehlerfrei. Allerdings mit der 750-891 bekomme ich offensichtlich eine Überschneidung mit dem Modbusregister, denn die Werte über Modbus spielen verrückt. In der Standardgröße mit 16#4000 tritt das Phänomen nicht auf, reicht dann aber nicht für das vorhandene Programm. Dafür gibt es sicher eine Lösung, denn die 891 hat ja deutlich mehr Speicher. Allerdings kenne ich mich mit der Speicheraufteilung nicht aus, wo man da was optimieren kann, damit ich den Speicherbereich entsprechend erweitern kann, aber es zu keiner Überschneidung kommt. Für Hilfe wäre ich sehr dankbar
Last updated: 2025-07-20
Post by wbj0t on System libs and I/O Drivers
CODESYS Forge
talk
(Post)
Hi everyone. My question about: where I can learn (read or watch) an info about codesys workflow through the system IO libs? I want to know how to implement I/O drivers by my self. In the system libs I see many interfaces, methods etc... But there is no explanation about them, just names of methods and fields of the FBs. I know about this page: https://forge.codesys.com/drv/io-drivers/doc/Generic/ There is so BIG the device description file and not so clear explaining of the attributes and elements, also some elements or attributes missed at it all. Yes, there are code examples on this page, but, so shortly and, for example, code about Modbus drivers is absent. And even if I try to add the IoDrvFB with lib, I get and error, something like: "failed to load IoDrvFB driver". And what about the book of codesys that written by Gary Pratt? Is there information about system libs and drivers in this book more clearly? Thank you :)
Last updated: 2024-02-02
Post by alexgooi on Modbus writing on value change
CODESYS Forge
talk
(Post)
Hi Duvan, You could make this in 1 single object (FB), Indeed don't use a function for this beacuse you need some memory to keep the old value. For i := 0 TO 200 BY 1 DO //Check if the value has been changed IF Old_Value[i] <> Value[i] THEN //Set the trigger to TRUE Trigger[i] := TRUE; Old_Value[i] := Value[i]; END_IF END_FOR If you define the Value array as an In_Out and the Trigger as an In_Out you arn't claiming any aditional memory to your system. You ofcourse then need to add some code arround it that does something with the trigger and writes it back to FALSE again. If you want more flexability you also could use pointers instead of using the IN_OUT FOR i := 0 TO 200 BY 1 DO address := address_Input + i * SIZEOF(*Put type here); IF Address^ <> Old_Value[i] THEN Trigger[i] := TRUE; Old_Value[i] := Address^; END_IF END_FOR
Last updated: 2024-04-02
Post by duvanmoreno24 on Modbus writing on value change
CODESYS Forge
talk
(Post)
Yes, I tried to do what you put in the first code. However, I have a problem with that and that is that the inputs must be declared with the type. I have many data types running in my code (real, int, uint, bool) and I can't put them in the same function, another thing is that I need to instantiate that function for everything I want to write to the slave. You put a for to 200 but it means that it has to be the same data type and inside the array, but I want to get them individually. I'm struggling to do it in a good and efficient way like wago's E-cockpit does. in the first screenshot you can see, you simply type in value, change the package of things you want to write in value change and it does everything by itself automatically, without comparing any old and new values and even less having the need to activate a bool. , it is perfect.
Last updated: 2024-04-03
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by etienneneu on loading delay with the option "check client animations and overlay of native elements"
CODESYS Forge
talk
(Post)
Hey NicolaG_89, thanks for the tip. But I have seen in the developer tools of the Webclient that a multiple fetching of the image and script data occurs when changing frames (HTTP code 304 NOT Modified), although these are already in the clients cache, which leads to unnecessary loading of resources from the web server. This behavior can also be found if the option “Support client animations and overlay of native elements” is deactivated, but this does not lead to such long delays. I had already tested loading all Visu elements so that everything was fetched once before they could be used. But that didn't help either. To prevent this behavior (permanent fetching), I have used a different way of switching the Visu elements in the VisuDemo Project, which also uses HTML5 control elements. I implemented this with the visibility of entire Visu elements. As a result, it only has to be fetched once and does not have to be fetched again when reloading. But I am still unsure about this implementation if the scope of the visualization becomes larger, as the Codesys visualization documentation advises against using many invisible elements. Best regards Etienne
Last updated: 2024-11-19
Post by timvh on Licensing info not available.
CODESYS Forge
talk
(Post)
In the VPLC configuration settings there is an entry for the IP address of the license server. In this setting fill in the IP address of your device (host IP address). Then when the virtual PLC starts up, it will get the license from the license container on the host. You can do this for all VPLC's running on your device. The VPLC will always take the smallest license which fits the required license. So if you have 2 licenses for VPLC's with small and large applications, then this will work fine if you start up one VPLC which requires the small license and the other which requires the large license. PS, personally I find it much easier, especially for testing and experimenting, to activate the licenses on a CODESYS (USB) key. This is easy to activate (on your development PC) and easier to move to another device. Addtionally you don't loose the license when you need to install a completely new image on the device.
Last updated: 2025-10-02
Post by nicetuxedo on Can not activate license on Raspberry pi
CODESYS Forge
talk
(Post)
Hello everyone, I'm hoping for some assistance with a license activation issue: a software crash has left my license in a strange state. Here is the sequence of events: I purchased a new license for the Raspberry PI from the official CODESYS web store. I opened the CODESYS and started the online activation process using the ticket number I received. During the activation, the CODESYS software threw an exception and crashed. I was not able to see if the activation completed. After restarting CODESYS, I attempted to run the activation process again with the same ticket number. The License Manager now gives me an error stating that the ticket has already been activated/used. I am now stuck because my installation is not licensed, but the activation server believes my ticket has been consumed. Has anyone encountered this before? Is there a way to have the ticket status reset?
Last updated: 2025-10-08
Post by khaledkhalil on OPC UA informationsmodell zu Codesys
CODESYS Forge
talk
(Post)
Ich habe Modelle in SiOME hinzugefĂĽgt, eine Software zum Entwerfen von Knoten und zum HinzufĂĽgen von Instanzen. und erstellte eine resultierende XML-Datei. Ich habe versucht, die XML-Datei ĂĽber das OPC UA-Informationsmodell-Repository in Codesys zu importieren. Das Problem besteht darin, dass ich nicht weiĂź, wie ich meine von mir entworfenen Objekte anzeigen soll. und ordne es meiner SPS zu, um es auf meinem Server UaExpert sichtbar zu machen. Ich habe mir das Tutorial-Video https://youtu.be/aJhzN3Uk-Do?feature=shared angesehen. Aber es zeigt Ihnen nur, wie Sie das Informationsmodell hinzufĂĽgen, und mein resultierendes Modell hat keinen Informationstyp. Wie kann ich also in Codesys ein Modell anzeigen, das ich in SiOME entworfen und meine Instanzen (Objekte, Variablen oder Methoden) meinen Variablen in der SPS zugeordnet habe? Ich habe Leute gesehen, die es in Tia Portal oder einer anderen Software gemacht haben, aber ich habe keine Ahnung, wie man es auf CODESYS macht
Last updated: 2024-03-12
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 am trying use the Codesys Communication Manager to set up an Opc ua server with a custom information model. As a start I am using the Boiler model available on Opc foundations github page. I am testing with a Wago CC100 and using Codesys V3.5 SP19 Patch 6. I get the following error: Communication Manager [Device: PLC Logic: Application]: The information model http://opcfoundation.org/UA/ is required by http://opcfoundation.org/UA/Boiler/ with a minimal publication date from 15/12/2023 but the device has only a model from 15/09/2021 installed. Probably the information model from 15/09/2021 is missing in the information model repository. The error message does not make sense to me. Should it not be “Probably the information model from 15/12/2023 is missing in the information model repository”? Anyway, both versions are available in the repository. How can I solve this?
Last updated: 2024-03-13
Post by wmoon on Licensing info not available.
CODESYS Forge
talk
(Post)
That command can't excute on my device. I installed CODESYS into Hilscher's product using container Here is the Docker file what I used. I'm not sure if this docker file have a problem. If it have a problem, please let me know how to download the files into my device using ftp server. FROM arm64v8/debian:11.6 RUN apt-get update RUN apt-get install -y wget sudo unzip libusb-1.0-0-dev procps ENV CDS_VERSION "4.10.0.0" ENV EDGE_VERSION "4.10.0.0" ENV URL "https://store-archive.codesys.com/ftp_download/3S/LinuxARM64/2302000039/$CDS_VERSION/CODESYS%20Control%20for%20Linux%20ARM64%20SL%20$CDS_VERSION.package" ENV EDGE_URL "https://store-archive.codesys.com/ftp_download/3S/EdgeGatewayLinux/000120/$EDGE_VERSION/CODESYS%20Edge%20Gateway%20for%20Linux%20$EDGE_VERSION.package" RUN wget --output-document=/tmp/codesys.package $URL && \ unzip -p /tmp/codesys.package 'codemeter.deb' > /tmp/codemeter.deb && dpkg -i /tmp/codemeter.deb && \ unzip -p /tmp/codesys.package 'codesyscontrol.deb' > /tmp/codesys.deb && dpkg -i /tmp/codesys.deb RUN wget --output-document=/tmp/edge.package $EDGE_URL && \ unzip -p /tmp/edge.package '*arm64.deb' > /tmp/edge.deb && dpkg -i /tmp/edge.deb EXPOSE 11740 1217 11743 ENTRYPOINT ["/bin/sh", "-c" , "/etc/init.d/codesyscontrol start && /etc/init.d/codesysedge start && tail -f /dev/null"]
Last updated: 2024-03-20
Post by mondinmr on Why SysPipeWindows is not implemented in RTE?
CODESYS Forge
talk
(Post)
This library would be very useful for IPC communications. Using a UDP socket on localhost is unpredictable, as with slightly loaded machines it does not even guarantee packet delivery locally. Using TCP creates a lot of overhead. Message named pipes would be an excellent solution for Windows RTE. On Linux, since the release of the extension package, there is no issue, as it is sufficient to develop a component. However, although now 90% of our clients understand that Linux runtimes are better in every way compared to Windows RTE, especially from the security aspect (Not in kernel space) and the issues with Windows updates, 10% stubbornly insist (sometimes for trivial commercial reasons) on using Windows. Managing IPC with circular buffers in shared memory is quite ugly, or rather really ugly and unaesthetic. In the manuals, I saw the SysPipeWindows libraries, so I decided to test them, but unfortunately, I noticed that they are not implemented for RTE devices. Technically, I could try to open them as regular files, but SysFileOpen returns 16#27 or 16#39 depending on how I set the name (direction of the slashes). Here is the code to create shared memory and named pipes. Shared memory work great, named pipes no! #ifdef Q_OS_WIN32 SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = &sd; sa.bInheritHandle = FALSE; const wchar_t* name = L"Global\\ShmTest"; HANDLE hMapFile = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SharedData), name); if (hMapFile == NULL) { qCritical("Error creating shared memory"); return 1; } data = static_cast<SharedData*>(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SharedData))); if (data == NULL) { qCritical("Error mapping shared memory"); return 1; } HANDLE hPipe = CreateNamedPipe( TEXT("\\\\.\\pipe\\MyPipe"), PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 1024 * 1024, 1024 * 1024, NMPWAIT_USE_DEFAULT_WAIT, &sa); if (hPipe == INVALID_HANDLE_VALUE) { qCritical("Error creating named pipe"); return -1; } if (!ConnectNamedPipe(hPipe, NULL)) { qCritical("Error connecting to named pipe"); return -1; } checkPipe(hPipe); #endif
Last updated: 2024-02-02
Post by acc00 on Redundancy Codesys Runtime, Synchronization
CODESYS Forge
talk
(Post)
Hi, I’m currently testing the Codesys Redundancy application with 2 Raspberry Pi, with the idea is of using in my project 2 Wago PFC200 and 1 Ethercat Master with 2 Remote IO. After I configure the redundancy, and one Pi is Active and the other is Passive, if I disconnect the Ethernet cable of the Active, the Passive become Standalone, which is good, but the problem is the following: -When I recover the Ethernet connection, both stay Standalone. They will NOT Sync until I do it manually in the Codesys environment. How to make the synchronization automatically? -If both Pi/PLC stays Standalone, who is managing the IO? (Ethercat and Serial) I have done a test with an Modbus Slave, where I am sending a counter that increase every second. And I see that when both PLC are standalone, they both keep an active connection with the Slave, and both write values. This does not seem good, since according to this in my project both PLC would try to control the IO at the same time. Note: The Codesys have an option (greyed out, not possible to select) which says “Auto Sync”. What is the purpose, and why I’m not able to select it? I'm using Codesys Control for Rapsberry Pi 64SL Runtime in my test environment (2xRaspberry Pi 4), with the idea of using Codesys Control PFC 200 Runtime in my project (2xWago PFC200 and 1 Ethercat Master with 2x Wago 750-354 Ethercat Fieldbus Coupler). Using the last Codesys 3.5 version (SP19 PAtch 5). I'd appreciate a lot any help on this questions!
Last updated: 2024-01-22
Post by xcqt on Oop best practice
CODESYS Forge
talk
(Post)
Hi all, I’m currently trying to improve my OOP structure in CODESYS and I’m looking for some input on how others approach this. I understand the basics like inheritance, interfaces, abstract FBs, methods, and properties, but I still struggle a bit with the overall architecture and what’s considered clean or scalable in bigger projects. As an example, I’m working on two different energy meter function blocks: FB_EnergyMeter_MQTT reads data from MQTT (strings) FB_EnergyMeter_Modbus reads data from Modbus (words) Both have their own Update() method and implement the same interface (something like IF_EnergyMeter). Later on, I’ll probably add more meter types, but they should all behave the same from the controller’s point of view. Now, there’s a FB_GridControl block that needs power data from these meters. I see two options here: Define the meter blocks inside FB_GridControl and call them directly (for example fbModbusMeter.UpdateModbus()). Keep the meter blocks outside and pass them into FB_GridControl as interface references, so the control block doesn’t know which specific type of meter it’s dealing with. Option 2 feels cleaner and more flexible to me, but I’m not entirely sure how to handle the data flow in that case. Should I pass the meter instance through an interface reference (REFERENCE TO IF_EnergyMeter)? Or is there a better way to link the external FBs to the control block? I’d like to hear how you structure this kind of setup or see an example from someone who has done something similar. EDIT: I think i need to do something like this fbModbusUpdateInput(wInput:= wWordValue); fbMqttUpdateInput(strInput:= strStringValue); IF bUseMqtt THEN Meter REF = fbMqttUpdateInput; ELSE Meter REF = fbModbusUpdateInput; END_IF fbControl.SetMeter(UsedMeter := Meter); Or am i thinking wrong? Thanks, Thomas
Last updated: 2025-10-16
Post by steven-schalm on Github Actions CI/CD tasks - development topic
CODESYS Forge
talk
(Post)
hello kevinrn, I've been looking for a solution to the CI/CD issue for a long time. Briefly about me... I am 32 and software architect for Codesys V3 and fullstack dev for web (VueJS, NestJS) in a small company in Erfurt (Germany). https://www.rex-at.de/. Through my web part, we already have CI/CD running well via GitLab (YAML-based configuration file (.gitlab-ci.yml), which defines which pipelines and jobs are executed when certain events occur) with everything you know. Stages for npm packages - prepare (GitVersion, npm install or whatever) - build (vite, tsc or whatever) - testing (vitest, jest or whatever) - deploy (npm packages) And similar for monorepo's or backend services (in NestJS) as DockerImages. For Codesys we have been building an OOP framework for years (~50 libraries now), which is currently managed via SVN and a specially written Svn-Watcher (in Python) gets commits and runs and builds everything together and deploys it to an FTP server and network drive. Why do we still have SVN? Because we are unfortunately still tied to the safety integration of Codesys and can therefore only go to SP15 at most with our controller/Eckelmann. But soon there will be an update and there will be no more obstacles to using Git. Hence my questions: 1. the basic idea is to run a local Windows Runner on some machine? 2. install Codesys on the machine where the runner is running? 3. powershell & python scripts are then used to execute builds (compile, build, sign libraries) & deploys? 4. can the Github action also be used in GitLab? ChatGPT has already told me that it's not the same, but it doesn't hurt to ask. Do you have any ideas on this? Greetings :D
Last updated: 2024-08-20
Post by anonymous on Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part. I am able to capture the received data of client side in wireshark But unable to capture it on the codesys
CODESYS Forge
talk
(Post)
Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part.I am able to capture the data of client side in wireshark but i am unable to capture it in the codesys. Heres the below part of code of client side. PROGRAM POU_udpclient_program VAR istep : INT := 1;//step variable for state machine xStart: BOOL;// Flag to start the UDP protocol iecSocketId: syssocket_interfaces.RTS_IEC_HANDLE;//socket handle for receiving iecCreateResult: syssocket_interfaces.RTS_IEC_RESULT; ipAddr: syssocket.SOCKADDRESS;//Socket address structure for receiving sIpAddress : STRING := '192.168.0.2'; wPort: WORD:= 12346; iecConnectResult : syssocket_interfaces.RTS_IEC_RESULT;//connect paramters sDataRec : STRING[255];//Buffer for received data xiRecBytes : __XINT;//number of bytes received iecRecResult : syssocket_interfaces.RTS_IEC_RESULT;//receive data parameters iecCloseResult : syssocket_interfaces.RTS_IEC_RESULT; END_VAR syssocket.SysSockInetAddr(sIpAddress,ADR(ipAddr.sin_addr)); ipAddr.sin_family := syssocket.SOCKET_AF_INET; ipAddr.sin_port := syssocket.SysSockHtons(wPort); CASE istep OF 1: //create socket IF xStart THEN iecSocketId:= syssocket.SysSockCreate(syssocket.SOCKET_AF_INET,syssocket.SOCKET_DGRAM,syssocket.SOCKET_IPPROTO_IP,ADR(iecCreateResult)); IF iecSocketId = syssocket_interfaces.RTS_INVALID_HANDLE THEN xStart := FALSE; istep := 1; ELSE istep := 2; END_IF END_IF 2: //connect to socket server using setoption iecConnectResult := syssocket.SysSockSetOption(iecSocketId,syssocket.SOCKET_SOL,syssocket.SOCKET_SO_REUSEADDR,ADR(ipAddr),SIZEOF(ipAddr)); istep := 3; 3: //receive data xiRecBytes := syssocket.SysSockRecvFrom(iecSocketId,ADR(sDataRec),SIZEOF(sDataRec),0,ADR(ipAddr),SIZEOF(ipAddr),ADR(iecRecResult)); istep := 4; 4: //close socket iecCloseResult:= syssocket.SysSockClose(iecSocketId); xStart := FALSE; istep := 1; END_CASE
Last updated: 2024-06-03
Post by george32 on Readable IO names
CODESYS Forge
talk
(Post)
Hello Folks, I have a quite basic understanding of how PLC programming works. However I keep getting stuck on 1 problem I could not get my head around. The problem is as follow: I have a PLC with 60 IO (20 inputs, 40 outputs). Each IO is defined as a function block. Furthermore I have an external IO card connected trough a CanBus connection. This IO card has 4 analog input channels (USINT), 4 digital inputs (Bool) and 4, digital outputs (Bool) Because I have 2 different components which both has data have I made 4 arrays to store the data off every component in one variable. PLC_Input: Array [1..20] of BOOL; PLC_Output: Array [1..40] of BOOL IOCard_Input: Array [1..8] of BOOL IOCard_Output: Array [1..4] of BOOL Because the control and reading of the different in and outputs is done by a TCP connection I want to use some kind of enumeration or struct to give each index a name so that my main would be a little bit more readable instead of all the magic numbers. Also this would make my program more dynamic for the furter in case I need to changes some in the IO nummers. For example: pump is placed on the fysical terminal strip number place 54, which is the 3th output of the IO card in the program: if I am sending a message with value 54 I would like to control IOCard_Output[3]. If there is a solution or methode to get this done, I can eventually do the following in my main program: IOCard_Output[Pump]. I have tried the following: IOCard_Output[Pump - 51] with an enumration but this keeps raising an error I hope some of you could help me further with this problem. In gross lines: I want to couple all the different IO to a more readable name and this readable name should control the right Array index Thanks in advance, George
Last updated: 2024-09-26
Post by jonasz on Device diagnosis ( EtherCAT IO card )
CODESYS Forge
talk
(Post)
Hi, I'll link to the topic not wanting to start a new one. In the application I am building, I wanted to use the diagnostics described in the CAA Device Diagnosis library. In principle, everything is ok, except for the elements related to ModbusTCP. Despite the fact that ModbusTCP is taken into account in the documentation, it is not recognised via the interfaces. FUNCTION_BLOCK NET_HW_DIAG VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR (* Referencja do struktury z danymi dla HMI ASTRAADA.*) Visu: REFERENCE TO VISU; (* Wskaźnik na mastera EtherCAT.*) pEtherCATMaster : POINTER TO IoDrvEtherCAT; (* Wskaźnik na slave EtherCAT.*) pEtherCATSlave : POINTER TO EtcSlave; (* Interfejs dla węzła w drzewie urządzeń.*) _itfNode: DED.INode; (* Ogólny interfejs magistrali. Zapewnia podstawowe informacje o magistrali polowej.*) _itfBus: DED.IBus; (* Interfejs urządzenia. Zapewnia rozszerzone informacje o urządzeniu (magistralowym).*) _itfDevice2: DED.IDevice2; (* Ogólny interfejs magistrali. Zapewnia podstawowe informacje o magistrali polowej.*) _itfStack: DED.IStack; (* Numer węzła w drzewie urządzeń.*) uiNodes: UINT; (* Operator jest rozszerzeniem normy IEC 61131-3. W czasie wykonywania operator wykonuje konwersję typu odwołania do interfejsu na inny typ. Operator zwraca wynik BOOL. Wartość TRUE oznacza, że CODESYS pomyślnie wykonał konwersję. *) xQueryResultBus: BOOL; xQueryResultDevice2: BOOL; xQueryResultStack: BOOL; (* Struktura danych dotyczących węzłów w drzewie urządzeń.*) NetHwDiag: NW_HW_STAT; ModbusTcpClientDeviceInfo: IoDrvModbusTCP.DED.DEVICE_INFO; ModbusTcpClientDeviceState: IoDrvModbusTCP.DED.DEVICE_STATE; ModbusTcpDeviceInfo: IoDrvModbusTCP.DED.DEVICE_INFO; ModbusTcpDeviceState: IoDrvModbusTCP.DED.DEVICE_STATE; END_VAR (* Pobranie wskaźników dla pierwszego mastera i pierwszego slave w sieci EtherCAT.*) pEtherCATMaster := g_pFirstMaster; pEtherCATSlave := pEtherCATMaster^.FirstSlave; (* Diagnostyka sieci EtherCAT.*) pEtherCATMaster := g_pFirstMaster; pEtherCATSlave := pEtherCATMaster^.FirstSlave; NetHwDiag.xConfigFinished := pEtherCATMaster^.xConfigFinished; NetHwDiag.xDistributedClockInSync := pEtherCATMaster^.xDistributedClockInSync; NetHwDiag.xError := pEtherCATMaster^.xError; NetHwDiag.xSyncInWindow := pEtherCATMaster^.xSyncInWindow; NetHwDiag.sLastMessage := pEtherCATMaster^.LastMessage; NetHwDiag.LastError := pEtherCATMaster^.LastError; (* Diagnostyka drzewa urządzeń.*) uiNodes := 0; _itfNode := DED.GetRoot(); REPEAT NetHwDiag.asDeviceName[uiNodes] := DED.GetDeviceNameString(itfNode := _itfNode); xQueryResultBus := __QUERYINTERFACE(_itfNode,_itfBus); IF xQueryResultBus THEN _itfBus.GetBusInfo(buiInfo := NetHwDiag.aBusInfo[uiNodes]); NetHwDiag.aBusState[uiNodes] := _itfBus.GetBusState(); END_IF xQueryResultDevice2 := __QUERYINTERFACE(_itfNode,_itfDevice2); IF xQueryResultDevice2 THEN _itfDevice2.GetDeviceInfo(deiInfo := NetHwDiag.aDeviceInfo[uiNodes]); NetHwDiag.aDeviceState[uiNodes] := _itfDevice2.GetDeviceState(); IF pEtherCATSlave <>0 THEN pEtherCATSlave^(); IF pEtherCATSlave^.SlaveAddr = NetHwDiag.aDeviceInfo[uiNodes].idSystem THEN NetHwDiag.aAlStatus[uiNodes] := pEtherCATSlave^.ALStatus; pEtherCATSlave := pEtherCATSlave^.NextInstance; END_IF END_IF ELSE xQueryResultStack := __QUERYINTERFACE(_itfNode,_itfStack); IF xQueryResultStack THEN _itfStack.GetDeviceInfo(deiInfo := NetHwDiag.aDeviceInfo[uiNodes]); NetHwDiag.aDeviceState[uiNodes] := _itfStack.GetDeviceState(); END_IF END_IF uiNodes := uiNodes + 1; _itfNode := DED.GetNextNode(_itfNode); UNTIL _itfNode = 0 END_REPEAT (* Diagnostyka Modbus.*) Modbus_TCP_Client.GetDeviceInfo(deiInfo := ModbusTcpClientDeviceInfo); ModbusTcpClientDeviceState := Modbus_TCP_Client.GetDeviceState(); PAC_3200T.GetDeviceInfo(deiInfo := ModbusTcpDeviceInfo); ModbusTcpDeviceState := PAC_3200T.GetDeviceState(); Of course, you can take the easy way out and refer directly to the devices, but I wanted a reusable component. Any constructive help is very welcome Best regards Jonasz
Last updated: 2025-07-15
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.