Post by timvh on Problem Reading Registers via Modbus from non Codesys device
CODESYS Forge
talk
(Post)
According to the documentation: https://wiki.teltonika-networks.com/view/RUT956_Modbus You need to create a Channel to read 2 registers from address 143 to get the lattitude. It doesn't specify if you need to read it as a Holding Register or as an Input Register. You could try both. So in the Teltonika router, you need to enable it as being a Modbus Server. Then in CODESYS add an Ethernet Adapter, then a Modbus Client (Master) and to the Client (Master) add the Modbus Server (Slave). Set the IP address and add the Channel. The please consider that CODESYS doesn't update any variables when they are not used in the application. In the I/O mapping tab of your I/O configuration, you can set the "Always update" to enabled.
Last updated: 2025-03-08
Post by mehakfatima on Need Help Configuring Energy Analyzers via Modbus TCP & RTU (RS-485) in CODESYS 3.5
CODESYS Forge
talk
(Post)
Hello everyone, I am currently working on reading data from energy analyzers using Modbus TCP and RTU (RS-485). In my previous software, I used the following method to add slave devices (i have attached the image) and configure registers: Add the Modbus slave device. Configure the communication parameters (baud rate, parity, etc.). Define the registers and their addresses for data retrieval. Now, I am trying to achieve the same in CODESYS 3.5, but I am not sure how to configure the Modbus master, add slave devices, and set up the registers properly. If anyone has experience with Modbus TCP/RTU setup in CODESYS 3.5, I would really appreciate your guidance! A step-by-step explanation or any references/tutorials would be extremely helpful.
Last updated: 2025-03-13
Post by milosfejgl on Codesys Licenses - How to reload them after updating the Raspberry Pi OS
CODESYS Forge
talk
(Post)
We use several control units running on Raspberry Pi, programmed using Codesys software, with multiple licenses stored as soft containers. We are planning to update the SD card image of the Raspberry Pi to a newer OS version. However, we are concerned that this process might result in the loss of our soft container licenses. Is there a way to temporarily deactivate the license so that it can be reactivated on the updated system? Alternatively, what would be the best method to preserve the licenses during the update? Thank you in advance for any responses!
Last updated: 2025-03-13
Post by ameba on PersistentVars and Webvisu Element
CODESYS Forge
talk
(Post)
hello everyone I would like to try to better understand how persistent variables work. I created some boolean variables in the PersistentVars section initialized to the value TRUE. I have tied these boolean variables to toggle switches placed inside the HMI interface pages. Once the PLC program is started, the lever selectors, if operated, change their state, at least at a graphical level, but the persistent variables do not undergo any variation. Initially the above variables were declared as simple global variables, in this case the operation with the levers was correct; I then tried to transform them into persistent ones with the aim of using them as "settings saver" Thank you for support Bye
Last updated: 2025-04-03
Post by alex2 on Error Highlighting Not Working in CODESYS v3.5 SP10 on Windows 11
CODESYS Forge
talk
(Post)
Hello everyone, I'm currently using CODESYS v3.5 SP10 on Windows 11, and I've noticed that syntax errors are not automatically underlined in red as they normally should be. Is there a specific setting that needs to be enabled for this feature to work? If so, could you please let me know where to find it? I’ve already tried uninstalling and reinstalling CODESYS, but that didn’t resolve the issue. Also, i have a teammate who have exactly the same computer as me and he didnt encounter any issue. Thank you in advance for your help!
Last updated: 2025-05-13
Post by abuckie on Getting raw value as full resolution for ADS1115
CODESYS Forge
talk
(Post)
I just found this and I am getting a value larger than 16 bit, around 81000 something. I am reading a 5 volt value and I am using level shifters for the i2c bus. This is how I have the channel configured: ADS1115.usiAddress := 16#48; ADS1115.ChannelConfigs[0].Active := TRUE; ADS1115.ChannelConfigs[0].PGA := FSR_6144mV; ADS1115.ChannelConfigs[0].InputMux := Single_0; RawAnalogValue := ADS1115.Channels[0].Value; It looks like every value is a multiple of 3. Any idea where to look to fix this? I think i found what I want to change in UpdateChannels Channels[FChannelNo].Value := INT_TO_REAL(WORD_TO_INT(LValue) * GetFullScaleRange(ChannelConfigs[FChannelNo].PGA)) / 2048.0; I try to edit it but I can't, sorry if this is a basic question, I am new to CODESYS.
Last updated: 2025-05-22
Post by milan-svarny on ModbusFB.ClientSerial Problem with Reply Timeout
CODESYS Forge
talk
(Post)
Hi All, I have problem with ModbusFB.ClientSerial. I'm using 4 different port for Modbus communication. After some time of running program ClientSerial stops to receive data to reply buffer and all request finish with Reply Timeout. The Device sent reply correctly,that it is visible on oscilloscope and it is possible to see that data( reply )are in the device. If the usbtty device is read over external app. then it is possible to see all data which were not taken by ModbusFB.ClientSerial. The stack does not overflow or something , program runs correctly forward and no exceptions or something. The main problem it is that when the error occur than it is not possible to reset port or something or maybe i'm doing it wrong way. please help me with this issue. Thank you for any help in advice Milan
Last updated: 2025-05-23
Post by george32 on Learning ST in an object-oriented way.
CODESYS Forge
talk
(Post)
Dear all, I am currently creating a program in the ST language. Because the program is starting to grow nicely I would like to switch to a more object-oriented way of programming. (Like for example in Python). By surfing the internet I found out that Function Blocks is the best method for this. Now I would like to delve further into this, with all the possibilities that Function Blocks have only I cannot find a clear course, explanation of what everything is around the function block thing and how to approach everything. I find the standard documentation around Function Blocks rather abstract and the examples are minimal. Therefore I am looking for a page/course/document explaining object oriented programming in Codesys (or other PLC programming environment). Do you have any recommendations on this?
Last updated: 2025-06-10
Post by s1mon on Two OneWireMaster on one Raspberry PI 5
CODESYS Forge
talk
(Post)
Hi, I want to use two OneWireMaster on a Raspberry Pi5. I'm running Codesys Control for Raspberry Pi 64SL V 4.15.0.0. Under Linux I've configured two GPIOs for 1w bus usage on GPIO4 and GPIO27. Under Linux both masters seem to work fine and I can readout both sensors connected to both GPIOs. The two masters are 'w1_bus_master1' and 'w1_bus_master2'. In Codesys I've configured to OneWireMasters with the corresponding file paths. But in Codesys the 2nd onewiremaster "w1_bus_master2" doesn't work. Status is showing "OnewireMaster : Not running" What am I doing wrong? Does Codesys on Raspberry support multiple OneWireMasters? Any help is appreciated.
Last updated: 2025-06-10
Post by s1mon on Two OneWireMaster on one Raspberry PI 5
CODESYS Forge
talk
(Post)
Hi, I want to use two OneWireMaster on a Raspberry Pi5. I'm running Codesys Control for Raspberry Pi 64SL V 4.15.0.0. Under Linux I've configured two GPIOs for 1w bus usage on GPIO4 and GPIO27. Under Linux both masters seem to work fine and I can readout both sensors connected to both GPIOs. The two masters are 'w1_bus_master1' and 'w1_bus_master2'. In Codesys I've configured to OneWireMasters with the corresponding file paths. But in Codesys the 2nd onewiremaster "w1_bus_master2" doesn't work. Status is showing "OnewireMaster : Not running" What am I doing wrong? Does Codesys on Raspberry support multiple OneWireMasters? Any help is appreciated.
Last updated: 2025-06-10
Post by ryusoup on JSONByteArrayWriter problem?
CODESYS Forge
talk
(Post)
Hello, I am trying to implement a FB to make JSON formatted WSTRING type message using JSON Utilities 1.9.0.0 included in the IIoT library. In my case, I want to set some objects or arrays and set values to them later. But when I wrote as the sample below, // init builder builder(pJsonData:=pJsonData, diRootObj=>diRootObj); // set the 1st key to root diKey1 := builder.SetKeyWithArray(wsKey:="key1", diParentIndex:=diRootObj, eError=>eError); // set a value to the 1st key wsValue:="value01"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey1, eError=>eError); // set the 2nd key to root diKey2 := builder.SetKeyWithArray(wsKey:="key2", diParentIndex:=diRootObj, eError=>eError); // set a value to the 2nd key wsValue:="value02"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey2, eError=>eError); // set a value to the 1st key again wsValue:="value03"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey1, eError=>eError); // set a value to the 2nd key again wsValue:="value04"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey2, eError=>eError); // write build result writer(xExecute:=TRUE, pwData:=ADR(wsResult), udiSize:=SIZEOF(wsResult), xAsyncMode:=FALSE, jsonData:=pJsonData^); the result was: { "key1": ["value01"], "key2": ["value02", "value03", "value04"] } while my expection was: { "key1": ["value01", "value03"], "key2": ["value02", "value04"] } Inspecting pJsonData^, JSONData itself seems to be ok, so I believe the issue is something caused by the writer FB. Does anyone know how to fix it? Thanks,
Last updated: 2023-10-04
Post by manuknecht on Persistence Manager does not save alphabetically first value
CODESYS Forge
talk
(Post)
After some more digging I realized that I get an error on the PLC Logger saying PersistenceChannel: 150 (invalid type in data: SimpleLibrary). I suppose the issue could be found in the ConfigData, which is automatically generated and which looks like this: 1 9##83 SimpleLibrary#GVL.aMoreZeros.[1]#0#64512#15#0 <[2]#0#64520#15#0 <[3]#0#64528#15#0 <[4]#0#64536#15#0 <#0#64544#15#0 <[6]#0#64552#15#0 <<lrVar#0#64560#15#0 <strVar#0#64428#16#80 <uiDummy#0#64370#11#0 Perhaps the fact that the variable is stored within a library confused the compiler? I tried changing the PersistenceChannel parameters to xCompressTags := FALSE which changed the entry in the data file from _xCompressTags BOOL:TRUE _xCompressTags BOOL:FALSE but the actual content of the data file and also the config data did not change.
Last updated: 2023-10-17
Post by user0815 on Kommunikation zwischen ROS2 und CODESYS über Web Sockets
CODESYS Forge
talk
(Post)
Hallo zusammen, ich hoffe ihr könnt mir weiterhelfen. Meine CODESYS Version ist die V3.5 SP19 Patch 4 und die Zielsystemversion ist die 4.10.0.0 . Ich verwende CODESYS ohne Lizenz. Ich probiere eine Verbindung über Web Sockets zwischen ROS und CODESYS aufzubauen. Der Client von CODESYS verbindet sich mit dem Ros Bridge Server aber ich weiß nicht wie ich dem Ros Server sage welches Topic er publishen soll. Über Node-Red habe ich eine Verbindung aufbauen können. Dafür habe ich "node-red-contrib-flowake-ros-nodes" verwendet. Den Daten Austausch habe ich mit mit Wireshark angeschaut und nun probiere ich den mithilfe von CODESYS nachzubauen. NAch dem sich der Client verbunden hat muss folgende Nachricht übermittelt werden:"{"op":"call_service","id":"call_service:/rosapi/topic_type:1","type":"rosapi/TopicType","args":{"topic":"/cmd_vel"}}." Ich vermute es funktioniert über Frames aber ich weiß nicht wie ich es umsetzten soll. Besten Dank für die Hilfe und schöne Grüße
Last updated: 2024-01-03
Post by dtamm on How to read string from CharBufferPtr?
CODESYS Forge
talk
(Post)
I am trying to implement a mechanism to send alarm SMS. For this, I have created an Alarm Class with a Notification Action which calls a POU. This POU implements IAlarmNotifiable making it selectable in the Alarm Class configuration. IAlarmNotifiable has an Execute method which is called by the alarm class. Now, I want to extract the alarm message of the triggered alarm. The Execute method comes with a VAR_INPUT itfAlarm: AlarmManager.IAlarm which supplies a method called GetMessage. The help text says: Returns the message text, that has been configured for the alarm. The result is a pointer to the buffer, where the message text is stored The type of the result is CharBufferPtr, and at some place I read that it can be interpreted as a pointer to string. But I cannot manage to extract the alarm message, all I get are numbers. I have tried the following: psAlarmText := itfAlarm.GetMessage(__SYSTEM.TYPE_CLASS.TYPE_STRING)^; sAlarmText := TO_STRING( itfAlarm.GetMessage(__SYSTEM.TYPE_CLASS.TYPE_STRING)^ ); So how do I get access to the alarm message as clear text? (In this case, "Larm 1")
Last updated: 2024-02-21
Post by umdee on Error when monitoring LAD programs
CODESYS Forge
talk
(Post)
System Information from the computer being used: OS Name Microsoft Windows 11 Pro Version 10.0.22631 Build 22631 Other OS Description Not Available OS Manufacturer Microsoft Corporation System Manufacturer Dell Inc. System Model Latitude 5500 System Type x64-based PC System SKU 08B9 Processor Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz, 2112 Mhz, 4 Core(s), 8 Logical Processor(s) BIOS Version/Date Dell Inc. 1.3.11, 6/11/2019 SMBIOS Version 3.2 Embedded Controller Version 255.255 BIOS Mode UEFI BaseBoard Manufacturer Dell Inc. BaseBoard Product 0M14W7 BaseBoard Version A00 Platform Role Mobile Secure Boot State On PCR7 Configuration Elevation Required to View Windows Directory C:\WINDOWS System Directory C:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale United States Hardware Abstraction Layer Version = "10.0.22621.2506" User Name CARDASSIA-IX\Engineer Time Zone Eastern Daylight Time Installed Physical Memory (RAM) 16.0 GB Total Physical Memory 15.8 GB Available Physical Memory 4.67 GB Total Virtual Memory 18.5 GB Available Virtual Memory 2.52 GB Page File Space 2.63 GB Page File C:\pagefile.sys Kernel DMA Protection Off Virtualization-based security Not enabled Windows Defender Application Control policy Enforced Windows Defender Application Control user mode policy Off Device Encryption Support Elevation Required to View Hyper-V - VM Monitor Mode Extensions Yes Hyper-V - Second Level Address Translation Extensions Yes Hyper-V - Virtualization Enabled in Firmware Yes Hyper-V - Data Execution Protection Yes
Last updated: 2024-03-19
Post by timvh on License problem gateway
CODESYS Forge
talk
(Post)
What we are trying to explain is that, yes CODESYS creates the software, but Epis decides how they implement it on their hardware, which runtime version they use and they decide which functionality they support. So it is always a combination of the two. What CODESYS provides is a runtime with options for e.g. visualization or softmotion. Epis could add this softmotion license as default to their controller, but if they don't then CODESYS provides another option with a single license in a "Wibu CodeMeter" container. Eventhough the feature exists, Epis has to add this "CodeMeter" software on their controller to be able to access the licenses in the container. We don't know if they did this. Then finally it depends on what type of runtime is on this controller and which license Epis is using. So if they have an OEM license (not an application based license), then most likely you will need the Softmotion license (not a number of axis). See https://store.codesys.com/en/codesys-softmotion-sl-bundle.html. But to be sure if this is supported by the Epis controller, you must ask Epis.
Last updated: 2024-04-30
Post by caprez95 on Trace Restart Visuelement
CODESYS Forge
talk
(Post)
Hallo zusammen. Ich habe schon länger mit dem Problem zu kämpfen, dass ich einen Trend (Visuelement) nicht resetten (neustarten) kann. Ich habe es jetzt mit dem Beispiel hinbekommen, die Trace-Aufzeichnung über die CmpTraceMgr Bibliothek zu steuern. Aber wie bekomme ich diese Trace-Aufzeichnung in ein Visuelement? Der Code sieht wie folgt aus: // Configure trace IF xInit THEN // Create a trace packet PacketConfig.pszName := ADR('IECTraceConfiguration.Trace1'); // Name of trace PacketConfig.pszApplicationName := ADR('IECTraceConfiguration'); // Name of the application PacketConfig.pszIecTaskName := ADR('Task'); // Name of the task PacketConfig.pszComment := ADR('Demo packet'); PacketConfig.ulEveryNCycles := 1; PacketConfig.ulBufferEntries := 1000; PacketConfig.ulFlags := TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_TIMESTAMP_MS AND TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_AUTOSTART; IF (NOT fbTraceManager.CreatePacket(PacketConfig := PacketConfig, hPacket=>hPacket1)) THEN xError := TRUE; END_IF // Create a trace record RecordConfig.pszVariable := ADR('iSignal'); // This is the name of variable to record RecordConfig.tcClass := INT_TO_UDINT(TypeClass.TYPE_INT); // Type of the recording variable RecordConfig.ulSize := SIZEOF(iSignal); // Size of the recording variable pApp := AppFindApplicationByName('IECTraceConfiguration', 0); AppGetAreaOffsetByAddress(pApp, ADR(iSignal), ADR(RecordConfig.tvaAddress.taAddress.Area.usArea), ADR(RecordConfig.tvaAddress.taAddress.Area.ulOffset)); // Get and set area offsets RecordConfig.tvaAddress.ulAddressFlags := TRACE_VAR_ADDRESS_FLAGS_IEC OR TRACE_VAR_ADDRESS_FLAGS_AREA_OFFSET; RecordConfig.ulGraphColor := 16#FF00FF00; // green RecordConfig.ulGraphType := 1; // Line with points IF (NOT fbTraceManager.AddRecord(RecordConfig := RecordConfig, hPacket := hPacket1, hRecord => hRecord1)) THEN xError := TRUE; END_IF xInit := FALSE; END_IF // Starts the recording IF xStart THEN IF (NOT fbTraceManager.StartPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStart := FALSE; END_IF // Stop the recording IF xStop THEN IF (NOT fbTraceManager.StopPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStop := FALSE; END_IF // Reset the recording IF xReset THEN IF (NOT fbTraceManager.ResetPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xReset := FALSE; END_IF
Last updated: 2024-06-04
Post by caprez95 on Trace Restart Visuelement
CODESYS Forge
talk
(Post)
Hello everyone. I've been struggling with the problem for a long time that I can't reset (restart) a trend (visual element). With the example I have now managed to control the trace recording via the CmpTraceMgr library. But how do I get this trace recording into a visual element? The code looks like this: // Configure trace IF xInit THEN // Create a trace packet PacketConfig.pszName := ADR('IECTraceConfiguration.Trace1'); // Name of trace PacketConfig.pszApplicationName := ADR('IECTraceConfiguration'); // Name of the application PacketConfig.pszIecTaskName := ADR('Task'); // Name of the task PacketConfig.pszComment := ADR('Demo packet'); PacketConfig.ulEveryNCycles := 1; PacketConfig.ulBufferEntries := 1000; PacketConfig.ulFlags := TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_TIMESTAMP_MS AND TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_AUTOSTART; IF (NOT fbTraceManager.CreatePacket(PacketConfig := PacketConfig, hPacket=>hPacket1)) THEN xError := TRUE; END_IF // Create a trace record RecordConfig.pszVariable := ADR('iSignal'); // This is the name of variable to record RecordConfig.tcClass := INT_TO_UDINT(TypeClass.TYPE_INT); // Type of the recording variable RecordConfig.ulSize := SIZEOF(iSignal); // Size of the recording variable pApp := AppFindApplicationByName('IECTraceConfiguration', 0); AppGetAreaOffsetByAddress(pApp, ADR(iSignal), ADR(RecordConfig.tvaAddress.taAddress.Area.usArea), ADR(RecordConfig.tvaAddress.taAddress.Area.ulOffset)); // Get and set area offsets RecordConfig.tvaAddress.ulAddressFlags := TRACE_VAR_ADDRESS_FLAGS_IEC OR TRACE_VAR_ADDRESS_FLAGS_AREA_OFFSET; RecordConfig.ulGraphColor := 16#FF00FF00; // green RecordConfig.ulGraphType := 1; // Line with points IF (NOT fbTraceManager.AddRecord(RecordConfig := RecordConfig, hPacket := hPacket1, hRecord => hRecord1)) THEN xError := TRUE; END_IF xInit := FALSE; END_IF // Starts the recording IF xStart THEN IF (NOT fbTraceManager.StartPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStart := FALSE; END_IF // Stop the recording IF xStop THEN IF (NOT fbTraceManager.StopPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStop := FALSE; END_IF // Reset the recording IF xReset THEN IF (NOT fbTraceManager.ResetPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xReset := FALSE; END_IF
Last updated: 2024-06-04
Post by solve-it on SysFileOpenAsync
CODESYS Forge
talk
(Post)
Just realized that it is the /dev/input/js0 file. Don't think this is a prob either. Found the ConfigFile. Where and how to add /dev/input/js0? raspberry [SysFile] FilePath.1=/etc/, 3S.dat PlcLogicPrefix=1 [SysTarget] TargetVersionMask=0 TargetVersionCompatibilityMask=0xFFFF0000 [CmpLog] Logger.0.Name=/tmp/codesyscontrol.log Logger.0.Filter=0x0000000F Logger.0.Enable=1 Logger.0.MaxEntries=1000 Logger.0.MaxFileSize=1000000 Logger.0.MaxFiles=1 Logger.0.Backend.0.ClassId=0x00000104 ;writes logger messages in a file Logger.0.Type=0x314 ;Set the timestamp to RTC [CmpSettings] FileReference.0=SysFileMap.cfg, SysFileMap FileReference.1=/etc/CODESYSControl_User.cfg [SysExcept] Linux.DisableFpuOverflowException=1 Linux.DisableFpuUnderflowException=1 Linux.DisableFpuInvalidOperationException=1 [CmpWebServer] ConnectionType=0 [CmpOpenSSL] WebServer.Cert=server.cer WebServer.PrivateKey=server.key WebServer.CipherList=HIGH [SysMem] Linux.Memlock=0 [CmpCodeMeter] InitLicenseFile.0=3SLicense.wbb [SysEthernet] Linux.ProtocolFilter=3 [CmpSchedule] ProcessorLoad.Enable=1 ProcessorLoad.Maximum=95 ProcessorLoad.Interval=5000 DisableOmittedCycleWatchdog=1 [CmpUserMgr] AsymmetricAuthKey=6873d655ac1f166f3743feea42d2f3dd1b39ae40 [CmpSecureChannel] CertificateHash=09fd8d52be4ddd45a709bc9c95e2aa093b3f5695 [SysSocket] Adapter.0.Name="eth0" Adapter.0.EnableSetIpMask=1 ;raspberry [ComponentManager] ;Component.1=CmpGateway ;Component.2=CmpGwCommDrvTcp ;Component.3=CmpGwCommDrvShm [SysCom] ;Linux.Devicefile=/dev/ttyS [CmpBlkDrvCom] ;Com.0.Name=MyCom ;Com.0.Baudrate=115200 ;Com.0.Port=3 ;Com.0.EnableAutoAddressing=1 [SysProcess] Command.0=shutdown [CmpApp] Bootproject.RetainMismatch.Init=1 ;Application.1=Application ;Application.1=Application ;Application.1=Application Application.1=Application [CmpRasPi] Architecture=armv6l [CmpRedundancyConnectionIP] [CmpRedundancy] [CmpSrv] [IoDrvEtherCAT]
Last updated: 2024-07-16
Post by ruobian on Analog Input Delay Timer
CODESYS Forge
talk
(Post)
Hello there, I am new here and in programming. I need help with the basics. I am trying to do what I mentioned in the title. I have an analog input. So I have a real or integer data type value. I want to delay it. TON and TOF only work with bool. I think there is a function block that has two inputs, 1 for real or int and 1 for bool. And if bool is true, it will give the output as real or int. I don't know but I need something like this. Actually, it is not exactly like that. In other words, it will not show the real value at the input at the output after a certain period of time. I want it to show the real value from 2 seconds ago continuously. The purpose of doing this is to compare the real value I received with the value from 2 seconds ago and find out whether it went up or down. I am using only FBD. Please help me with this. Thanks in advance.
Last updated: 2024-08-20
Post by bjarne-pagaard on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20)
CODESYS Forge
talk
(Post)
Hi, I would like to divide a project into multiple applications - as a minimum: one handling visualization and Alarm Manager, one handling I/O and plant control logic. But how to exchange variables between the applications? What have you done to get such a solution? In versions 3.5.19 and earlier, you can have Child applications, where the children can access a GVL in the Parent application. Children apps is no longer possible in 3.5.20 - but you can have 'sibling' apps - Several apps directly under PLC Logic, that is. But how do they best communicate? The Communication Manager / Data Sources Manager is sort of possible via OPC UA, but it seems like overkill and with some limitations - for example no ARRAY OF STRUCT possible this way. If you have separate devices in your project, you can exchange data via 'CODESYS ApplicationV3', but not other applications in the same device (see attachment Datasources.png). You can do it via 'Select the project type'->'Other Project' and select the same project file, but this leads to crashing the Development system when working with the variables afterwards. It would be great to hear your thoughts / experiences on this topic - Bjarne
Last updated: 2024-09-27
Post by breiter on Frustration-Fueled Feedback on Project File Management and Git Integration
CODESYS Forge
talk
(Post)
Hi, supporting a text based storage format is on our roadmap, see https://www.codesys.com/the-system/releases-updates-lifecycle/release-plan-roadmap.html It will be an Add-On feature called "File Based Storage" for the professional developer edition. Structured text POUs will be stored as plain text. Other graphical languages will remain in an xml format. You will be able to switch the storage type for projects. Certain workflows will become easier this way. Nevertheless restrictions will remain because of CODESYS specific storage logic (for example how methods below function blocks are stored as file). So merging using our Git Integration Add-On remains the recommended workflow. A workflow involving Visual Studio Code as the main IDE is not supported. Simply because many topics like library management, task configuration or fieldbus configurators are not available for VS Code. A PLC project is a lot more than just some ST POUs. Best Regards
Last updated: 2024-10-16
Post by imdatatas on Auto Declare window disappears by itself in the Ladder editor
CODESYS Forge
talk
(Post)
Hello Everyone, The "Auto Declare" window disappears by itself in the Ladder editor. For example, a new function block is wanted to be added to the Ladder editor. (For example; MC_Jog block and instance name will be fbMcJog). To do this, "Empty box with EN/ENO" is added to the ladder line from the Toolbox on the right and when you type MC_Jog in the empty box and press enter, normally the "Auto Declare" window appears and you are expected to be asked to write the instance name here. However, this "Auto Declare" window closes itself immediately, it does not wait for the user to enter a value or close the window. I often encounter this situation in many IDE versions. Does this seem like a bug? If anyone has encountered a similar problem while creating a new program name, function or function block instance name regarding the "Auto Declare" window and knows a solution, I would be glad if you could share it. Best wishes Imdat
Last updated: 2025-03-06
Post by mondinmr on Unexpected behavior in cyclic encoder read method during INT overflow (wrap-around)
CODESYS Forge
talk
(Post)
Hi everyone, I’m investigating a potential issue with a cyclic method we use for reading incremental encoders in our libraries. I’ve come across two implementations that, at first glance, appear to perform the same operation: motionUnit.vlPositionActualValue is UINT due strange encoder type. Version A METHOD PROTECTED cyclicReadField VAR_INST actPosFieldOld: INT; rI: INT; delta: INT; END_VAR rI := TO_INT(motionUnit.vlPositionActualValue); delta := rI - actPosFieldOld; m_actPosRaw := m_actPosRaw + TO_LREAL(delta); actPosFieldOld := rI; IF settings.velocityFeebackMapped THEN m_actVelRaw := TO_LREAL(motionUnit.velocityActualValue); END_IF Version B METHOD PROTECTED cyclicReadField VAR_INST actPosFieldOld: INT; END_VAR m_actPosRaw := m_actPosRaw + TO_LREAL(TO_INT(motionUnit.vlPositionActualValue) - actPosFieldOld); actPosFieldOld := TO_INT(motionUnit.vlPositionActualValue); IF settings.velocityFeebackMapped THEN m_actVelRaw := TO_LREAL(motionUnit.velocityActualValue); END_IF Both use INT and the same delta logic, so they seem equivalent. However, when an overflow (wrap-around) occurs, version A continues correctly as expected, while version B unexpectedly resets to -32768 without a clear reason. Has anyone experienced similar behavior or can shed light on what might be happening here? It almost seems as if the cast to LREAL is being applied before the calculation — but that would be illogical and potentially very dangerous in many situations! Thanks!
Last updated: 2025-05-13
Post by bmatlove on Variable Length Array - Cannot mix variable and fixed length dimensions?
CODESYS Forge
talk
(Post)
Using Codesys 3.5.18.30 I am trying to work with an array of variable length in one dimension, but known in the other dimension. For example, using an array that represents a list of items, each with an attribute profile. I do not know how many items will be in the list, but I know that every item has 5 attributes, like size, weight, etc. Codesys does not seem to be able to accept this. I have referenced Data Type: ARRAY OF documentation page, which is not explicit if variable & fixed length array dimensions can be mixed. In the VAR_IN_OUT scope, I initially tried MY_ARRAY : ARRAY [*, *] OF REAL; which was no problem, of course. I then modified it to MY_ARRAY : ARRAY [*, 1..5] OF REAL; which throws C0006: ', or ]' expected instead of '..' among consequent downstream errors. I then used the Auto Declare -> Array Wizard, which accepted (asterisk)-(asterisk) and 1-5 for 2-dimensional lower and upper bounds. It output: MY_ARRAY: ARRAY[*..*, 1..6] OF INT; which throws the same error stream. What's the deal here? Is this possible?
Last updated: 2025-05-23
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
.