Post by alimans on Hex string
CODESYS Forge
talk
(Post)
Hi kdkwhite, for Word you still can use suggested code by using a union structure and crack down your Word to two byte as bellow: TYPE CrackWordToByte : UNION InWord : WORD; OutBytes : ARRAY [0..1] OF BYTE; END_UNION END_TYPE then define your variable as this type: udInput : CrackWordToByte; now assign your Word variable input to InWord and send OutBytes[x] to the mentioned method: udInput.InWord := WordVariableInput; Input := udInput.OutBytes[x]; Regarding your question about the code: actually 48 is ascii code of "0" and while 65 is the ascii code of "A" so in above code 55 + 10 would be 65.
Last updated: 2023-09-20
Post by matthew on New Ladder Editor Issues
CODESYS Forge
talk
(Post)
Hi There, When using the new ladder editor there is no option for function blocks to Remove uncalled FB call parameters. I also see no update function block. When you double click the function block it no longer opens the function block. I also now get warnings if I insert FB call without a contact in front. Warning is: (Impl)): C0373: Expression or part of it has no effect I take it the new editor must work differently? The only reason for using new ladder editor is the ST execute/block editing is far better, If you have alot of text in the old ST execute the editor window is very small and when online it's even worse. The new ST block seems a lot better Thanks!
Last updated: 2023-10-10
Post by matthew on Persistence Manager Backup
CODESYS Forge
talk
(Post)
Hi, Is there a process to restore Persistence Manager files? I have backups of persistence variables used in a machine that is currently operating and tuned and all set points adjusted. There are about 500 persistence variables, they are building another identical machine. I would like to use Persistence Manager files from the first machine in the second also. I have tried copying the files and replacing them on the new RPI but then the Persistence Manager gets errors and then they are all reset to 0 etc I have tried adjusting the times to match. Instead of replacing whole file, I tried just changing the contents inside the file, but still does not work. I may be missing something here, but surely there must be a way to load a backup. Thanks!
Last updated: 2023-10-18
Post by simotion on Pointer to Softmotion axis
CODESYS Forge
talk
(Post)
In my projet I use Softmotion. There are several Softmotion axis (type SM_Drive_Virtual). In the Global Variable List I have an array of pointers to the adress of the Axis. Axis : ARRAY[1..iMaxCntAxes] OF POINTER TO AXIS_REF_SM3 := ADR(AX01_Axis), // [1 ADR(AX02_Axis), // [2] This works, but when compiling I get the message : . [WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX01_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior. [WARNING] E3D: GVL Device: PLC Logic: Application: C0564: A reference to uninitialized variable AX02_Axis is used for initialization of Axis. Accessing the uninitialized variable may result in unexpected behavior. Is there a way when initializing to force the hardware (softmotion axis) to first initialize and then the Global Variable List?
Last updated: 2023-10-25
Post by macros8 on Alarm Management - latched variable represented as Text list
CODESYS Forge
talk
(Post)
Hi, I haven´t noticed you put the comment here. I thing it´s a bit different. What I want is to have detail errors of technology in data type e.g. INT. This variable I would latch to the corresponding error msg but I would like to get it convert to text from the text list and not keep it in INT form. Example. Main error Valve Error: SubErrors 1 - Both sensors 2 - Not retracted in time 3 - Not pulled out in time In HMI Main error + latch SubErrors => "Valve Error: Both sensors" The benefit is that text lists are part of translation and can be easily manipulated. I know I can create whole string msg in PLC but then, it lose advantage of Alarm management. Thanks. M.
Last updated: 2023-11-07
Post by bernd on Version 3.5.19.40 probleme bei FUN mit _to_ im Name
CODESYS Forge
talk
(Post)
Hallo, ich habe von Version 3.5.19.0 auf 3.5.19.40 hochgerüstet, jetzt bekomme ich bei allen FUNs die "to" im Namen haben einen Fehlermeldung. Oft in der OSCAT.LIB verwendet. Gleiche Meldung wenn ich einen FUN neu anlege. Sobald ich das to weglasse z.b. nur "t" ist der Fehler weg. Programm ist unverändert. Fehlermeldung: Typ.... wird nicht unterstützt. Hat jemand das gleiche Problem? Bzw. wo liegt das Problem? Bzw. nutzt jemand das SP4 und bei ihm kommt der Fehler nicht? Läuft bei mir auf Rasperry. Beispiel: DT_TO_SDT -> Fehlermeldung Typ DT_TO_SDT wird nicht unterstützt. DT_T_SDT -> Übersetzung Fehlerfrei
Last updated: 2023-11-09
Post by ewi04 on Recipe Manager - RecipeManCommands, load & write wrong values, Bug?
CODESYS Forge
talk
(Post)
I'm getting closer to the error. The combination of STRUCT and ARRAY probably causes the strange behavior. As soon as the ARRAY is followed by a variable, the problem arises. Examples: X: ARRAY[1..2] OF INT; // okay Y: ARRAY[1..2] OF STRUCT; // problem Z: STRUCT; Z.ArrayOfInt[1]; // okay Z.ArrayOfStruct[1].Variable // problem // *update - array of array also causes the error A: ARRAY[1..2] OF ARRAY[1..4] OF BOOL; // problem I can't be the only one who has this problem. Or? Maybe there is a solution. Anyone? Or is it a bug after all?
Last updated: 2023-11-17
Post by captaincookie on SP19 Runtime Zugriff auf lokales Dateisystem
CODESYS Forge
talk
(Post)
Hallo, das konkrete Problem konnte ich seither leider nicht lösen, allerdings habe ich mit SP19 Patch 4 einen Workaround gefunden, der zumindest für meine Anwendung funktioniert: Zunächst besteht das Problem nicht für alle Funktionalitäten gleichermaßen. Die Anzeige einer .bmp oder .tiff-Datei im Visu-Elementtyp Bild beispielsweise funktioniert aus dem lokalen Dateisystem. Die Anzeige von .cnc-Dateien in einer Tabelle dagegen nicht. Allerdings funktioniert das wiederum, wenn der Dateipfad in den Ordner der PLC führt, genannt '_cnc'. In der PLC wird dieser Ordner über den Pfad _cnc/ erreicht. Auch lohnt es sich einen Blick in die PLC Config-Datei zu werfen und ggf. Anpassungen vorzunehmen. Einzelne Einträge definieren Zugriffsrechte und ähnliches. Die beschriebene Lösung ist nicht sonderlich schön und es erklärt das Problem nicht. Vielleicht kann das noch jemand anders beantworten.
Last updated: 2023-11-22
Post by manuknecht on Using SMC_MOVTYP.INITPOS without specifying the start position
CODESYS Forge
talk
(Post)
I am using the object SMC_GEOINFO to generate a trajectory and move a system accordingly using the SMC_INTERPOLATOR function block similar to the sample project CNC10_DynamicPath.project. According to the documentation, the movement type INITPOS does not require a start position in the SMC_GEOINFO object, which is confirmed in the documentation of the SMC_GEOINFO object. When using the movement type INITPOS however, the motion will still start from the starting point defined in the SMC_GEOINFO object (0,0,0 if not specified otherwise). Does someone know how to resolve this or is there an example project that makes use of the INITPOS movement type without specifying the starting point? Thanks in advance!
Last updated: 2023-12-15
Post by sawicpx on CANbus Remapping PDOs During Runtime
CODESYS Forge
talk
(Post)
Hello, I am working on an application where I need to remap PDOs to a different CANopen object during runtime depending on what value is at a specific register. I have gotten to the point where I put the device into Preoperational State using the CIA405.NMT function. I then reconfigure the PDO 180x and 1a0x obejcts usings SDOs to point to a new canopen object on the device however when I go to restart the Device from PREOP to OP using the CIA405.NMT function the device is reset back to the original configuration as per the initial setup. I am wondering is there any way to change the PDOs at runtime is there some more functionaility I can access to do this. Any direction is appreciated!
Last updated: 2023-12-22
Post by macros8 on Translation - How to get text as reference in Frames translated?
CODESYS Forge
talk
(Post)
Hi, thanks for the link. Maybe I create elements in incorrect way. I always use Interface Editor to create variables which are used inside element (see pics). After that I place element in my visu and use Reference property to link variable or set the value. In that case the value of string is not transferred to general text list for translation as I mentioned before. Do I have to all properties which influence behavior of my element create in Frame configuration instead? What´s the difference to the Interface editor? Thanks a lot. M.
Last updated: 2024-01-02
Post by joanm on Programmatically change the IP addresses of the Modbus TCP slave devices
CODESYS Forge
talk
(Post)
Hello all, I am working in a project in which there are multiple Modbus TCP slaves. I need to be able to change the IP addresses of those devices from the HMI and I was planning to use the process depicted here: https://faq.codesys.com/display/CDSFAQ/Modbus+TCP+Slave%3A+Dynamic+Setting+of+the+IP+Address I can see the port number is what is used to specify which slave device we want to modify the IP address of. This said, can I freely set arbitrary port numbers to each device? I mean, can I set the first device to be at port 502, the second one at port 503... Any drawback or restriction? Is there any other way to reference to the device without having to change the port numbers? Thank you all in advance.
Last updated: 2024-01-04
Post by jeroen on Ramp function
CODESYS Forge
talk
(Post)
Hi, Found a nice ramp function in the OSCAT lib (FT_RMP), but is there a nice way to 'set' the output to the current input as form of a reset. The reason for this, is that I want to set up a ramp for a pressure control input that should have x Bar/sec linear rise input. The only option (or code it by hand) I found is this OSCAT FB. Any other options? Just need to increase a value by x Bar/sec from let's say 250Bar (as start) to end 1500Bar. The Oscat ramp will always start at 0 when enable is off (FT_RMP.Rmp := FALSE)
Last updated: 2024-01-09
Post by yang123 on EtherCAT Can't reconnect to servo drive
CODESYS Forge
talk
(Post)
I am using Ethercat Master 4.6.0.0 and have use the automatic restart slaves feature. But we found of after the Ethercat communication normal and slave drive power-off and power-on the slave can't reconnect sucess. The PLC Log show the drive was al status "6#34 : Invalid DC Timeout Error" and its was reconnection sucess first but seconced later the drive will show the "16#2C : Fatal Sync error" and then drive will can't reconnection. Other slave are reconnect sucess which was link after the can't reconnect's drive the drive was OMRON R88D-1SN
Last updated: 2024-01-23
Post by matt-s on HMI Pushbutton/Move Instruction
CODESYS Forge
talk
(Post)
I am having an issue where the manual start/stop push buttons on the HMI are supposed to take the pumps/blowers out of auto. The logic I have attached works for the pumps, but not the blower. From what I can tell it is the exact same logic, but it is not writing a 0 to the Auto PB variable. Attached is the logic, cross reference list to show nothing else is writing to it, and the HMI screen. Any help? Am I missing something? I am using a Groov Epic PR1, my software version is 3.5 SP19 Patch 5 32 Bit.
Last updated: 2024-01-25
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 eschwellinger on Zielsystem stimmt nicht mit dem verbundenen Gerät überein
CODESYS Forge
talk
(Post)
na ja es gibt halt einfach die Möglichkeiten: 1. Man installiert Raspberry PI OS 32Bit -> dann geht PI SL und PI MC Multicore als Target 2. Man installiert Raspberry PI OS 64Bit dann muss es PI64Bit sein falls der Übersetzungsfehler nicht in einer Bibliothek ist (die du vielleicht nicht ändern kannst) https://faq.codesys.com/pages/viewpage.action?pageId=128253958 Hier der Hinweis was man tun muss das dein IEC Code für 32Bit als auch 64Bit Targets funktioniert Also entweder zurück auf Raspberry PI OS 32 Bit: nur zur Info noch was im Config file steht für welche Plattform/Produkt [CmpRasPi] Architecture=aarch64 (-> 64Bit PI) oder Architecture=armv7l (-> PI MC Multicore) oder Architecture=armv6l (-> PI SL Single Core)
Last updated: 2024-03-11
Post by bschraud on Zielsystem stimmt nicht mit dem verbundenen Gerät überein
CODESYS Forge
talk
(Post)
Zu der o.g. Fehlermeldung "cmperrors interfaces, 3.5.5.0 (system): C0338: Die Bibliothek 'cmperrors interfaces, 3.5.5.0 (system)' wird nur in 32-Bit-Applikationen unterstützt": Wie kann ich die Bibliothek finden, die den Fehler verursacht? Beim Doppelklick auf die Fehlermeldung würde ich einen entsprechenden Hinweis erwarten. Aber es passiert gar nichts. Wenn ich im Bibliotheksverwalter manuell den Baum durchsuche, finde ich nur Referenzen auf CmpErrors2Interfaces, die ja 64bit kompatibel sind. Leider konnte ich bisher nur eine SSD mit einem 64bit OS für den RPi zum Laufen bringen. Deswegen gehen mir langsam die Ideen aus. Vielen Dank für die Hilfe
Last updated: 2024-03-18
Post by mp9876 on Device logon problem following fresh install
CODESYS Forge
talk
(Post)
Yes it had been the case I believe as I have seen that message regarding they were not the same. I had update the device though to match them and that still did not fix the problem. I gotta say I wanted to get out of that situation and attempted a lot of things and then I did two things at the same time that fixed my problem: Wiped the 64 bit version and installed the 32 bit version Installed latest SP20 I wish I knew which one of these actions fixed the problem but now I gotta catch up on this IDE learning; it's been quite a learning experience I have to say! Thank you very much for your time and advice; much appreciated!
Last updated: 2024-03-19
Post by struccc on Release SP20 - Changes in behaviour?
CODESYS Forge
talk
(Post)
Dear all, I've just started to migrate some of my ancient projects to SP20. There is one strange error (?) I have noticed so far. In a method call, depending on the circumstances I would like to return reference to an object, or an invalid reference: METHOD Add_EVT_OUT : REFERENCE TO FB_MSG VAR END_VAR IF __ISVALIDREF(refMSG_Entry) THEN Add_EVT_OUT REF= MANAGER.AddMsg_EVT_OUT( refMSG_Entry, _Get_EVT_Message(MSG_EVENT.OUT), _Get_EVT_AddCode(MSG_EVENT.OUT) )^; ELSE Add_EVT_OUT := 0; END_IF So far setting a reference variable to 0, did this. But now, the expression Add_EVT_OUT := 0; gives an error: [ERROR] DB_WTP_370: Add_EVT_ACK MSG_TRIGGER_EXT: C0032: Cannot convert type 'BIT' to type 'REFERENCE TO FB_MSG' Naturally... I can write: Add_EVT_OUT := DWORD#0; But is this the correct way? Is there any constant I could use instead, like "NULL"? Or this is totally wrong and to be avoided?
Last updated: 2024-03-24
Post by bschraud on Zielsystem stimmt nicht mit dem verbundenen Gerät überein
CODESYS Forge
talk
(Post)
Dank umfangreicher Hilfe durch den Kontron Support kann ich nun wieder übersetzen. Es waren einige Bibliotheken auf einem älteren, nicht 64bit-kompatiblen Stand. Beim Öffnen des Projektes erscheint zwar ein Dialog zum Aktualisieren der Bibliotheken. Diesen hatte ich auch mit "Auf neueste setzen" bestätigt. Trotzdem waren etliche Bibliotheken im Projekt veraltet. Leider habe ich noch keine Stelle in der Online Hilfe gefunden, die die Zusammenhänge in der Bibliotheksverwaltung und das Vorgehen bei Fehlern erklärt. (Z.B. wie man vermeiden kann, dass eine Komponente automatisch eine ältere Bibliotheksversion lädt, obwohl eine aktuelle Version der gleichen Bibliothek schon hinzugefügt wurde.) Vielen Dank für die Hilfe!
Last updated: 2024-03-25
Post by ac-spr on Runtime variable that indicates a user is online to the code
CODESYS Forge
talk
(Post)
Looking to access a variable at runtime that indicates a user is online to the code. essentially want to use this value to feedback to the user on the HMI. we use turck and bosch rexroth devices if this information helps. I was hoping there was a variable at the application level, or a library that could be used but I was unable to find anything. I know there's a pop up when you try to login/ go online to the code when a user is already logged in, so the system does provide an indication that it knows already online, but has no access to a value from what I can see. Any help is appreciated
Last updated: 2024-04-22
Post by eurowolf on SoftMotionLight Lizenz nach Programmupdate weg
CODESYS Forge
talk
(Post)
Hallo, auf einer Sabo MKS855.20 habe ich die SoftMotionLight-Lizenz installiert. Zur Programmierung nutze ich V3.5 SP16.0. Die im Projekt verwendete SML 4.7.0.0, SML_Drive_CAN_GenericDSP42 3.5.7.0, CANopen_Manager_Softmotion 3.5.16.0. In der Regel habe ich keine Probleme mit der SoftMotionLight, nur bei dieser Anlage ist es mir jetzt zum Zweiten mal passiert, das ich ein Programmupdate einspiele und die SML in den Demo-Modus wechselt. Die Lizenz ist doch auf der SPS gespeichert, warum wird dann behauptet, dass die SML im Demo-Modus arbeitet. Da ich z. Zt. beim Kunden vor Ort bin und dieser sich im Ausland befindet, benötige ich kurzfristig eine Lösung. Auf E-Mails bekomme ich leider keine Rückmeldung.
Last updated: 2024-05-14
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
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
.