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 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 hardcoder on EtherCAT Mailbox Gateway
CODESYS Forge
talk
(Post)
Hi all I found that in the last Ethercat master release (4.8.0.0) the Mailbox Gateway feature has been added. This would be useful for me to connect to a specific slave in my system, since its configuration software supports this type of gateway communication. Anyway I don't find usage information or examples. At the moment I tried to enable it in the ethercat master device settings and I configured with an IP address on the subnet of the ethercat adapter (i.e. ethercat nic configured with static ip 192.168.10.100 subnet 255.255.255.0, mailbox gateway configured to 192.168.10.30). I expected it would have responded to ping commands on the address but nothing happens. I am missing something?
Last updated: 2024-12-11
Post by gseidel on Beckhoff AS1060 and EL7041 configuration
CODESYS Forge
talk
(Post)
Hi pmanuele, while I don't have firsthand experience with the EL7041 and the step motor AS1060, there are two things you can check: If you use an external encoder, please make sure you use the alternative device description calles "EL7041 1Ch. Stepper motor output stage (50V, 5A) Rev24 with external Encoder". The SoftMotion driver will set the feedback type automatically, and use the correct object for the actual position (16#6010:21 instead of 16#6010:20) If you have problems with changing the controller mode, I assume to velocity, please make sure you change the PDO mapping so that the actual velocity (16#6020:33) and set velocity (16#7010:33) are mapped by PDO. Hope this helps, Georg
Last updated: 2024-12-23
Post by pernockham on Slider instance value when accessed through "execute ST-code"
CODESYS Forge
talk
(Post)
I have a time which I want to modify with a slider. I have confirmed it is possible to set the value of the slider by to_real(time) (I can see that the slider changes according to 'my_time_value's value). Slider variable: to_real(my_time_value); However I fail to access the current slider instance value when I want to write back the value as time (write to a variable will not work as I need a type-conversion before assignment). my_time_value := to_time(slider-instance-value); I tried with this^.? but could not see anything interesting and also THIS^.GEN_Instance.? but nothing resemble what could be the sliders value. Anyone that knows? Thanks!
Last updated: 2025-02-06
Post by janber0206 on Adding PLC to the List view resolves in Unknown Error
CODESYS Forge
talk
(Post)
Hello, I try to add one of my PLC from the Gateways to the List view. The Gateway is shown me as online, also i have other remote tools to verify the Internet connection is working. I do the Network Scan and the Gateway shows up, i select it and click on "Add to Server". Then I type in Username and password and click on confirm. There it shows me the "Unkown Error", see screenshot. If I use the wrong credentials it gives me the error message for this. Other Devices work fine it's just this one. Greetings Jannis
Last updated: 2025-02-21
Post by agentcousto on [Bug report] Issue with Importing XML Files Containing "POINTER TO" Variables in Codesys Platform Plugins Versions 2.7 and 2.8
CODESYS Forge
talk
(Post)
Hello, I have developed a Python script that I run to import XML files into my project. For this, I use the Python function import_xml(). Everything was working fine when I was using Codesys platform plugins version 2.6.1.2320, but since I upgraded to versions 2.7 and even 2.8, some files are no longer imported correctly. After some research, I identified that all the files containing variables of the type "POINTER TO" are affected. I have attached a screenshot of the error I am encountering. Do you know about this bug? Do you plan to fix it?
Last updated: 2025-03-26
Post by aeem on CODESYS Installer does't open
CODESYS Forge
talk
(Post)
Just downloaded stand alone setup, deleted old installer and installed new. Looked up at the installation log - MSI (c) (48:E0) [19:33:49:483]: Windows Installer installed the product. Product Name: CODESYS Installer. Product Version: 2.4.0.3545. Product Language: 1033. Manufacturer: CODESYS GmbH. Installation success or error status: 0. Installer still not running EDIT: It's working. Somehow my Windows Event Log service was disabled. I restarted the service and everything is working fine right now. Click the Start Menu or (Windows key + R) Type services.msc into the search field (Enter) Open the Services app Find a service you want to disable/enable (Windows Event Log), and double click Click Start
Last updated: 2025-04-01
Post by jampid on Struct Literal
CODESYS Forge
talk
(Post)
Bonjour Davidmic, Il n'est pas possible d'associer une méthode à une fonction. Cela est possible sur les Blocs fonctions. En utilisant ta DUT MyStruct, je créé une fonction avec en entrée un tableau de structure :** FUNCTION F_F3 : REAL VAR_IN_OUT // bien définir un type IN_OUT IN_ptrINT: ARRAY[*] OF MyStruct; // la taille sera définie ultérieurement/ END_VAR VAR _di: DINT; // Index de parcours du tableau pour l'écriture dans les cases ENDVAR ============== //Programme F_F3: FOR _di := LOWER_BOUND(IN_ptrINT,1) TO UPPER_BOUND(IN_ptrINT,1) DO IN_ptrINT[_di].som:=IN_ptrINT[_di].a + IN_ptrINT[_di].b; END_FOR J'utilise ensuite cette fonction dans un POU Programme : PROGRAM Test_F_Fx VAR _aiTAB9:ARRAY[0..3] OF MyStruct := [(a := 1, b := 1.2), (a := 2, b := 2.2), (a := 3, b := 3.3), (a := 4, b := 4.4)]; END_VAR ** ==========** F_F3(IN_ptrINT:=_aiTAB9 ); Voilà l'idée pour avancer. Une autre idée, est d'utiliser les pointeurs ou les références. Bon développement!
Last updated: 2025-04-07
Post by rossanoparis on Internal Error (ARM): Unsupported conversion! With new version v3.5 SP21
CODESYS Forge
talk
(Post)
I have updated CODESYS development tool to the version v3.5 SP21 (64bit) The previous version was v3.5.20.40 Compiling an existing application with the new evelopment tool I get the following error. kunbusiodrvrevpibridge, 1.4.1.0 (kunbus gmbh): IoDrvScanModules [IoDrvRevPiBridge](Line 51, Column 1 (Impl)): Internal Error (ARM): Unsupported conversion! This error was not reported in the previous compiler version and is now highlighted in a third-party library, which I cannot change or modify. The error is due to the following conversion: m_udiError := TO_UDINT(excCode); . The excCode variable is a system type, declared as shown below, and should be converted to a UDINT excCode : __SYSTEM.ExceptionCode; m_udiError: UDINT; . I would appreciate it if someone could provide feedback on this issue.
Last updated: 2025-04-15
Post by hppatrick on Datenkonvertierung für ein SPS-AO-Modul
CODESYS Forge
talk
(Post)
Hi Leute , ich bin neu hier im Forum und habe seit kurzer Zeit mein eigenes SPS-Projekt. Ich stoße hin und wieder an Probleme aber habe diese auf kurz oder lang gelöst. Nun zu meinem Problem: Als Projekt habe ich eine Kühlwassersteuerung , die einen Relativdruck einließst, und anhand desssen Werte dann einen Frequenzumrichter ansteuert. Z. Bsp. 5Bar -> FU auf 70Prozent. Ich lese in Codesys den Analogwert mit der Wago A20_750_455_020 ein. Dieser Wert wird umgerechnet mit LIN_TRAFO in 0-10 (Bar)und und wird dann über einen PID Regler geregelt. (Bibliothek UTIL). Dieser Wert wird dann wieder für die Ausgangskarte Umgerechnet (LIN_TRAFO) . Nun zu meinem Problem : Die Ausgangskarte nimmt nur einen Word Datentyp und meine Bausteine haben den REAL Datentyp. Wenn ich einen Konvertierungsbaustein nehme, Schmeist mir Codesys einen Fehler und das Programm wird geschlossen. Könnt Ihr mir helfen? Vielen Dank im Voraus (Datei habe ich angehängt). Die Ausgangskarte ist eine Wago 750-555-08
Last updated: 2024-06-14
Post by wbj0t on What the right way to update TCP/COM slave device holding registers
CODESYS Forge
talk
(Post)
Hi all :) I have an plc. This plc has option to be as slave device. There are TCP -> Serial Slave Device and COM -> Serial Slave Device. There are 4096 ModBus holding registers with mark "internal modify" for the both devices above. So, COM Slave has 4096 registers and TCP Slave has 4096 registers. And, finally, I have an ARRAY[0..4095] OF WORD. This array glued with COM Slave and TCP slave. Yes, I need plc's opportunity to be communication both TCP and COM ways for the same registers. For example, the next task structure: * TASK_0: 1. pou_READ_Registers 2. pou_0 3. pou_1 4. ... 5. pou_N 6. pou_WRITE_Registers At the first pou I read registers for the other pous, after job we have sort of state of the plc. At the last pou (6) we write modified registers. It is a good scenario: some one wrote registers for the job, after job we save these (modified) registers. But, what if registers wrote between 1 and 6 pou by operator, for example, at the 3 pou -> the last pou 'pou_WRITE' will rewrite this request from operator. What the right way to work with this logic? Thanks you.
Last updated: 2024-07-01
Post by c3po on Von SNMP auf IIoT wechseln
CODESYS Forge
talk
(Post)
Hallo, 1. ich bin komplett NEU was Codesys angeht 2. ich muss direkt ein Retrofit machen von V2 auf V3 3. Neue Steuerung: WAGO 750-8211 PFC200. 4. das Projekt in V2 hat über SNMP daten im Netzwerk zur Verfügung gestellt, oder diese gelesen 5. das Projekt in V3 kann SNMP nur noch eingeschränkt nutzen, deswegen wurde mir vom WAGO Support nahegelegt die IIoT Lib zu verwenden. Frage: Wie mach ich das? Konkret: Ich habe die WagoAppSNMP Bibliothek installiert, damit kann ich schon mal Set und Get nutzen (hoffentlich, hab es ja noch nicht getestet, sondern nur programmiert). Ist das ein schlauer Weg, das über diese Lib zu machen? Denn: was macht der SNMP_SET_PLCDATA_WRITEAREA ? Den kann ich über die Wago Lib nicht nutzen und weiß auch nicht, was dieser Baustein konkret tut (Bild im Anhang). Es scheint mir, hier werden Daten auf ein Word im Netzwerk geschrieben? Aber geht das nicht auch einfacher? Es ist ja keine Adresse hinterlegt, wo das hin gehen soll oder? Also, ich verstehe den Baustein nicht so ganz und konnte bisher auch keine Erklärung dazu finden. Vielen Dank schon mal für eure Unterstützung, K.
Last updated: 2024-08-19
Post by struccc on Bibliothek: floatingpointutils
CODESYS Forge
talk
(Post)
The issue s the byte order typically in this case. Can be especially problematic with floating point numbers - even more tricky if transferred with a word based protocol. It is a peasant way to try out the alternatives, dword order can be a-b-c-d, b-a-d-c, c-d-a-b, d-c-b-a where a is the most significant, d is the least significant byte. So all you need is to swap the bytes in your dword, until you get the expected result. If you don't want to mess writing code for this, I'd recommend CAA_Memory library for that: MEM.ReverseBYTEsInDWORD and MEM.ReverseWORDsInDWORD functions would definitively do the trick. Otherwise, can do like this: VAR dwIn : DWORD := 16#11223344; dwOut : DWORD; rOut : REAL; pIN : POINTER TO BYTE; pOUT : POINTER TO BYTE; END_VAR pIN := ADR(dwIn); //pOUt := ADR(dwOut); pOUt := ADR(rOut); pOut[0] := pIN[3]; pOut[1] := pIN[2]; pOut[2] := pIN[1]; pOut[3] := pIN[0]; Ugly, but does the job...
Last updated: 2024-11-19
Post by george32 on TCP Server
CODESYS Forge
talk
(Post)
Thank you for your advice Rinie, I have tried to follow this example but found one problem.When I disconnect with Hercules the system does not acknowledge the lost of its connection this could result in critical errors. Because of this error I am trying to implement the Syssocket library. With this library I am having a problem which I could not solve. I have the following code: ip_adres : STRING :='0.0.0.0'; port : WORD := 5000; iStep : INT := 1; // Socket information Socket_handler : SysSocket_Interfaces.RTS_IEC_HANDLE; Socket_handler_result : SysSocket_Interfaces.RTS_IEC_RESULT; Socket_adress : SysSocket_Interfaces.SOCKADDRESS; Addres_Convert : SysSocket_Implementation.RTS_IEC_RESULT; // Bind information Bind_handler : SysSocket_Interfaces.RTS_IEC_RESULT; // Listener Information Listener_handler : SysSocket_Interfaces.RTS_IEC_RESULT; Addres_Convert := SysSocket_Implementation.SysSockInetAddr(szIPAddress:= ip_adres,pInAddr:= ADR(Socket_adress.sin_addr)); Socket_adress.sin_family:= SysSocket_Interfaces.SOCKET_AF_INET; Socket_adress.sin_port := SysSocket_Implementation.SysSockHtons(usHost:= port); CASE iStep OF 1: // Create Socket Socket_handler :=SysSockCreate( iAddressFamily :=SysSocket_Interfaces.SOCKET_AF_INET, diType:=SysSocket_Interfaces.SOCKET_STREAM, diProtocol:=SysSocket_Interfaces.SOCKET_IPPROTO_TCP, pResult:=ADR(Socket_handler_result)); IF Socket_handler = SysSocket_Interfaces.RTS_INVALID_HANDLE THEN iStep := 1; ELSE iStep := 2; END_IF 2: Bind_handler := SysSocket_Implementation.SysSockBind( hSocket:=Socket_handler, pSockAddr :=ADR(Socket_adress), diSockAddrSize:=SIZEOF(Socket_adress) ); 3: Listener_handler := SysSocket_Implementation.SysSockListen( hSocket :=Socket_handler, diMaxConnections :=1); END_CASE When I am trying to get this working, the SysSockBind function gives a value of 16#207 which means adress already in use. I find this weird because of the IP-adress of 0.0.0.0. I think I am converting the Ip-adress in the wrong way, but the code does not give a error arround this. So therefore I cannot find the solution to this problem. I hope someone could help me with this problem. Thanks in advance George
Last updated: 2025-02-20
Post by docker on Canopen connection. Unknown node id.
CODESYS Forge
talk
(Post)
hi, i am currently trying to adapt an i/o device for a project. the node id is unknown and there is no eds file available. no data is being emitted from the device as a giveaway, the baudrate is known but useless without the node id. is there an sdo request available to determine the id? i cannot get the device to leave pre op status even with a global nmt request. please help. no hair left.
Last updated: 2023-09-25
Post by timvh on Specify Input Configuration "OnDialogClosed" Action to only react to certain Dialogs
CODESYS Forge
talk
(Post)
What maybe helps is the Visu Dialog ST demo project: https://store.codesys.com/en/visu-dialog-st.html This has an application IECOpenDialog where dialogs are opened using the VU.FbOpenDialogExtended function blocks. The fbOpenConfigurationDialog call has a reference (interface) to the "close listener" FB of which it's method is automatically called when the dialog is closed. This way you can create specific function blocks for each dialog when it is closed and do what you want with the data that might have been changed.
Last updated: 2023-09-28
Post by voffi on Converting UINT into bytes and converting 2Bytes into UINT
CODESYS Forge
talk
(Post)
There are some ways. One is to use SHR and SHL and it depends on your byte order in the data array. For Motorola byte order: PROGRAM PLC_PRG VAR u : UINT; byte_array_in : ARRAY [1..8] OF BYTE := [16#11, 16#12, 16#13, 16#14, 16#15, 16#16, 16#17]; byte_array_out : ARRAY [1..8] OF BYTE; END_VAR u := SHL(TO_UINT(byte_array_in[2]), 8) + TO_UINT(byte_array_in[1]); byte_array_out[1] := TO_BYTE(u); byte_array_out[2] := TO_BYTE(SHR(u, 8)); If it's Intel byte order just change 1 and 2 in the array indexes.
Last updated: 2023-12-07
Post by tvm on VisuFbFrameBase.SetInputPositionData: The element id for the input position cannot be determined
CODESYS Forge
talk
(Post)
I'm getting this error on one of my projects. Searching for it I came across this https://www.codesys.com/fileadmin/data/Images/System/Releaseinformation/Patch-Note-CODESYS-Visualization-4300.html which says it was a bug VIS-1394, fixed in Visualization 4.3.0.0. I'm using a previous visu version, what is the cause of this error, and what can be done to work around it?
Last updated: 2024-02-08
Post by wind-11 on Problem with simulation Modbus
CODESYS Forge
talk
(Post)
Hello everyone, I encountered a problem in the simulation while working. In a test project we set up a Modbus connection. We wanted to simulate this with test values. The connection also worked, but unfortunately the values are frozen and do not report any “current data”. (Picture attached) Since these are my first points of contact with Codesys and my colleague continues to work elsewhere, I was hoping that someone here might have an idea. Kind regards and thanks in advance.
Last updated: 2024-03-22
Post by dagsupport on CAA SerialCOM - hCom Reset max value 1023
CODESYS Forge
talk
(Post)
Hi everybody We are currently working on a project with an RS232 serial COM interface and using the CAA SerialCOM library. We have it working fine reading and writing data, although we have found an issue we cannot resolve and any suggestions would be helpful. We have noticed that after a while the RS232 stops working. We have tracked this down to the HANDLE hCom keeps increasing and when this reaches 1023 the COM returns an unknown error "5003". Is there a way to reset this hCom reference? Thanks Richard
Last updated: 2024-03-22
Post by hjohnson123 on Automatically selecting a visualization element
CODESYS Forge
talk
(Post)
I'm looking to automatically select a text field element in my visualization. I'm not sure if this is possible, as I don't know how to get the data on specific elements. I am wanting automatic selection of the text field, as I am using a keyboard-input barcode scanner, which should always input the barcode into the text field whenever a barcode is scanned. Does anyone know if this can be done?
Last updated: 2024-05-21
Post by liamb on Converting CANbus to Decimal from signed 2's complement
CODESYS Forge
talk
(Post)
I need to combine two 8 bit CANbus messages to 16 bits signed int then convert to decimal Decimal from signed 2's complement. I've been using the below code to read for new messages, combine them then assign them to a variable What is the best way to do this for from signed 2's complement? fbRxMessage351(Data := RxMessage351Data); IF fbRxMessage351.NewMessage THEN ChargeVoltage := (WORD_TO_REAL((RxMessage351Data[0]) + ((RxMessage351Data[1]) * 256))) * 0.1; END_IF
Last updated: 2024-08-16
Post by egau on Mutate Hash table value
CODESYS Forge
talk
(Post)
Hi, using the ElementCollections Library, why isn't it possible to mutate a value found within a HashTable? From what I understand, the only way to change a value would be to use the RemoveByKey(), followed by AddKeyValuePair(). My goal is to use a Data Structure that works like a Dictionary in Python. The HashTable seems to come close to this, except that the values themselves seem to be immutable... In python, we can mutate a dict easily (see attached picture).
Last updated: 2024-08-29
Post by docker on Webvisu client connection monitoring
CODESYS Forge
talk
(Post)
Hi mate, With this snippet i was able to see the lastusage variable count, but it would not iterate between clients? i was only able to access the data of the target visu. it threw an error with the array of pointers stating it was not able to convert etc. also when i tried it with the while loop it created an endless loop and crashed the program. any ideas? Thankyou
Last updated: 2024-09-10
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
.