Post by hazarath on How extract JSONElement containing Array data
CODESYS Forge
talk
(Post)
I want to extract each element of an Array. Can someone help me with this. When I use JSONElementToString (part of JSON Utilities SL), I am seeing output as "ARRAY" instead of actual data. Here is the JSON content that I want to read : { "value1Unit": { "units": "M" }, "data": { "stepSize": 300.23, "points": [6,8] } } I would like to read each item of the element "points" i.e. 6 and 8. Here is the code I used, // Reading the content as JSON reader ( xExecute := execute , pwData := ADR ( converted_value ), jsonData := jsonDataStorage ); // Get the JSON Element jsonDataStorage.FindFirstValueByKey( wsKey := fidKeyVar, diStartIndex := searchElem, jsonElement => jsonElement ); JSON.JSONElementToString ( element := jsonElement , wsResult := valueWstring ); The content of the output of valueWstring is shown as "ARRAY" instead of the array items i.e. 6 and 8 Please can someone help me.
Last updated: 2024-07-30
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 abrarsk on SysCom Library Usage
CODESYS Forge
talk
(Post)
Hello all, I am facing issues with using SysCom library. With SysCom23 library things were simple but since we are migrating to 64bit systems, I am writing a Porting program. With SysCom23, opening the comport was as simple as providing the ComPort no. which returns the Handle as a DWORD. dwHandle:=SysComOpen(Port); But the new library is a bit different. It is asking for 2 input parameters to open the Com Port - Port Number and POINTER to RTS_IEC_RESULT IF hCom = 0 THEN hCom := SysComOpen(ComSettings.sPort, ADR(pResult)); How should I use the RTS_IEC_Result? I can find RTS_IEC-REUSLT under SysType2Interfaces of SysCom library. Also, can someone give me a general understanding of this RTS_IEC_REULT and RTS_IEC_HANDLE, etc.?
Last updated: 2024-08-05
Post by bernhardw on Probleme mit MC_HALT_SML und MC_STOP_SML
CODESYS Forge
talk
(Post)
Hallo … ich verwende: SoftMotionLight im Positions-Mode Ethercat-Bus Servoverstärker: Metronix BL4104-C . MC_HALT_SML funktioniert nicht zuverlässig (Achse fährt manchmal zu weit oder bis zum Softwareschalter) Ich habe festgestellt, dass intern beim Aufruf von Positions- auf Velocity-Mode umgeschaltet wird - und dann wird wahrscheinlich intern auf Drehzahl 0 abgeregelt. Kennt jemand dieses Problem? – der Wechsel der Betriebsart ja ist nicht verzögerungsfrei! MC_STOP_SML Der Baustein hat keinen Eingangsparameter "Deceleration" Die Achse stoppt und bleibt im Positions-Mode. Aber die Verzögerung ist nicht wie beschrieben: nicht "Objekt 6085h: quick_stop_deceleration" - sondern "Objekt 6084h: profile_deceleration" - aus zuvor aufgerufenem MC_MOVE_ABSOLUTE_SML Ich wäre dankbar für jeden Hinweis Gruß Bernhard
Last updated: 2024-08-05
Post by eguerra on Error in ScriptingEngine Docs - create_pou()
CODESYS Forge
talk
(Post)
In the ScriptingEngine documentation there seems to be an error (or missing information) in the ScriptIecLanguageObjectContainer part ( https://content.helpme-codesys.com/en/ScriptingEngine/ScriptIecLanguageObjectContainer.html#ScriptIecLanguageObjectContainer.ScriptIecLanguageObjectContainer ). The description of the function create_pou() doesn't specify the correct arguments requested, it only says create_pou(type: SpecialPouType) and a script using the documentation definition of the function will raise an error. I tried passing the function arguments similar to the ones specified for the create_dut() function and it seems to work fine: create_pou(name, PouType) , name : str UPDATE: The offline help has the correct definition IExtendedObject<IScriptObject> create_pou( string name, PouType type = PouType.FunctionBlock, Nullable<Guid> language = null, string return_type = null, string base_type = null, string interfaces = null )
Last updated: 2024-08-05
Post by installwhat on IDialogOpenedListener
CODESYS Forge
talk
(Post)
Why do you develop things like this? The workflow should be highly dependent on autocomplete, then if that's not super obvious browse to definition and everything is made clear possibly with the checking of a few types. The nature of how things are done makes me think these libraries aren't developed for general use and are actually internal or for partners. The example projects include objects that don't appear in autocomplete and then lead nowhere obvious when browsing. Do you consider developer workflow when creating these libraries? Are some libraries really for public use such as Visu Utils and others not? If so which? It's really hard to tell.
Last updated: 2024-08-06
Post by trusty-squire on parker servo and position
CODESYS Forge
talk
(Post)
@gepert, When you say "I do not turn off power", are you saying you don't power off the drive, or you don't turn of the MC_POWER function block? I read your statement as you don't kill actual electrical power. MC_POWER should stay enabled. @Gustavo, not related to problem at all, but when you say 1.6 Nm is only enough torque to unscrew a loose bottle cap, I think that's a bit low. A quick mental math I use is 1 Nm is almost the same force as 1kG applied to a 10cm wrench. So 1.6kG applied to a 10cm wrench is still not a huge force, but more than enough to be felt if trying to turn the shaft by hand.
Last updated: 2024-08-06
Post by alimans on OPC-UA Server, Symbol Set: Raise an error: Object reference not set to an instance of an object.
CODESYS Forge
talk
(Post)
Hi everyone, I just created a very simple library without any code and, added it to my very simple project. after adding this library, I get an error when I try to open "Symbol Set" in "OPC UA Server" in "Communication Manager". Here is the code of my POU in the library: FUNCTION_BLOCK POU VAR eCommand : (CMD_NONE:=0, CMD_RESET:=-1) INT := CMD_NONE; END_VAR Attached is the error that I get. I also noticed that by removing the enumeration variable above (eCommand), I can open the "Symbol Set" again. Anybody has any idea why this error is raised and how could I use enumeration variables without error in "OPC UA Symbol Set"?
Last updated: 2024-08-08
Post by gilbertamine on Comparing Arrays of structure
CODESYS Forge
talk
(Post)
Hi Everybody, I'm looking for a simple way of comparing two array of a structure. My structure is define like this : TYPE Positions_T : STRUCT PosX: DINT; PosY: DINT; PosZ: DINT; END_STRUCT END_TYPE I have multiples Var : ARRAY [0..220] OF Positions_T, that I need to compare quickly. I don't really want to do a Loop that goes by every 220 points and compare each one of them so I was wondering if there is another way. I came accross the MEM.Compare function, but it require to know the size in Bytes of the memory, and I don't know how to do that... Has anybody an idea on how to do the comparing easily ? Thanks in advance
Last updated: 2024-08-22
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jp23 on Unable to Connect to Modbus RTU Device
CODESYS Forge
talk
(Post)
Hi all, I am attempting to use the Control Win V3 soft PLC to control a WAGO 750-315 remote I/O system via modbus RTU communication. I am struggling to connect to the device. I have been following this tutorial: https://www.youtube.com/watch?v=YlRfkESaNds I have setup my devices as shown in the images below. I have verified that my com port settings are correct as I am able to connect/control using modbus simulator software with these settings. I have also connected to a modbus master simulator program as instructed in the video, but the orange triangles will not go away. Additionally, I have updated my settings to 485 using the PLC shell. I have also set "always update variables" to enabled (1). Serial port, PCI-Bus, and modbus serial device status all show as "Not Running."
Last updated: 2024-08-26
Post by jonathan1321351 on IO-Link write parameters Ethernet/IP
CODESYS Forge
talk
(Post)
I want to read and write parameters of an IO-Link device using acyclic messages. I have a Cube67+ in Ethernet/IP, connected to an IO-Link master. In the datasheet, I can find the parameters required for the message (Service, Class, Instance, etc.). I see the function block "Set_attribute_single" in the "EthernetIP Services" library, but I'm not sure how to correctly send the index and sub-index for the IO-Link device. The class in the datasheet is 0x80 for the IO-Link Parameter Object, but it’s not present in the CPIClass enum. Is there another function block more suitable for configuring IO-Link devices? (similar to "iol_call" in PROFINET or what’s used in EtherCAT).
Last updated: 2024-09-02
Post by jonathan1321351 on IO-Link read/write parameters Ethernet/IP
CODESYS Forge
talk
(Post)
I want to read and write parameters of an IO-Link device using acyclic messages. I have a Cube67+ in Ethernet/IP, connected to an IO-Link master. In the datasheet, I can find the parameters required for the message (Service, Class, Instance, etc.). I see the function block "Set_attribute_single" in the "EthernetIP Services" library, but I'm not sure how to correctly send the index and sub-index for the IO-Link device. The class in the datasheet is 0x80 for the IO-Link Parameter Object, but it’s not present in the CPIClass enum. Is there another function block more suitable for configuring IO-Link devices? (similar to "iol_call" in PROFINET or what’s used in EtherCAT).
Last updated: 2024-09-04
Post by trusty-squire on How to revert to previous version library
CODESYS Forge
talk
(Post)
Hi, I'm experiencing a bug with the latest version of SoftMotion CNC library (4.17), where the 3DPath object in Visu is missing all the important properties. I've verified that a previous app I was working on with library version 4.16 did not have this issue and the issue is duplicated in that project when I update it to 4.17. I've already submitted a bug report, but for the time being I need to revert the project I'm currently working on back a revision. I've tried right clicking on the library but the option to select the version is greyed out. Can anyone help me?
Last updated: 2024-09-05
Post by otbeka on CmpCrypto CryptoGenerateHash Not Outputting
CODESYS Forge
talk
(Post)
Unfortunately I noticed that, and tried: * using CryptoGeteAlgorithmByID within the function call * inputting the raw byte pointer as a testByte * instantiating the _hHash handle within the function body * using a different cryptoID or the raw DINT values from the RtsCryptoID DUT ... to no avail. The pReturn value is also set to 0, which would indicate that it is OK, right? This is odd given that the function is the same within the CryptoDemo example project here, just with a newer version. Is it possible that there is something wrong with the way my bytestring is being set up? I use the following DUTs here: TYPE MESSAGE : STRING(255); END_TYPE TYPE HASH_CODE : ARRAY[0..19] OF BYTE; END_TYPE
Last updated: 2024-09-06
Post by opineiro on Stack overflow with really simple function
CODESYS Forge
talk
(Post)
Hi, I have an issue with a function which sends a message through API Rest. I'm using a function from httpCLient library. I have tested this function inside a program and it works fine. But when I want to use it inside a function (so I can call it simultaneously from 2 different points on the main program) it gives a stack overflow error. In detail it says: "C0297 Stack Overflow on Main Task. Stack sizes... Call hierarchy:" I have simplified as much as I can the function, but I'm hitting a wall with this. Anybody has an idea of what's wrong? Thanks!
Last updated: 2024-09-16
Post by opineiro on How to manage variable types larger than 64 bits - Ethernet/IP
CODESYS Forge
talk
(Post)
Hi there, I have a Keyence bar code reader connected to my plc through Ethernet/IP. The Bar code is 20 digits long (like 30100790020493036016), the scanner reads it correctly (I can verify that through the keyence software) but when it sends it through ETH/IP, it doesn't fit into a 64 bit variable and it trunks the data.(I've tried ULINT and LWord without success). When I loaded the EDS file, the read variable was defined as a byte with 128 bits length, which is quite strange for me. (see attached picture) How do I manage this variable? Thanks!
Last updated: 2024-09-23
Post by davidbo on RPI can system operation like rm in a shell have an impact on a Task cycle time
CODESYS Forge
talk
(Post)
I have noticed that a rm file1.txt command on a shell has an impact on the cycle time for a TASK writing to file2.txt. Seen in the Monitor fane of the Task configuration Furthermore if a TASK makes a system call like rm, its cycle time increases of course but it seems to have an invisible impact on other TASKs too. I have a TASK for handling communication over the CANbus (SPI) where it stops sending "Heartbeats" for many seconds when another TASK does a system rm. Why is that not seen on the Monitor fane? Is even codesyscontrol paused when system calls are made? The CPU load is about 30-40%
Last updated: 2024-09-23
Post by jacobwago on v3.5 SP19 - Modbus TCP Devices - Channel Limit?
CODESYS Forge
talk
(Post)
Hello, I have experienced the same issue as described above but for the Modbus Serial configurator. Looking for a solution. In v3.5 SP19 Patch 7 the Modbus Serial Master Slave configurator has a "virtual" limit of 10 channels. In v3.5 SP18 Patch 5 this virtual limit does not exist. I can successfully copy back and forth from 18 to 19 with out any build error. However, this is not a good solution for our customers. What is even more confusing is that the IoDrvModbus library is the same version (4.3.0.0) for both SP18 and SP19. Please help in providing a fix to the virtual channel limit of 10 in SP19. Thanks,
Last updated: 2024-09-29
Post by andrebrandt on FB string and naming
CODESYS Forge
talk
(Post)
Hi Tim. Not quite correct. What i'd like, is when you place the FB in prog, i choose a block NTC10k, and name this RT401. What i'm trying to do, is to get the name RT401 automaticly into the FB, so i can put this into the string i pass in a struct. So in var in POU, i saw this a place i could do this, RT401: NTC10k(Tag:='RT401'), but i can't get this to work. I shurly must have had something like this in FB: FUNCTION_BLOCK NTC10k String TAG But it's here where I'm stuck...
Last updated: 2024-09-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
.