Post by davidbo on Modbus: Is there a way to get the channel index from the channel name?
CODESYS Forge
talk
(Post)
When I use the FUNCTION_BLOCK ModbusChannel I have to sepcify the integer iChannelIndex It can easily go wrong if one has many channels. It would be better if one could use the name. Is that possible? Attached a snippet of the channel name and the channel index to the left.
Last updated: 2024-10-21
Post by spoun on Problem with edge gateway config mode
CODESYS Forge
talk
(Post)
I installed patch 3 now and i get a new message, although i located and modified the files in system32 and sysWOW64 still doesn't work. One thing i noticed is thta in system32 folder CODESYSGatewayV3 now i have two different XXXXXXXX files with the latest being created today at the time of installation
Last updated: 2024-10-21
Post by pascaljt on Warning code C0373
CODESYS Forge
talk
(Post)
Hello, I wrote a function block for a controller but I have a warning code C0373 "expression or part of it has no effect" and the sub routine which contain my function block is underlined in blue. Despite, the FB works perfectly. Do you know why I have this warning ? Thanks. Pascal.
Last updated: 2024-10-30
Post by jeroenaero on CodeSys Raspberry pi I2C driver not found
CODESYS Forge
talk
(Post)
yes i took the library from another forum: https://forge.codesys.com/forge/talk/Runtime/thread/f1400b71b6/, it is made for the ads1115 but the ads1015 is almost the same device with same adresses i only changed the divide value of the analog value, because thats the only difference between the ads1115 and ads1015.
Last updated: 2024-11-07
Post by jeroenaero on CodeSys Raspberry pi I2C driver not found
CODESYS Forge
talk
(Post)
okay, the weird thing is the driver is only continuous running when i enable debug output. if debug is not enabled it's continuous switching from running to not running. i will check again and download the libraries Which versions of libraries do you use, can you send a screenshot?
Last updated: 2024-11-08
Post by andrax on CodeSys Raspberry pi I2C driver not found
CODESYS Forge
talk
(Post)
I took a look at your project. First of all, a Raspbery Pi4 is installed. You must use the GPIOs_A_B(GPIOs B+/Pi2). The error ULINT can't be set to IDINT.... with your project as well. If I change your project to ‘CODESYS_Control_for_Raspberry_Pi_SL’ the error is gone.
Last updated: 7 days ago
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: 5 days ago
Post by timvh on Leitungsverzweigung mit einem existierenden Block (z.B. AND-Glied) zu verbinden
CODESYS Forge
talk
(Post)
If you are really happy with PLCnext engineer, then just use that. There is probably also something in CODESYS that cannot be done in PLCnext engineer. But if you are forced to make something like this in CODESYS, then maybe just use CFC instead of FBD.
Last updated: 5 days ago
Post by cdutz on Problems connecting to Codesys 4.9.0.0 runtime on my Wago PFC200
CODESYS Forge
talk
(Post)
Turns out I managed to get a connection to my PLC. It seems that a few weeks ago Wago released something with version 4.3.3(25). So I reset my PLC to Factory-Reset, set it to the 192.168.1.17 IP and changed the IP to the one I wanted with the Wago EthernetSettings tool. Then updated the latest firmware using the WAGOupload tool. Now the PLC came back up without a PLC runtime running, so in the Web-tool I wen't to the "Configuration"/"PLC Runtime" and selected the runtime version "CODESYS V3". I uninstalled all Codesys versions and installed the version from the download package of Wago together with all the packages the bundle provided. After creating a new project I didn't select the old PFC200 runtime, but one of the dozens of new device profiles, that it now listed. With these settings I was then able to connect to my PLC. Now I hope I'll get the existing project that I had ported to this new structure. Sorry for the noise. Chris
Last updated: 2023-08-26
Post by danwoodlock on RPI Zero w - Edge gateway cant install
CODESYS Forge
talk
(Post)
Hello all, First post. I recently acquired an RPI zero W from amazon, and have been using it with Codesys v3.5 SP19 patch 2. I first got it working yesterday, and after installing the runtime on the Pi, I was prompted to install the edge gateway. Installation of the edge gateway failed because of unsupported architecture, undeterred I was able to connect to the pi and program as I wanted. The issue I've noticed is that if I do not load anything to the pi overnight, I can then no longer connect to the pi and download, although I can still ping it from my pc. I found that if I power cycle the PI, I am then able to connect again, and it works as normal. I did some googling and found instances where people recommended downloading the newest edge gateway, which brings me here. Wondering if there are any suggestions, or if this is a known issue. I actually tried installing all 3 versions of edge gateway for science, but all fail with the same message. Thanks -Dan
Last updated: 2023-09-13
Post by sturmghost on Initialization of visualization variables and cyclic code execution
CODESYS Forge
talk
(Post)
I'm looking for a smart and short way to implement initialization of visualization variables depending on the visualization input. For an easy example consider a rectangle which rests at XPos := 0 when the input state is false and at XPos := 50 when the input state is true. My visualization variables look like this: VAR_IN_OUT State : BOOL; END_VAR VAR XPos : INT; END_VAR I put this rectangle via a visualization frame element into another visualization and link a frame reference variable with the state to it. If the variable is true, the rectangle should rest at XPos := 50 and false at XPos := 0 at visualization init but how should I assign the 50 or 0 to the internal visualization variable XPos? I would need some init-methode for the visualization but I dont want a global init-method for such tasks. I want to do it inside of the visualization element but I can't see any solution for this? It would be good to be able to define ST-code within the visualization element which runs cyclic at each VISU_TASK task-cycle then I could just check the input state and change the XPos accordingly. Does someone have a solution?
Last updated: 2023-10-01
Post by user3000 on Can't find an Extended Pulse Timer (TP and LTP)
CODESYS Forge
talk
(Post)
Hello, For my program I need an extended pulse timer, which can be referred to as a retriggerable pulse timer. Where every rising edge of the input resets the elapsed time zero, extending the lenght of the output pulse. The Codesys pulse timer (TP) is a one-shot timer and only resets the elapsed time with the falling edge of the input. There is also a pulse timer (LTP) in codesys, but in my simulation it was also functioning as a one-shot even though the description sounds like LTP should be retriggerable. I have uploaded some timing plots from another PLC program for reference. I am looking for a timer equivalent to the "TEP" diagram. Is there an Extended Pulse Timer in Codesys? Maybe there is a way to manipulate the input so it resets the elapsed time outside the function block?
Last updated: 2023-12-06
Post by ragarcia on Error while using UpdateConfiguredIPSettings to change IP address
CODESYS Forge
talk
(Post)
Hello everyone, I am trying to change dynamically by code the IP address of a Weidmuller controller. So I am basically using IoDrvEthernet library to use UpdateConfiguredIPSettings function but I am getting constantly the 'INVALID_STATE' error. Even though I am following a procedure it should work: * First I added on the config file of codesys the following: [SysSocket] Adapter.0.Name="eth0" Adapter.0.EnableSetIpAndMask=1 Adapter.1.Name="eth1" Adapter.1.EnableSetIpAndMask=1 * Secondly I am first disabling the ethernet interface by using Ethernet_0.Enable = FALSE and then executing DED.Reconfigure. After that, I run the Ethernet_1.updateConfiguredIPSettings Code: Ethernet_1.Enable:= EnableDisable; Reconfigure(xExecute:= TRUE, itfNode:= Ethernet_1, xError=> ErrorReconfigure, eError=> ErrorCodeReconfigure); IF Reconfigure.xDone THEN ErrorCodeIP:= Ethernet_1.UpdateConfiguredIPSettings(IPAddress:= newIP, SubnetMask:= newMask, Gateway:= newGW); END_IF IF Reconfigure.xDone OR Reconfigure.xError THEN Reconfigure(xExecute:= FALSE); END_IF Ethernet_1.Enable:= TRUE; Reconfigure(xExecute:= TRUE, itfNode:= Ethernet_1); IF Reconfigure.xDone OR Reconfigure.xError THEN Reconfigure(xExecute:= FALSE); END_IF Can someone help me? Thank you. All I am trying is to find a way to change dynamically with code, the IP addresses of my controller (2 ethernet ports).
Last updated: 2023-12-11
Post by forest on SM Drive license error
CODESYS Forge
talk
(Post)
Hi, when it comes about license, I used INVTmatic Studio, which uses Codesys, for programming INVT plc. I bought Codesys Modbus license, it was not expensive, and then realised that INVT didn't have License Manager option (greyed out in program) which is needed for using of Codesys License. I contacted support from INVT, but developers told me that option is still not available. So depending on environment for programming Codesys, you can or not use Modbus license. Good thing about this version of Modbus TCP it works both direction. I could send commands and receive feedbacks from drive. But communication stops after 30 mins. So I used simple version of ethernet modbus which is somewhere in INVT or Condesys library (I can check tomorrow) which works only one way. I could send cmd to drive, and control it, but didn't have any feedback, like some readings back in PLC. which is bad, but at least I could start it and it didn't fail after 30 mins.
Last updated: 2024-01-10
Post by edepalos on Text list from sd card
CODESYS Forge
talk
(Post)
Hi guys, I have a textlist in my project which is working just as expected in a drop down list. I would like to move this text list to a sd card and access it from there, because I want to ease the editing of the contents of this textlist. I'm imagining a solution like the operator shuts down the plant, takes the sd card out, edits the textlist on the card with a windows machines notepad, then reinserts the card in the PLC and restarts the plant, having the new content of the textlist populating the dropdown list. I'm sorry that I'm asking you to spoonfeed me, but I did not find anything straightforward to do this... I saw in the Project>Project settings>Visualisation a relative path thingy, but I have the plant in operation and I would not like to make 100 trial and errors right now... I'm also not interested in SysLib file read commands and stuff, I would just like to access the file from the cards part, I don't want to replace its contents dynamically or such... nor I have language files or recipes... Thank You in advance! Br, Ede
Last updated: 2024-01-16
Post by levih on DocScripting
CODESYS Forge
talk
(Post)
Hello I'm trying to use the DocScripting collection in Codesys. I've made it work on one PC(1) for the 3.5.16.4 version of the script collection. But when I try the same setup on another PC(2), I get an error message: Error loading Python DLL: D:\SCRIPTING\3.5.16.40\python27.dll (error code 14001) My setup on both PC's is thus: 1. Downloaded and installed Python 2. Copied the folder with the scripting collection to C: (because of admin rights) 3. Placed my .library file in the same folder as the scripting collection Only difference is that Python is v3.12.0 on PC1 and v3.12.1 on PC2. I thought maybe it was something with Python, but then I have tried using the scripting collection from 3.5.16.1, and that seems to work. Just not for scripting collection 3.5.16.4. I also can't seem to find any scripting collections on newer versions of Codesys? (e.g. 3.5.19.10) Thanks in advance!
Last updated: 2024-01-22
Post by chalk on No source code available
CODESYS Forge
talk
(Post)
Hello, This is my first time using Codesys, I am trying to add EtherNetIP communication to a Raspberry PI. I’ve added the EtherNetIP Adapter configured the network setting and added some modules to the pi but when I download the project it generates the following error: “There is no source code available for the object because it is in the compiled library ‘cip object, 4.5.1.0 (3s – smart software solution gmbh)’. Do you want to browse for the original library in order to display the source code? There are 2 errors in the log which are: SOURCEPOSITION App=[Application] area=3, offset=332760 EXCEPTION [Application] occurred: App=[Application], Task=[ENIPAdapterServiceTask] I can’t for the life of me work out how to get around this. I can’t find the source code anywhere or any information regarding this error. I’m using Codesys V3.5 SP19 Patch 3, the version of the Ethernet adapter is 4.5.1.0 and the version of the modules is 4.1.0.0. Any help on this will be greatly appreciated. Thanks
Last updated: 2024-02-02
Post by timl on BacNet "Unaufgelöste Referenz"
CODESYS Forge
talk
(Post)
Hallo, ich habe Probleme beim nachbauen des BacNet2 Tutorials "Erste Schritte" aus der CODESYS Online Help. https://content.helpme-codesys.com/de/CODESYS%20BACnet/_bacnet_first_steps.html Das Anlegen des BacNet2 Servers und der danach folgenden BacNet Datenpunkte erfolgt ohne Probleme. Der Code lässt sich mit F11 auch Fehlerfrei generieren. Beim Download auf die SPS tritt dann der Fehler auf dem Bild auf. Anbei auch ein Bild des Logs nach dem Download. CODESYS BACnet 2.0.0.0 ist über den Installer runtergeladen. Device: CODESYS Control Win V3 x64 Version 3.5.19.40 CODESYS 3.5.19.40 Im Bibliotheksverwalter ist BACnet2 2.0.0.0 aufgeführt Die Konfigurationsdatei habe ich mit folgenden anpassungen abgespeichert: [ComponentManager] Component.1=CmpTargetVisuStub Component.2=CmpWebServer Component.3=CmpWebServerHandlerV3 Component.4=SysCpuMultiCore Component.5=SysReadWriteLock Component.6=SysCpuBreakpoints Component.7=SysPipeWindows ;Component.8=CmpHilscherCIFX ;Component.9=CmpPCANBasicDrv ;Component.10=CmpCANFoxDrv ;Component.11=CmpIxxatCANDrv ;Component.12=CmpBlkDrvCanServer ;Component.13=CmpBACnet Component.14=CmpBACnet2 [CmpBACnet2] ;configuration file of the BACnet stack IniFile=$PlcLogic$/bacstac2.ini ;task priority of the BACstack process task, default: TASKPRIO_NORMAL_END (159) TaskPrio=128 ;name of the named pipe for the communication with the BACstack AppName=/tmp/BACnetServer Habe ich etwas vergessen?
Last updated: 2024-02-16
Post by zoronoa on J1939.ReceiveWatchdog & J1939.ReceiveParameterGroup
CODESYS Forge
talk
(Post)
Hi, I'm trying to monitor a specific PGN which I have it sending a pulse every 500mS Problem: Using the Watchdog for the ECU does not really help me as I have multiple instances with separate PGNs, if a PGN goes ghost, the ECU watchdog won't be flagged as the others will be running. I found the J1939.ReceiveWatchdog & J1939.ReceiveParameterGroup function blocks and they seem like a good solution for my problem, I just can't get them to work from my understanding you just build the J1939.ReceiveParameterGroup once and then connect it's output to the J1939.ReceiveWatchdog, here's my CODE for the setup HEARTBEAT_TIMER(IN:= TRUE, PT:= T#1000MS); //turn-on delay because of initialization race IF HEARTBEAT_TIMER.Q= TRUE THEN Glob_Var.DisplayReceive.xExecute:= TRUE; Glob_Var.DisplayReceive.itfECU:= Valve_X; Glob_Var.DisplayReceive.dwPGN:= 65511; Glob_Var.DisplayWatchdog.xEnable:= TRUE; Glob_Var.DisplayWatchdog.itfParameterGroup:= Glob_Var.DisplayReceive.itfParameterGroup; Glob_Var.DisplayWatchdog.tTimeout:= T#1500MS; END_IF Notes: Glob_Var.DisplayReceive is of type J1939.ReceiveParameterGroup Glob_Var.DisplayWatchdog is of type J1939.ReceiveWatchdog The above code is done once and not cyclically I'm monitoring Glob_Var.DisplayWatchdog.xError cyclically
Last updated: 2024-03-13
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 kblundy on Change the Opening Position of the Dialog using VU.FbOpenDialog
CODESYS Forge
talk
(Post)
I hope the community can help me with this. I need to use the Visu Utils FbOpenDialog to control the opening and closing of a dialog. I have the Opening and Closing working, but I can’t get the dialogue's position to be controlled. The code looks like this: PROGRAM OPEN_DIALOG VAR xOpenLatchSettingDialog : BOOL; TopLeftDialog : VisuStructPoint ; fbOpenLatchSettingsDialog : VU.FbOpenDialog ; END_VAR IF xOpenLatchSettingDialog THEN xOpenLatchSettingDialog:= FALSE ; TopLeftDialog.iX := 100; TopLeftDialog.iY := 23; fbOpenLatchSettingsDialog(sDialogName := 'visu_AlarmLatchSettings', xExecute := xOpenLatchSettingDialog , xModal := TRUE, itfClientFilter := VU.Globals.OnlyTargetVisu, pTopLeftPosition := ADR(TopLeftDialog)); CloseVisuDialog(sDialogName:= 'visu_AlarmLatchSettings'); ELSE xOpenLatchSettingDialog:= TRUE ; IF fbOpenLatchSettingsDialog.xError THEN xOpenLatchSettingDialog := FALSE; END_IF END_IF I can't seem to work out a way to make the values in TopLeftDialog.iX and TopleftDialog.iY be passed correctly in the call and for it to change the position of the dialogue box. The code is compiled, but the position has not been changed. Any guidance or suggestions for revising this code would be incredibly valuable. Your insights could be the key to solving this issue.
Last updated: 2024-05-05
Post by sigurdrb on send appliaction files to wago plc (codesys 3.5) via ssh
CODESYS Forge
talk
(Post)
Hi, I was hoping I could send the two files "application.app" and "application.crc" directly to the directory "/home/codesys/PlcLogic/Application" instead of logging into the device with codesys, downloading the program to the controller and then do the "create boot application", so it will reboot with the correct program running. I think i also need to edit the file "eRUNTIME.cfg" located in the "/home/codesys/ folder, because when I create the boot application from the codesys IDE, these lines are added to the file: [CmpApp] Application.1 = Application [SysFileMap] /home/codesys/PlcLogic/Application/Application.app=0x212520, 0x2DBC747E, 2DBC747E.app I think the "eRUNTIME.cfg" file is the same as CODESYSControl.cfg I also dont know the purpose of the hexadecimal numbers etc. that is generated. When I tried to replicate what codesys was doing, I placed the same files in the same folder as when codesys generated the boot file. And also added the lines in the eRUNTIME.cfg file: [CmpApp] Application.1 = Application [SysFileMap] /home/codesys/PlcLogic/Application/Application.app The controller did not boot up with any program, so my method did not work at all. I guess these lines tells the controller to run an application and where to find it? Could any of you help me with the best way to get the compiled program to the controller without using codesys or wago-software?
Last updated: 2024-05-28
Post by xnoop on MBTCP Slave configuration
CODESYS Forge
talk
(Post)
Hello, I use Codesys 3.5 SP18 Patch 4 (64 bit) My Codesys project is composed of several dozen of Modbus TCP Slaves. I want to configure each of them by define : - Modbus TCP Slave Configuration : Name, IPAddress, port - Channels - Mapping I can't afford to configure manually and I need to find automatic way What possibilities does the Codesys offer? 1. I know it possible to use python script to create Modbus TCP Master and Slave. But I don't find anyway to create Channels and Mapping through the API 2. I 've tested to set mapping with file.csv on a Modbus Tcp Slave, but no way to import channels definition from file 3. I 've tried to use PLCOpenXml file. For example I 've create a project with an Ethernet device. I've exported it in PlcOpenXml file. After delete the Ethernet device, I've imported the PlcOpenXml file without success. I've tried the same by creating Modbus TCP Slave. Could you help me to find to good way ? Thanks
Last updated: 2024-06-19
Post by wbj0t on What the right way to update TCP/COM slave device holding registers
CODESYS Forge
talk
(Post)
Hi all :) I have an plc. This plc has option to be as slave device. There are TCP -> Serial Slave Device and COM -> Serial Slave Device. There are 4096 ModBus holding registers with mark "internal modify" for the both devices above. So, COM Slave has 4096 registers and TCP Slave has 4096 registers. And, finally, I have an ARRAY[0..4095] OF WORD. This array glued with COM Slave and TCP slave. Yes, I need plc's opportunity to be communication both TCP and COM ways for the same registers. For example, the next task structure: * TASK_0: 1. pou_READ_Registers 2. pou_0 3. pou_1 4. ... 5. pou_N 6. pou_WRITE_Registers At the first pou I read registers for the other pous, after job we have sort of state of the plc. At the last pou (6) we write modified registers. It is a good scenario: some one wrote registers for the job, after job we save these (modified) registers. But, what if registers wrote between 1 and 6 pou by operator, for example, at the 3 pou -> the last pou 'pou_WRITE' will rewrite this request from operator. What the right way to work with this logic? Thanks you.
Last updated: 2024-07-01
Post by denkihitsuji on Content update through Data URI on Web Brower on Visualization Toolbox
CODESYS Forge
talk
(Post)
Objective: I want to dynamically update the content with strings and JPEG images received from a TCP/IP socket. For this purpose, I am exploring the possibility of utilizing the Web Browser feature of the Visualization toolbox. Example: In a standard web browser, entering data:text/plain;charset=utf-8;base64,SGVsbG8gc3RyYW5nZXI= in the URL window will display "Hello stranger" on the webpage. Issue: When attempting to use this method in the Web Browser of the Visualization toolbox, the content does not display as expected. Instead, it shows the error:'Navigation to the webpage was canceled.'. Request: I seek guidance on how to resolve this issue so that the Web Browser in the Visualization toolbox correctly interprets and displays the data URI content. Alternative Solution Welcomed: Or, if it is possible to directly use Codesys Structured Text (ST) variables within an HTML page, this approach would also meet my requirements. Thank you for your attention.
Last updated: 2024-07-30
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
.