Post by ara32 on CODESYS 4 Linux:
CODESYS Forge
talk
(Post)
Hello! I managed to correctly launch CODESYS Developer Studio 3.5.17, almost all functionality works. The only issue remaining is that when connecting to a device and obtaining its public key, the NCryptEncrypt function is called, which is not fully implemented in the DLL source code, resulting in the connection not being established. Currently, the code of this function in the Wine repository looks like this: SECURITY_STATUS WINAPI NCryptEncrypt(NCRYPT_KEY_HANDLE key, BYTE *input, DWORD insize, void *padding, BYTE *output, DWORD outsize, DWORD *result, DWORD flags) { struct object *key_object = (struct object *)key; TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n", key, input, insize, padding, output, outsize, result, flags); if (flags & ~(NCRYPT_NO_PADDING_FLAG | NCRYPT_PAD_OAEP_FLAG | NCRYPT_PAD_PKCS1_FLAG | NCRYPT_SILENT_FLAG)) { FIXME("Flags %lx not supported\n", flags); return NTE_BAD_FLAGS; } if (flags & NCRYPT_NO_PADDING_FLAG || flags & NCRYPT_PAD_OAEP_FLAG) { FIXME("No padding and oaep padding not supported\n"); return NTE_NOT_SUPPORTED; } if (key_object->type != KEY) return NTE_INVALID_HANDLE; return map_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key, input, insize, padding, NULL, 0, output, outsize, result, flags)); } The program crashes due to the NCRYPT_PAD_OAEP_FLAG flag. I'm not proficient in C++, but I attempted to add handling myself, and here's the result: SECURITY_STATUS WINAPI NCryptEncrypt(NCRYPT_KEY_HANDLE key, BYTE *input, DWORD insize, void *padding, BYTE *output, DWORD outsize, DWORD *result, DWORD flags) { struct object *key_object = (struct object *)key; TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n", key, input, insize, padding, output, outsize, result, flags); if (flags & ~(NCRYPT_NO_PADDING_FLAG | NCRYPT_PAD_OAEP_FLAG | NCRYPT_PAD_PKCS1_FLAG | NCRYPT_SILENT_FLAG)) { FIXME("Flags %lx not supported\n", flags); return NTE_BAD_FLAGS; } if (flags & NCRYPT_NO_PADDING_FLAG) { FIXME("No padding not supported\n"); return NTE_NOT_SUPPORTED; } BCRYPT_OAEP_PADDING_INFO oaepInfo = { 0 }; oaepInfo.pszAlgId = BCRYPT_SHA1_ALGORITHM; NTSTATUS status = BCryptEncrypt(key_object->key.bcrypt_key, input, insize, &oaepInfo, NULL, 0, output, outsize, result, flags); if (key_object->type != KEY) return NTE_INVALID_HANDLE; return map_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key, input, insize, padding, NULL, 0, output, outsize, result, flags)); } Now, when calling the connection, it crashes with the error "bcrypt:BCryptEncrypt flags 0x4 not implemented." Can anyone help with enhancing this functionality or at least point me in the right direction?
Last updated: 2024-03-22
Post by herbasso88 on WebVisu flickering
CODESYS Forge
talk
(Post)
Good morning, I'm new on Codesys Forge, so I'm not sure if this is the right place to talk about my problem. When I open my WebVisu pages with Microsoft Edge, or Chrome, the background and also some rectangles blinking without reason!!! The application is developed with Codesys 3.5.17.10 and run on Codesys HMI, same version (3.5.17.10). After several experiments I discover that the problem happens when I made dynamic the "End of area" property of a meter object, but I can't understand why this blinking problem happens. Also, the problem is only at the WebVisu page, the "normal" VISU pages (the ones opened when Codesys HMI start) work always perfectly. Another strange thing is that the problem happens only if on the same page, where there is the meter object, there is also a trend object!?!? Codesys HMI is running on a Virtual Machine (VMware Workstation 15 player, v.15.5.6) running Windows 10 Pro N 64-bit. The blinking problem happen also if I convert the project to Codesys 3.5.20.0. This version of Codesys and Codesys HMI are installed on a Virtual Machine running Windows Server 2019 Standard 64-bit. In attachment the archive of my project. The attached project has only one page, if "Enable Counter" is not pressed the "End of area" variable of the meter is not updated in the software, and everything work well, normal VISU and WebVisu; if "Enable Counter" is pressed, the "End of area" variable of the meter is updated in the software, and the WebVisu page start blinking. I tried also to enable the "Support client animations and overlay..." property at VisualizationManager, this seems stop the blinking problem, but that property also destroy my WebPage, moving almost all the graphical object, that also seem not working anymore. I really need help to understand what I'm doing wrong, I have to develop a bigger project and I have to understand if trend objects and animated meters cannot stay in the same page. In the final project the WebVisu will be very important because the customer will use this way to access the application to monitor the process. Regards
Last updated: 2024-05-06
Post by benediktenger on Access project information of references library by script
CODESYS Forge
talk
(Post)
Hi, I need to accesss to project information of a referenced library in the project. At least I need the "Released" flag from these information to check that no project gets shipped with unreleased libraries. Unfortunally, I do not get this information by script. I archieved to get the library reference object and the managed library object but both won't give me this flag but only basic information like company, name, version, etc. Here is my code: # get the library refernces proj = projects.primary objects = proj.get_children(recursive=True) for object in objects: if object.is_libman: for libref in iter(object): if libref.is_placeholder and isinstance(libref.effective_resolution,str): print(libref) print(libref.name) # get the managed libraries libs = librarymanager.get_all_libraries() for lib in libs: print(lib.displayname) print(lib.version) Does somebody know how do get these information?
Last updated: 2023-10-23
Post by fabian on Sys Process Execute Command
CODESYS Forge
talk
(Post)
Hello, I have a question: Once the command is being executed, is there a way to kill it again? As the called application is running in the background, the user can't close it but it shall be closed/terminated, commanded by codesys. I have tried with "SysProcessTerminate" but I guess this is not correct as the RTE crashes when this function is called. Starting the application: IF GVL.xStrtQR THEN GVL.xStrtQR := FALSE; SysProcess.SysProcessExecuteCommand2(pszCommand:=sCmd, pszStdOut:=stdout, udiStdOutLen:= SIZEOF(stdout),pResult := ADR(GVL.pResQRTsk)); END_IF Trying to stop it again: IF GVL.xTrmQR THEN GVL.xTrmQR := FALSE; pResTerm := SysProcess.SysProcessTerminate(hProcess:=SysProcess.SysProcessGetCurrentHandle(pResult:=ADR(GVL.pResQRTsk))); END_IF Codesyscontrol Win x64, 3.5.19.10. Many thanks for any advice pointing to the correct direction.. :-) Regards, Fabian
Last updated: 2023-11-17
Post by mark on IO link on IFM AL133x only single digital input on a channel
CODESYS Forge
talk
(Post)
I have a problem with the CODESYS IO-Link SL software. When I insert a IO link master AL1332 and plug a discrete digital input to a channel it reads only 1 of the 2 available inputs on that channel. Is there anyone who sorted out if the second input is also usable? When we configure the module without the CODESYS IO-Link SL software then the second input on the channel can be used. At the moment we use some channels on a module as IO-link port, and some as discrete IO. It would be very nice if we can use both inputs on a channel with the use of CODESYS IO-Link SL.
Last updated: 2023-12-18
Post by royw on Profinet library for C#
CODESYS Forge
talk
(Post)
Hi, I don't know if I'm in the right place or if it's even possible... I'm looking for a way to address a Profinet device with Record Read and Write from my own PC. I actually only need very few commands to configure our device. This means setting the MAC address and a serial number. We would like to do this from a C# program. Now we are looking for a library or something similar. Since you can do it from Codesys, I thought there might be a DLL or something similar that you could use for this. As I said, we don't want real-time queries of the cyclic data but only record read/write. Does anyone have any helpful hint? Thanks in advance
Last updated: 2023-12-22
Post by mohammadasif on Blink Function definition is wrong in codesys online help
CODESYS Forge
talk
(Post)
https://content.helpme-codesys.com/en/libs/Util/Current/Signals/BLINK.html in the above link, please correct your website the following: "Output value, starts with FALSE and switches between TRUE and FALSE for the given high and low times" it should actually be: "Output value, starts with TRUE and switches between TRUE and FALSE for the given high and low times" if not please let me know if this has changed in a util library update, in your older website it has the right definition here: https://help.codesys.com/webapp/blink;product=codesys;version=3.5.11.0
Last updated: 2023-12-28
Post by dhumphries on Codesys device configuration
CODESYS Forge
talk
(Post)
First make sure the programming laptop and HMI are both on the same subnet. For example if the IP address of the HMI is 192.168.1.125 with a subnet mask 255.255.255.0 set your laptop IP to 192.168.1.120 with a subnet mask of 255.255.255.0. Make sure the cables are fully connected (the ethernet port on my programming laptop will click once but the cable is not fully seated.) Make sure the HMI is powered on, try pinging the device from a command prompt, if you can't ping the HMI there is a network issue that has to be resolved first.
Last updated: 2023-12-30
Post by imuser on Is it possible to use debug functions such as Step Execution while the PLC ladder is in Running?
CODESYS Forge
talk
(Post)
Hello, I am a student learning CODSIS. Lately, I've been curious about something. During the actual PLC run, that is, Assume that the I/O is connected to a physical device and the analog value is updated in real time. Is it possible to use a feature like Codesysβ Debug-Step Over-Step IN? If possible..... How do I process the values of analog values (pressure sensor, temperature, current, etc.) that are being updated in real time? To step over, the ladder must stop at the breakpoint. If that happens, the PLC will actually stop, right??
Last updated: 2024-01-16
Post by dkugler on Toggling Visualizations using HMI Physical Buttons
CODESYS Forge
talk
(Post)
the magic option is named "Use CurrentVisu variable" activate this option in the Visualization Manager an have a look: https://help.codesys.com/webapp/_visu_obj_manager;product=core_visualization;version=3.5.14.0 if your button is pressed, "feed" the string varable VisuElems.CurrentVisu := 'visu1'; with the correct name of the depending visu. alternative: place a frame element at a empty main visu, konfigure all visus to be shown by this frame. With setting the switching variable of the frame to the index value of the depending visu, it will switch to it. Advantage: the visu names are not hardcoded as string in the ladder lodgic. Good luck! Hint: If you have multiple VisuClients(Target, WebVisu,...) all will show the same visu. Independent switching is much more difficult, but there is a example from codesys.
Last updated: 2024-02-13
Post by alexgooi on Function Blocks and arrays of function blocks
CODESYS Forge
talk
(Post)
Hi Jack, I think you have to look at a FB in a different way. A Function block (Class) can contain its own data. In other words don't define loose data in your GVL, but define a instance of a FB (Object) in your GVL: Example: Function_Block Basic_Class VAR_INPUT Open_Command: BOOL; END_VAR VAR_OUTPUT Opened: BOOL; END_VAR if Open_Command then Opened := TRUE; ELSE Opened := FALSE; END_IF Global Variables Objects: ARRAY[1..100] OF Basic_Class; //Here you ar defining you objects END_VAR In your code you can directly acces the data and couple it to the IO: GVL.Objects[1].Open_Command := %IX0.0; %QX0.0 := GVL.Objects[1].Opened; //To call the code itself use: GVL.Objects[1](); If you want to take this a step further you are also able to add methods and properties to the FB/Class end thereby creating a OOIP program
Last updated: 2024-02-15
Post by ewi04 on How to upload application file to remote controller (offline) ?
CODESYS Forge
talk
(Post)
Thank you very much for your time and replay! Sounds like a good idea. Unfortunately, I have no other option to run the code from the running plc. So, I canβt stop any services. If anyone has the same problem, I've gotten a little closer to understanding it: Sometimes the copied files are empty after the restart. The update code checks if there are any empty files. Before I turn off the device, everything is okay. But after starting, some files are suddenly empty and that cause the problems. I don't know why this happens.
Last updated: 2024-02-16
Post by dhumphries on Not able to see input data coming from eip adapter on codesys
CODESYS Forge
talk
(Post)
Does the device have a green icon next to it when the PLC is running? If not you have some kind of communication problem, wireshark may be picking up some data but the scanner may not be configured correctly to receive the data. Check the T>O and O>T bytes and make sure they match on both the scanner and adapter. I've had very little success loading a .eds file and having the configuration work without some manual configuration. If you have a green icon, have you enabled the device to always update variables?
Last updated: 2024-03-02
Post by tomast on WAGO 750-8212 nad Sinamics v20 modbus RTU speed control
CODESYS Forge
talk
(Post)
Hi Guys, I am new to this forum and i would like to ask od anyone got communication with Siemens v20 vfd working via Modbus RTU? I followed many websites and finally got the communication working but have problema with read/write registers. For example if i try to read holding register 40011 which is accel time i get noth but when i set the offset 0x0000 en length 113 i get ale the registers. I cannot get speed control working. I read someth about stw (control Word) and hsw but have some problems to understand it en get it working. It would be really nice if someone could help me with it. Thx
Last updated: 2024-03-05
Post by mwandy on Codesys Project Protection
CODESYS Forge
talk
(Post)
I'm having trouble finding clear answers on this. I'm looking for a way to make a Codesys project password protected so that if the project is distributed it can be used to log into a controller to view and debug logic. At this same time I want to prevent the project from being saved as well as edits being downloaded to the controller. Basically I want to make a whole project view-only. What is the beat way to achieve this? I have had minor success with access rights, which solves the problem with trying to login if the project doesn't match what is in the controller. However with this solution, edits can still be made and saved, possibly corrupting the core project, preventing future logins. Any suggestions?
Last updated: 2024-03-29
Post by alexgooi on Modbus writing on value change
CODESYS Forge
talk
(Post)
The way I usally tackle this is by syncing only words (then you are able to use the FB above). If you then want to write a Boolean simply type it like this. Value[1].0 := Bool1; Value[1].1 := Bool2; Value[1].2 := Bool3; Uints have the same number of bits than a INT/WORD so these ones will work as well (they are only represented diffrently). A Real will work but you will loose some infomration in the conversion. If you want to keep the information you can convert 2 words to a float with a function (for example with the IEEE-754 standard) . In this way the syncing to the server is very simple and in the Codesys Program you decide what part of the word you want to use.
Last updated: 2024-04-03
Post by dkugler on build (F11) / generate code using a python script file
CODESYS Forge
talk
(Post)
thank you very much! I found the generate_code methode, but struggled with the primary and active_application. With this expample I will be able to play around. If the code generation takes a minute or more I often switch to other programs and don't notify the process is finished. So now I'll get an alert and will switch back immediately. My next little project will be, to beep different if there are errors and a seperate script to do the download incl. the user management data base without stopping at the dialogs asking for onlinechange/complete download and overwriting an existing database and as goody, play a beep/sound again.
Last updated: 2024-04-11
Post by pethun on Upgrade from codesys 3.5.19 to 3.5.20
CODESYS Forge
talk
(Post)
Hi We upgraded our ptoject from 3.5.19 to 3.5.20 but we get an error message in the latest version. We made our own trend function and its related to this we get error message: Trend_Menu Device: PLC Logic: Application: C0032: Cannot convert type 'RTS_SYSTIMEDATE(systimertc, 3.5.20.0 (system))' to type 'RTS_SYSTIMEDATE(systimertc, 3.5.17.0 (system))' The variables are defined as follow: start : SysTimeRtc.SYSTIMEDATE; end : SysTimeRtc.SYSTIMEDATE; The code that creates the error is the variable start and end IF xAssign THEN xAssign := FALSE; xPanEnable := FALSE; xZoomEnable := FALSE; drs.liFrom := VisuTrendStorageAccess.TrendStorageConvertToTimestamp(start, 0 (us)); drs.liTo := VisuTrendStorageAccess.TrendStorageConvertToTimestamp(end, 0 (us)); drs.m_itfDateRangeSelectorClient.SetCurrentRange(drs.liFrom, drs.liTo); END_IF I cant understand really what the error message means and what can be the cause of the error? It compiles fine in dthe older codesys 3.5.19. If anyone has some experience of this please help us out? We must upgrade due to the new licenses. Thanks
Last updated: 2024-04-20
Post by pethun on Upgrade from codesys 3.5.19 to 3.5.20
CODESYS Forge
talk
(Post)
Hi We upgraded our ptoject from 3.5.19 to 3.5.20 but we get an error message in the latest version. We made our own trend function and its related to this we get error message: Trend_Menu Device: PLC Logic: Application: C0032: Cannot convert type 'RTS_SYSTIMEDATE(systimertc, 3.5.20.0 (system))' to type 'RTS_SYSTIMEDATE(systimertc, 3.5.17.0 (system))' The variables are defined as follow: start : SysTimeRtc.SYSTIMEDATE; end : SysTimeRtc.SYSTIMEDATE; The code that creates the error is the variable start and end IF xAssign THEN xAssign := FALSE; xPanEnable := FALSE; xZoomEnable := FALSE; drs.liFrom := VisuTrendStorageAccess.TrendStorageConvertToTimestamp(start, 0 (us)); drs.liTo := VisuTrendStorageAccess.TrendStorageConvertToTimestamp(end, 0 (us)); drs.m_itfDateRangeSelectorClient.SetCurrentRange(drs.liFrom, drs.liTo); END_IF I cant understand really what the error message means and what can be the cause of the error? It compiles fine in dthe older codesys 3.5.19. If anyone has some experience of this please help us out? We must upgrade due to the new licenses. Thanks
Last updated: 2024-04-20
Post by bjarne-pagaard on Codesys v3.5 Sint to byte
CODESYS Forge
talk
(Post)
Hi A SINT is a short (signed) integer. It is already only 1 byte - so you should have no problem casting it to a byte like so: bMyByte := TO_BYTE(sintMyShortInt); If you have a regular INT you want to put in 2 bytes - there are a lot of ways you can do this. A Union is certainly one of them. You could have a union with 2 memebers: An array of 2 bytes as one member, and an integer value as another member. Another way would be to look at MEMCPY to put the value into your CAN-message. .. or create a function to take your input value as input, and giving you 2 individual bytes as output. This could be handy if you need to change the byte-order. Integer data types: https://help.codesys.com/webapp/_cds_datatype_integer;product=codesys;version=3.5.17.0 -Bjarne
Last updated: 2024-04-24
Post by westcountryewe on Persistence Variables missing and DO NOT retain from Persistence Channel when using Boot Application
CODESYS Forge
talk
(Post)
We've been experiencing an issue through SP18, SP19 and now SP20 where the Persistence Variables do not retain if we upload our program via a Boot Application. If we use the exact same program, and perform a Direct Upload via the Laptop and Ethernet connection, the Persistence Variables work exactly as expected. I have submitted 2 bug support tickets but I haven't had a response back from Codesys. Has anybody experienced the same issues and discovered a workaround? We have a requirement to utilise the Boot Application method because of logistical restrictions of being able to get out to every site, so at the moment it's a bit restriction.
Last updated: 2024-05-15
Post by paro on Modbus Client Request Not Processed
CODESYS Forge
talk
(Post)
Hi, works in my case if I increase the timeout! to_udint(t#100ms) -> 100 -> 100us.. FUNCTION_BLOCK MODBUS_master_example_ST VAR initDone : BOOL := FALSE; aIPAddress : ARRAY [0..3] OF BYTE := [127,0,0,1]; clientTcp: ModbusFB.ClientTcp; // buffer to read input registers aDataInputRegisters : ARRAY[0..9] OF UINT; // some client requests clientRequestReadInputRegisters: ModbusFB.ClientRequestReadInputRegisters; xExecute: BOOL; uistart: UINT := 100; udiTimeout1: UDINT; END_VAR IF NOT initDone THEN initDone := TRUE; // configure clientTcp clientTcp(aIPaddr:=aIPAddress, uiPort:=502, udiLogOptions := ModbusFB.LoggingOptions.All); // configure clientRequestReadInputRegisters clientRequestReadInputRegisters(rClient:=clientTcp, uiUnitId:=1, udiTimeout:=1000000); // 1sec END_IF // call the client FB's clientTcp(); clientRequestReadInputRegisters(rClient:=clientTcp,xExecute := xExecute AND NOT clientRequestReadInputRegisters.xBusy ,uiStartItem:=uistart, uiQuantity:=3, pData:=ADR(aDataInputRegisters[0]));
Last updated: 2024-05-30
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 mubeta on parker servo and position
CODESYS Forge
talk
(Post)
Reading between the lines of what you did not specify, it therefore seems to appear that in the programme, at the end of the movement order, there is an order to remove power and switch off the pulse modulation. if this is the case, it is obvious that the motor then remains free. If the position is to be maintained at the end of the movement, the motor current modulator, which on the PLC side is controlled via the MC_Power method, must not be interrupted. Another possibility is that in the motor drive settings, the standstill torque current is set very low or zero and without position monitoring. You have to check this via the servo motor drive.
Last updated: 2024-08-05
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
.