Post by garrian on How to sort JSON object in codesys
CODESYS Forge
talk
(Post)
Hi there, I'm testing out MQTT from my Wago PLC using JSON object. I have managed to publish this {"Temperature":15.6,"Setpoint":38.0} to my broker. Now I', trying to subscribe to the same message. The result is this: '{"Temperature":15.6,"Setpoint":38.0}95}ê$10šå$04$Nå$08²Ÿå$0B` á$08@šå' First, why do I see 95}ê$10šå$04$Nå$08²Ÿå$0B` á$08@šå' at the end of the message? Second, how Can i sort out this data to use it in my program? I followed a youtube tutorial which gave me the attached result, which works. But I need some other smart way of doing this when the object gets even more data in it. Any help is very appreciated :)
Last updated: 2024-05-04
Post by peterned on Programatically restart Codesys OPC UA server?
CODESYS Forge
talk
(Post)
Hi, I'm using a Festo Codesys PLC (CPX-CEC-C1-V3), which is connected to a HMI panel. Both exchange data via OPC UA. Occasionally, the HMI stops displaying data, and looks as if there is no connection. If the HMI stops, the only way to make it work again is to restart the PLC. Restarting HMI has no effect. When the PLC is restarted, HMI starts working normally again. Is it possible to restart the OPC UA server from PLC code? I hope this will make fixing the HMI possible without a PLC restart. Thanks
Last updated: 2024-07-19
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 dawidr on Best practices for querying multiple MODBUS devices
CODESYS Forge
talk
(Post)
Hi! What are the best practices for querying multiple Modbus devices? Single PRG or maybe multiple PRG (so basically multiple thread) per each Modbus device. In my current implementation I'm using single PRG and I'm utilizing FbMbMasterMultiQuerySerial and WagoAppPlcModbus.FbDigitalTwinMbSlaveDevice in eCockpit with PFC200. I've the timer with 2 seconds delay there and it was working fine for single device. But now I have three Modbus devices and for two of them I need to run 2/3 queries to get data from all registers. I noticed that the delays for getting the data from the Modbus devices is much bigger right now.
Last updated: 2024-07-31
Post by expertplas on No connection to opc server from codesys opc client
CODESYS Forge
talk
(Post)
Hello, we have aproblen to connect our CODESYS OPC Client to the OPC Server. We installed the client according the CODESYS manual. We can browse the server and variables can be linked to the PLC. I created a self signed certificate for the CmpOPCUAClent as described. The server has a cerificate also. I copied the certificates to the trusted zone of server and client. But when it comes to data exchange we get an error message. "Communication error in data source OPC UA Library. Error ID : 7001 German : "Kommunikatinsfehler inder Datenquelle OPC UA -Bibiothek. Es wurde kein genauer Fehler angegeben. Fehler ID : 7001" It semms that there is no cerificate exchange. We are working with CODESYS 3.5 SP19 Patch 5. Can anyone here say something about this error or has an idea for a solution? Thanks.
Last updated: 2024-08-19
Post by trent on Automation server - trends stop recording - need to manually reconnect
CODESYS Forge
talk
(Post)
Hi All, I use the analysis page in automation server to capture historical trends from my PLC - i only sample one point per hour but it does the job (for now) One issue I have is I often log on to analysis page to find the system has stopped recording trends from my PLC. To fix this, I need to choose "state information" in the "List view" under PLC and click "Reconnect" When I do this I see my variables listed under "parameters" under "PLC Details" start updating again and the trend in Data analyzer continues to update. My Question, Why do I need to manually reconnect? Is there a way to get automation server to automatically reconnect to the PLC so I continue to capture data from the PLC? Regards, Trent
Last updated: 2024-10-22
Post by struccc on HTML5 Controls - string(>80) values
CODESYS Forge
talk
(Post)
Dear all, does anyone have experience with HTML5 controls recently? CODESYS 3.5.20.30 / Visualization 4.6.0.0 I'd like to create a simple lightweight text editor, with proper multiline handling, cut & paste, scrolling, etc. And it seems to work fine, just have problems with strings longer than 80 bytes.... Declaring a variable sText1 : STRING(8000) and referencing it in the HTML5 Controls corresponding value property works perfectly one way: the code receive the data as a string (See log1)... (Note TypeID 1000...) Also sending back the data (seems to work (See log2) except it doesn't change the value of the bound variable. Probably the issue is with using SendSimpleValue method... Naturally, I could do a workaround, but maybe there is a more standard way to implement this... Please let me know if you have any suggestions.
Last updated: 2024-10-23
Post by anhkdv on Data storage and Export in Codesys
CODESYS Forge
talk
(Post)
I am doing a SCADA project on temperature and humidity monitoring system. The customer requested that we store the database through codesys without the need for intermediary software such as MySQL, MSSQL,... and be able to export reports at selected times, reports exported to csv files. , xslm,... Can anyone help me?
Last updated: 2023-10-29
Post by leon78 on Codesys 3.5 SP17 Patch 2 CheckBounds (POUs for Implicit Checks)
CODESYS Forge
talk
(Post)
Unfortunately, it was fixed in SP19, but I need SP17 CDS-82162 Bug Compiler: Checkbounds is not working for dynamic arrays with VAR_IN_OUT as index access Fixed [[GENERAL]] Compilerversion >= 3.5.19.0 https://de.codesys.com/fileadmin/data/Images/System/Releaseinformation/Release-Notes-CODESYS-35190.html
Last updated: 2023-11-16
Post by seesle on Extracting information out of a *.library or *.compiled-library file
CODESYS Forge
talk
(Post)
Hey there, is there a way to extract any data out of a .library or a .compiled-library file? Do you have any tools or a description of the binary or something like this to get for example the referenced libraries of a *.library file or any other stuff? Thx in advance M.
Last updated: 2023-12-04
Post by talhaali on Adding a variable from text list into ST code
CODESYS Forge
talk
(Post)
Hi, can I use a entry of a text list as variable in structured text? for example in attach picture, if i use want to use data of first row. I am trying to write: A : STRING := TextList.Default.0; but it is not workings
Last updated: 2023-12-07
Post by talhaali on Adding a variable from text list into ST code
CODESYS Forge
talk
(Post)
Hi, can I use a entry of a text list as variable in structured text? for example in attach picture, if i want to use data of first row. I am trying to write: A : STRING := TextList.Default.0; but it is not workings
Last updated: 2023-12-07
Post by davidbo on i2c How does CODESYS handle exception or error messages.
CODESYS Forge
talk
(Post)
For Raspberry Pi I have made a python script which regularly read a bulk of data over the ic2 from a device. Sometimes I get an Exception an IOError. I assume similar things can happen in CODESYS. So how does CODESYS handle that? Can I get any info about such an event?
Last updated: 2024-02-07
Post by reinier-geers on SysFileOpen does not work after update to V3.5 SP19 Patch 5
CODESYS Forge
talk
(Post)
At 19.1 the hFile_test should be RTS_IEC_HANDLE and always open-write - close in one cycle udi_handle: RTS_IEC_HANDLE; //handle-number. Is created by SysFileOpen udi_handle:=SysFileOpen(sFileName,Sysfile.AM_WRITE_PLUS, ADR(udi_ErrorCode)); udi_RetValWrite:=SysFileWrite(udi_handle, pRemBuffer, szRemBufSize, ADR(udi_ErrorCode)); //closing file IF udi_RetValWrite < szRemBufSize THEN ui_Error:=cWriteError; END_IF//error writing data udi_ErrorCode_Close:=SysFileClose(udi_handle);
Last updated: 2024-02-19
Post by i-campbell on Not able to see input data coming from eip adapter on codesys
CODESYS Forge
talk
(Post)
Hello, I think you can try to change the Connection from Multicast to Point to Point. Please also make sure your windows firewall is allowing the correct UDP ports inbound for ethernet IP. You might also need to increase the RPI, so it times out slower.
Last updated: 2024-03-07
Post by rjonker on codesys mqtt publish serialization
CODESYS Forge
talk
(Post)
pbPayload is a pointer, which it expects to point at a STRING. If you point it at an address holding a different data type, it will just assume those bytes are part of a string and likely trundle along memory until it finds a null byte (0x00) that would normally signify the end of a string PublishMessage := BOOL_TO_STRING(boolVariable);
Last updated: 2024-06-05
Post by mos89p on how to use UseDataExpanding() in datasource
CODESYS Forge
talk
(Post)
Hi I need to update by software some structures in my datasource, i found this example: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_update_data_interface.html it seems that because i use complex variable structure i need to use UseDataExpanding() instead of use data, the question is how to get an instance of IDatasourcesMgr3 i have the global variable g_Datasources is instantiated automatically
Last updated: 2024-06-18
Post by koppit on SysComRead Timeout Parameter
CODESYS Forge
talk
(Post)
Im using SysCom ver. 3.5.17.0 and seem to have the same issue on a Raspberry Pi. It's not waiting for the requested number of bytes, no matter if "ulTimeout := SYS_INFINITE" or any other value. The only solution I have found is to stall the program to allow the serial port to recieve the data.
Last updated: 2024-06-26
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 janber on REFERENCE TO in an array
CODESYS Forge
talk
(Post)
Hi all, in the online help it written, that array of reference to data type is not possible. Ok... but if I create array of struct of reference to - everything works fine - please see the screenshots: and it works this way OK. Is it intention or error in compiler 3.5.18.20 and we should avoid it? Thanks a lot, Jan.
Last updated: 2024-10-14
Post by yr00 on OPC UA datasource low read frequency
CODESYS Forge
talk
(Post)
Hello everyone, I am trying to test the OPC UA client feature in Codesys. My setup is the following; I have a Codesys simulation/ visualization running on Control Win V3. My OPC UA server is hosted on a Siemens 1518 PLC using PLCSim Advanced. The setup is completely virtual so there are no really PLCs. Everything is on my laptop. Writing data from the Codesys simualtion to the server is very quick. I have a PLC program running on another 1500 PLC which reads data from simulation via the server, and changes in the simulation (e.g. button pressed) appear within hundreds of miliseconds if not tens of miliseconds in my PLC program. However, when it comes to reading data from the OPC UA Server by Codesys, it taks around 1-2s. I connected a UAExpert client and it gets update very quickly so I am fairly sure the problem is with Codesys. I have tried changing the update rate in datasource -> General and Diagnosis, but it doesn't seem to have an effect. Do you guys have any suggestion on what I can do?
Last updated: 2023-08-29
Post by egret on Issue with J1939, PGN 65267 (Vehicle Position)
CODESYS Forge
talk
(Post)
I have a J1939 network (ISOBUS) connected to my PLC. I can receive various PGNs such as 65256 (Vehicle Direction/Speed) and 65254 (Time/Date). However, I cannot receive 65267 (Vehicle Position). PGN 65267 (VP) contains SPN 584 (Latitude) and SPN 585 (Longitude). On the network both SPNs return a value of -210 (meaning the CAN message payload is zero in both cases). The conversion settings are the default values and appear to be correct (see attached screenshot). Using a CAN analyser I can see that PGN 65267 (Vehicle Position) is being transmitted over the network with valid (non-zero) data that matches the latitude and longitude coordinates I would expect. I've created a program to read the raw J1939 data and this also returns valid data. It seems that the Codesys J1939 database has a problem with reading PGN 65267 messages. Can anybody else confirm this? I'm using Codesys Version 3.5 SP16 Patch 5.
Last updated: 2023-09-13
Post by andrej on Write to File on soft PLC winV3x64
CODESYS Forge
talk
(Post)
Hello all, I would like to store some data in text file. I use the soft PLC Win V3x64, on Windows 10. I use the SysFile Library 3.5.17.0. If I store the file directly in the in the directory of the PLC i.e. in '/CODESYSControlWinV3x64/E1FA7ABE/PlcLogic/LogAU.txt' the file is correctly filled with the data. However, If I use an absolute path to a different directory no data is stored in the respective file. Despite the fact that the respective file exists and the Filehandler is correctly opened (see in picture _fdSysFHandle <> -1). // sFileName : STRING := 'LogAU.txt'; // STORES FILE IN ../CODESYSControlWinV3x64/../PlcLogic/LogAU.txt' sFileName : STRING := 'C/Temp/LogAU.txt'// DOES NOT WORK --------------------- // FILE DESCRIPTOR _fdSysFHandle := SysFile.SysFileOpen( szFile:= sFileName,am:= SysFile.AM_APPEND,pResult := ADR(_Result)); Does some have an idea where the problem is, resp. how I can get store a file in an arbitrary directory. Thanks a lot and kind regards Andreas
Last updated: 2023-10-24
Post by arundara on Variable Sync Issue In Soft Plc Redundancy
CODESYS Forge
talk
(Post)
Hello, I was trying to create a redundancy POC for our application where we read data from few modbus tcp devices. As there is a limitaion that modbus tcp device support only for single master device, we wanted to test how the variable sync happens in redundancy mode. For that i have used the redundancy sample code added a variable "b" under a condition. What i observed was while active controller is running, if passive controller is powerup, passive controller is able to sync all the data configured for redundacny. But after that the variable data which resided under a condition is not synching from active to passive controller. I have attached the image where i have highlighter the variable. Can some help me to understand how redundacny work in codesys soft plc and if there is a solution to sync variable which are under condition, please explain the same or suggestion to achieve the same. Hardware - Raspberry Pi (2 qty) Redundancy licence used - yes in both controllers. Codesys runtime - 4.9.0.0 Codesys software version - V3.5 SP19 if i have posted this question in wrong section, please do let me know in whcih section i have to post this question.
Last updated: 2023-12-01
Post by kevinrn on Github Actions CI/CD tasks - development topic
CODESYS Forge
talk
(Post)
Hello community, I just want to inform you about our plans and the current status of automating the build process for CODESYS libraries. So it might be helpful for some people who are in the same situation. Background story: I am a software engineer at powerIO GmbH, normally I use high level languages for the products we develop and offer. Sometimes I work with my team on CODESYS libraries, which can also be found in the CODESYS store. Most of the time I spend with them on architecture tasks and tasks that are not directly related to our products. Every time I see the manual processes for releasing a library etc., I am very surprised about this time intensive process. Current situation: I know there has been a scripting interface for years. CODESYS Git was released a few years ago, but the scripting interface was only released a few months (weeks?) ago. We developed a pseudo-automated solution a few months ago, but it was all very hacky. So now there is a better Git implementation and also more modularization and installation options. For example, the CODESYS installer has a full CLI, which makes it very convenient to install CODESYS installations headless. Plans: I think it's the right time to develop a better automation solution. Most of our software projects are hosted on Github and we use Github actions very intensively for other software projects. Therefore, we have decided to use Github for our CODESYS library projects as well. Following tasks should be implemented in automation for CI/CD tasks: - Automated setup of CODESYS installation (Already released: https://github.com/marketplace/actions/setup-codesys-installation) - Checkout CODESYS libraries - Execute tests scripts - Sign CODESYS libraries - Extract Library documentation - Create CODESYS package - Sign CODESYS package Side Note: - This is mainly a side project, and we do not provide support for the CI/CD part. - This topic is here to help and also to get help from other software engineers. - This project and idea is not prioritized as I am currently the only one working on it and I hope it will help us and also others and increase productivity. - We are putting this out there as an organization, but priorities can change quickly and the CI/CD tasks I am developing are mostly done in my spare time. So please don't expect this to happen in a short time or even be fully completed. I would be very happy if some ppl will join the development process and might be open to discuss some technical details for this. I hope this topic is not to off-topic, but I think the CI/CD part is very important today and it can increase a lot of quality and push productivity. Thanks :)
Last updated: 2024-03-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
.