Post by askjong on Update variables when OPC UA Client updates. Error ID: 268468277 BadAttributeIdInvalid
CODESYS Forge
talk
(Post)
Hi, I'm connecting to a OPC UA Server using the Data Soruce Manager OPC UA Client. This works well until the OPC UA Server updates and the OPC UA list doesn't match up when i did last clicked the "Update variables" to add variables. All the variables are still the exists and none are removed from the server, but more are added during the engineering process. The error message i get in CODESYS is "Error in OPC UA call BadAttributeIdInvalid, Error ID: 268468277". The issues is fixed when i press the "Update variables" button and just press ok without adding or removing any variables in the list. Is there a way to either automatically update the browsepath if it fails or on startup, or to trigger it by code?
Last updated: 2024-01-08
Post by jari-koivuluoma on Newly created texlists wont appear in the selection dropdown
CODESYS Forge
talk
(Post)
When I create a new textlist in Codesys 3.5 SP19 Patch 5, it wont appear in the dropdown menu at Rectangle element > Dynamic texts > Text list. If I just type the name of the textlist to the field (in quotes), I get an error saying that some file is missing. Any good ideas what to do and what is going on. I recently updated to that version and I only now noticed this when I needed to add a new textlist so Im quite screwed with this not being able to add text lists. While im typing this, I tried copying an existing list and modifying it and it seems to show. Any ideas?
Last updated: 2024-09-19
Post by snhatton on Retain memory change to ZERO
CODESYS Forge
talk
(Post)
I think more information is needed to help solve the issue. Can you list the exact steps to reproduce the issue? What version of Codesys are you using? Did you add a persistentVars object to your project? I would recommend browsing all instances of the retain variable to see all possible writes to the variable in question.
Last updated: 2023-09-18
Post by transmin01 on SafetyApp - Exchange 8 bits from EtherCAT Safety Module to PLC mapping issue
CODESYS Forge
talk
(Post)
Hi, I am using an "Exchange 8 bits from EtherCAT Safety Module to PLC" module which allows me to create tags in the safety environment, but how does this map to the standard PLC program? There is no entry in the IoConfig_Globals variables list. Regards Trevor
Last updated: 2023-09-27
Post by ewi04 on Recipe Manager - RecipeManCommands, load & write wrong values, Bug?
CODESYS Forge
talk
(Post)
The individual structures were declared in a separate global variable list on a trial basis. But even this did not change the behavior. A total of 1667 variables are processed in a recipe. A reduction (e.g. saving only the first three drive parameter sets) also brought no change.
Last updated: 2023-11-15
Post by kees-b on Enumeration
CODESYS Forge
talk
(Post)
Hello, Can anyone give me advice or tell me what I'm doing "wrong"? I use "enumeration", but via, via (maybe that's the problem?) Similar situation in Codesys 2.3 this worked correctly. Now the BOOL is not found in the ENUM. GVL.g_IPC2AMK.dwDO.DO_AMK_REMOTE_ACTIVE GVL = Global Variabel List g_IPC2AMK = STRUCT dwDO = ENUM DO_AMK_REMOTE_ACTIVE = BOOL
Last updated: 2024-02-06
Post by kees-b on Enumeration
CODESYS Forge
talk
(Post)
Hello, Can anyone give me advice or tell me what I'm doing "wrong"? I use "enumeration", but via, via (maybe that's the problem?) Similar situation in Codesys 2.3 this worked correctly. Now the BOOL is not found in the ENUM. GVL.g_IPC2AMK.dwDO.DO_AMK_REMOTE_ACTIVE GVL = Global Variabel List g_IPC2AMK = STRUCT dwDO = ENUM DO_AMK_REMOTE_ACTIVE = BOOL
Last updated: 2024-02-06
Post by jinlee on V3.5 SP19 patch 2. Out of retain memory
CODESYS Forge
talk
(Post)
Hi guys, I am quite new Codesys. Be patient to me. I am having a problem now. Please refer to the attached photo. Is there a way to increase the memory ? If no, what is the way to solve this problem ? My retain variable list is in one place. Please refer to the attached photo. Thank you very much.
Last updated: 2024-03-20
Post by siscu on Raspberry Pi: List of available example applications
CODESYS Forge
talk
(Post)
Could this be turned into a library? I'd love for a way to have the main program call a function block method using the program's I2C_master device. I assume I should be passing the master as a variable for the function block, but I don't see how that could be achieved
Last updated: 2024-05-15
Post by thieulam on Codesys access to DICTIONARY OBJECTS of ethercat (CoE ) Servo Drive
CODESYS Forge
talk
(Post)
Hello to all! How can I read or write, via my main code (ST), to the registers present in the DO of my ethercat CoE servo drive? These objects appear in the list of the INITIALIZATION page, and from here I can only access them at startup. How do I access it in run time from my main PLC_PROGRAM?
Last updated: 2024-06-19
Post by gatto on variables between two applications
CODESYS Forge
talk
(Post)
No. As you can see in the uploaded image, in my test project, I have a variable list GVL_1 which is located in appication_1. But if I write in POU_2, which is instead found in application 2, I cannot find the variables of GVL_1. it seems that the GVLs are children of each app
Last updated: 2024-06-24
Post by phoward131 on Alarm filtering latch variables
CODESYS Forge
talk
(Post)
I am having the exact same issue and was wondering if you ever found the problem? The sample program does exactly what it's supposed to with filtering but when I implement it the exact same way in my program, the alarm list just goes blank when I attempt to apply a filter.
Last updated: 2024-10-28
Post by tyronnosaurus on SysLibMem.lib Where To Download?
CODESYS Forge
talk
(Post)
It should come by default on a normal install of Codesys 2.3, but it's a bit hidden: Like for any other library, go to Resources > library Manager > Right click on list of libraries > Additional library. On the browser that opens, instead of looking in the default folder, use the dropdown menu at the bottom to change the folder (SysLibMem should be on the 3rd folder).
Last updated: 4 days ago
Post by micik on Python scripting - print whole project tree
CODESYS Forge
talk
(Post)
Hello, I have found a script for printing device tree in Codesys project. This script is available as code snippet as an exmaple for using Python in Codesys. However I feel main documentation is lacking. For example, where can I find that object has "is_device" attribute? Code examples are given here: https://content.helpme-codesys.com/en/CODESYS%20Scripting/_cds_access_cds_func_in_python_scripts.html However, I have a question how to print the whole Project tree and not just devices? Of course I need to remove check: if treeobj.is_device: But simply removing this test condition will not produce what I want. I need to print PLC Logic, Application, ad other nodes in the Project tree. Where to find this documentation?
Last updated: 2024-08-12
Post by mondinmr on Direct Pointers in IOMapping for EtherCAT with IoDrvEthercatLib.ETCSlave_Dia
CODESYS Forge
talk
(Post)
I have found a very interesting solution using: IoConfigTaskMap IoConfigConnectorMap IoConfigChannelMap The first is the list of IO tasks. The second is the connector for each IO module in the IOMap. The third is the individual input or output on the IOMap. One of the properties of the connector is another pointer to a connector, which corresponds with the connector of the EtherCAT slave. Through this information, it is possible to understand to which EtherCAT slave an IO connectormap corresponds. I am attaching an FB that allows for the construction of an IO map and finding the pointer to the actual IOs in the IOMap based on the bitoffset. FUNCTION_BLOCK IOExplorer VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR inputChannels: COL.LinkedList; outputChannels: COL.LinkedList; ulintFactory: COL.UlintElementFactory; END_VAR METHOD inputAtBitOffsetOfConnector : POINTER TO BYTE VAR_INPUT conn: POINTER TO IoConfigConnectorMap; bitOffset: UDINT; END_VAR VAR it: COL.LinkedListIterator; itf: COL.IElement; elem: COL.iUlintElement; channelInfo: POINTER TO ADVChannelInfo; bitOffsetR: UDINT; END_VAR inputChannels.ElementIterator(it); WHILE it.HasNext() DO it.Next(itfElement => itf); __QUERYINTERFACE(itf, elem); {warning disable C0033} channelInfo := TO___UXINT(elem.UlintValue); {warning restire C0033} IF channelInfo^.connectorField = conn THEN IF bitOffsetR = bitOffset THEN inputAtBitOffsetOfConnector := channelInfo^.addr; RETURN; END_IF bitOffsetR := bitOffsetR + channelInfo^.size; ELSE bitOffsetR := 0; END_IF END_WHILE inputAtBitOffsetOfConnector := 0; END_METHOD METHOD outputAtBitOffsetOfConnector : POINTER TO BYTE VAR_INPUT conn: POINTER TO IoConfigConnectorMap; bitOffset: UDINT; END_VAR VAR it: COL.LinkedListIterator; itf: COL.IElement; elem: COL.iUlintElement; channelInfo: POINTER TO ADVChannelInfo; bitOffsetR: UDINT; END_VAR outputChannels.ElementIterator(it); WHILE it.HasNext() DO it.Next(itfElement => itf); __QUERYINTERFACE(itf, elem); {warning disable C0033} channelInfo := TO___UXINT(elem.UlintValue); {warning restire C0033} IF channelInfo^.connectorField = conn THEN IF bitOffsetR = bitOffset THEN outputAtBitOffsetOfConnector := channelInfo^.addr; RETURN; END_IF bitOffsetR := bitOffsetR + channelInfo^.size; ELSE bitOffsetR := 0; END_IF END_WHILE outputAtBitOffsetOfConnector := 0; END_METHOD METHOD scanIO VAR_INPUT END_VAR VAR numTasks: DINT := IoConfig_Globals.nIoConfigTaskMapCount; tType: WORD; ioTask: POINTER TO IoConfigTaskMap; numCon: WORD; connector: POINTER TO IoConfigConnectorMap; numCh: DWORD; channelInfo: POINTER TO ADVChannelInfo; iTsk: DINT; iCon: WORD; iCh: DWORD; i: DINT; _tmpConnList: COL.IList; elem: COL.IUlintElement; itf: COL.IElement; tmpCh: POINTER TO ADVChannelInfo; lastE: DINT; e: COL.COLLECTION_ERROR; e1: Error; END_VAR VAR_INST lF: COL.ListFactory; END_VAR IF outputChannels.CountElements() > 0 OR inputChannels.CountElements() > 0 THEN RETURN; END_IF _tmpConnList := lF.CreateDynamicList(16, 16); //Iterate through all IO tasks FOR iTsk := 0 TO numTasks - 1 DO ioTask := ADR(IoConfig_Globals.pIoConfigTaskMap[iTsk]); //Store the type of the task (Input or Output) tType := ioTask^.wType; numCon := ioTask^.wNumOfConnectorMap; //Iterate through all connectors of the task FOR iCon := 0 TO numCon - 1 DO connector := ADR(ioTask^.pConnectorMapList[iCon]); numCh := connector^.dwNumOfChannels; //Iterate through all channels of the connector FOR iCh := 0 TO numCh - 1 DO //Create a new channel info object and fill it with the address, connector and size of the channel //Connectors is address of field connector in this case like EtherCAT slave //Address is the address of the IOMap //Size is the size of channel data in bits in IOMap channelInfo := __NEW(ADVChannelInfo); channelInfo^.addr := connector^.pChannelMapList[iCh].pbyIecAddress; channelInfo^.connectorField := connector^.pConnector; channelInfo^.size := connector^.pChannelMapList[iCh].wSize; //We put the channel info a temporary ordered list //Order is based on the address of IOMap lastE := TO_DINT(_tmpConnList.CountElements()) - 1; FOR i := 0 TO lastE DO _tmpConnList.GetElementAt(udiPosition := TO_UDINT(i), itfElement => itf); __QUERYINTERFACE(itf, elem); {warning disable C0033} tmpCh := TO___UXINT(elem.UlintValue); {warning restire C0033} //If the address of the channel is smaller than the address of the channel in the list IF tmpCh^.addr > channelInfo^.addr THEN //Insert the channel in the list at the current position _tmpConnList.InsertElementAt(TO_UDINT(i), ulintFactory.Create(TO_ULINT(channelInfo))); //Clear the channel info pointer channelInfo := 0; //Exit the loop i := lastE + 1; END_IF END_FOR //If the channel info is not 0, it means that the channel was not inserted in the list IF channelInfo <> 0 THEN //Add the channel to the end of the list elem := ulintFactory.Create(TO_ULINT(channelInfo)); _tmpConnList.AddElement(elem); END_IF END_FOR //Iterate temporary list and add the channels to the input or output list lastE := TO_DINT(_tmpConnList.CountElements()) - 1; FOR i := 0 TO lastE DO _tmpConnList.GetElementAt(udiPosition := TO_UDINT(i), itfElement => itf); __QUERYINTERFACE(itf, elem); {warning disable C0033} tmpCh := TO___UXINT(elem.UlintValue); {warning restire C0033} //If type is input, add the channel to the input list IF tType = TaskMapTypes.TMT_INPUTS THEN e := inputChannels.AddElement(ulintFactory.Create(TO_ULINT(tmpCh))); //If type is output, add the channel to the output list ELSIF tType = TaskMapTypes.TMT_OUTPUTS THEN e := outputChannels.AddElement(ulintFactory.Create(TO_ULINT(tmpCh))); ELSE __DELETE(tmpCh); END_IF END_FOR //Clear the temporary list _tmpConnList.RemoveAllElements(); END_FOR END_FOR END_METHOD
Last updated: 2024-02-13
Post by martinlithlith on Relay board / relays for raspberry pi 3 b+
CODESYS Forge
talk
(Post)
hi! im planning a project on a raspberry with Codesys. For this I'll need a number of relays to control heating and fans, all a max of 24v and about 2a. How would i know if the board / relays i buy will be working with Codesys? Does every hat work or does it need a library/driver? is there a list of drivers/libraries created? as this is a hobby project all tips on a relay board or single boards that works with codesys and not to expensive are very welcome.
Last updated: 2023-09-03
Post by timvh on CANbus issue
CODESYS Forge
talk
(Post)
On a PC with the Control Win, this is probably related to the fact that the CAN drivers are not loaded. Go to the folder where your Control Win Configuration file is: - E.g. C:\ProgramData\CODESYS\CODESYSControlWinV3x64\E1FA7ABE - Open the CODESYSControl.cfg - Remove the semi-colon in front of the CAN driver you want to use (section ComponentManager). - Set the component ID to the next number in the list (e.g. Component.8) - Save this file and restart the Control Win.
Last updated: 2023-09-14
Post by martinlithlith on Raspberry Pi: List of available drivers / libraries
CODESYS Forge
talk
(Post)
As most of the posts are moved here around 2015, what would be the right version of codesys to run? Would it be better to install a older version of codesys or should i keep on downgrading libraries? Is there any work done to update theses libraries? ItΒ΄s been a few years since the last update in this post, are there new libraries/devices for raspberry being added/posted somewhere else? Thanks, Martin
Last updated: 2023-10-17
Post by simotion on Inheritance of axis
CODESYS Forge
talk
(Post)
I have developped a function block 'Axis' the inherits from 'AXIS_REF_SM3' -> FUNCTION_BLOCK Axis EXTENDS AXIS_REF_SM3 In my global variable list I define a variable MasterDrive of type Axis and assign Axis1. Axis1 is a virtual drive (AXIS_REF_VIRTUAL_SM3). This type should inherit from AXIS_REF_VIRTUAL. VAR_GLOBAL MasterDrive : Axis := Axis1; However I get the error 'Cannot convert type'. What is the way to obtain what I want : function block inheriting AXIS_REF_SM3 and initialising this function block with a Softmotion virtual or real axis?
Last updated: 2023-12-07
Post by macros8 on Translation - How to get text as reference in Frames translated?
CODESYS Forge
talk
(Post)
Hi, one more point. I have been able to create Property of Text which is added to Global text list so itΒ΄s fine. But as soon as I use Frame configuration I lose all other properties but some very basics. I need to have still possibility to set Input configuration because my element is Button. Do you know how to make visible all standard properties + my own properties created in Frame configuration? Thanks a lot. M.
Last updated: 2024-01-03
Post by rpostwvu on Shared Memory Access Issues
CODESYS Forge
talk
(Post)
I got the shared memory example. I'm pretty sure I'm successfully created a memory space, CreateResult returns 18. szName:='CodesysDataShare'; hShm := SysSharedMemoryCreate(szName, 0, ADR(uxiSize), ADR(CreateResult)); I'm trying to access this memory with a C# application, but I get "Unable to Find Specified File". I suspect that Codesys and/or Visual Studio code alters the name I choose? Being in Windows, I cant find a way to see the mapped memory list. ~~~ using (var mmfRead = MemoryMappedFile.OpenExisting("CodesysDataShare",MemoryMappedFileRights.ReadWrite)) ~~~
Last updated: 2024-01-29
Post by martinla on New Codesys Library Dependencies
CODESYS Forge
talk
(Post)
When creating a new Codesys library, I am getting 2 errors for missing libraries. I can see that I am using newer versions of these in the library manager (3.5.17.0 and 3.5.19.0 opposed to 3.5.8.0 and 3.5.7.0 stated in the errors). IDE Version is V3.5 SP19 Patch 6. The "Download missing libraries..." button in Messages list is not doing anything. Why is it looking for older versions of these libraries? Can this be fixed by using the newer versions? How can I download & install the older version of these libraries?
Last updated: 2024-02-29
Post by stuartjr on Disabling forcing of specific variables
CODESYS Forge
talk
(Post)
OK.. so maybe I miss understood for how the forcing order works. It seems that the force list is applied at the beginning of every task call (I'm assuming this based on what I am seeing). If I force my variable FALSE and then write it TRUE in a task, then it stays TRUE for that task, but then in the next task it will go back to FALSE.
Last updated: 2024-03-15
Post by talhaali on Create an alarm list without use of Alarm config
CODESYS Forge
talk
(Post)
Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working: VAR iCountActiveAlarms : INT; parritfActiveAlarms : POINTER TO ARRAY[0..0] OF IAlarm; itfAlarmManagerClientAll : IAlarmManagerClient; END_VAR AlarmManager.g_AlarmHandler.GetActiveAlarms( itfAlarmManagerClient :=itfAlarmManagerClientAll, iCountActiveAlarms => iCountActiveAlarms, parritfActiveAlarms => parritfActiveAlarms); The Value is always 0. Please help.
Last updated: 2024-06-06
Post by talhaali on Create an alarm list without use of Alarm config
CODESYS Forge
talk
(Post)
Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working: VAR iCountActiveAlarms : INT; parritfActiveAlarms : POINTER TO ARRAY[0..0] OF IAlarm; itfAlarmManagerClientAll : IAlarmManagerClient; END_VAR AlarmManager.g_AlarmHandler.GetActiveAlarms( itfAlarmManagerClient :=itfAlarmManagerClientAll, iCountActiveAlarms => iCountActiveAlarms, parritfActiveAlarms => parritfActiveAlarms); The Value is always 0. Please help.
Last updated: 2024-06-06
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
.