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 smartcoco on The text list provided outside the library is not available for visualization controls within the library.
CODESYS Forge
talk
(Post)
I have a project called 'DemoProject' and a library called 'DemoLib'. Create a visual control named "DemoVisu" in the library, with a selection box of type "ComboBoxInteger" in the space. Now 'ComboBoxInteger' requires a 'Text list'. This "Text list" is provided when I call the "DemoVisu" control of the "DemoLib" library in "DemoProject". And this text list is in 'DemoProject'. I found that 'ComboBoxInteger' no longer works at this time. Other visual controls that use text lists also have this issue. I hope there is a good solution to this problem.
Last updated: 2023-10-16
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 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 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 bahrt on Mapping GPIO and adding GPIO configurations
CODESYS Forge
talk
(Post)
Hi I am about to configure ALL GPIOs on a Raspberry Pi 3 model B V1.2. It seems that I have limited understanding of why not all the IO’s become available with the corresponding mapped IO’s – the 'dwInUse' contains mapping of the inputs from GPIO0 to GPIO27. But 'dwInputs' are only showing GPIO0 to GPIO8 and GPIO15 as available inputs. These mentioned inputs work fine You will be able to watch the limited mapped IO activity here: https://drive.google.com/file/d/1zz4PBNBfRZBF2YkiJ2VQxw6L9MBVji7R/view?usp=sharing Can you please bring your best idea on why GPIO09 to GPIO14 and GPIO16 to GPIO27 state are zero in the dwInputs register? Thanks in advance. Best regards Andreas Bahrt
Last updated: 2023-11-16
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 bahrt on Raspberry Pi GPIO mapping
CODESYS Forge
talk
(Post)
Hi I am about to configure ALL GPIOs on a Raspberry Pi 3 model B V1.2. It seems that I have limited understanding of why not all the IO’s become available with the corresponding mapped IO’s – the 'dwInUse' contains mapping of the inputs from GPIO0 to GPIO27. But 'dwInputs' are only showing GPIO0 to GPIO8 and GPIO15 as available inputs. These mentioned inputs work fine You will be able to watch the limited mapped IO activity here: https://drive.google.com/file/d/1zz4PBNBfRZBF2YkiJ2VQxw6L9MBVji7R/view?usp=sharing Can you please bring your best idea on why GPIO09 to GPIO14 and GPIO16 to GPIO27 state are not active (at a fixed zero state) in the dwInputs register? Thanks in advance. Best regards Andreas Bahrt
Last updated: 2023-11-21
Post by felipemsgarcia on Edge Gateway online, but PLC is not online
CODESYS Forge
talk
(Post)
Hello, Up until yesterday (2023/11/20) I was able to connect to the PLC remotely with no issues through Edge Gateway. However, today I can see the Edge Gateway online but I can find the PLC even if I do a network scan. Following the same path as janber0206 @ https://forge.codesys.com/forge/talk/automation_server/thread/e78b11d7e9/, I looked into certificates and found that one of the Trusted publisher certificates has expired earlier today (2023/11/21). Please see image. Questions are: Does it affect the connection to the PLC through Edge Gateway? How do I fix it? Thank you very much in advance!
Last updated: 2023-11-21
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 dkugler on Management of a PLC network from a remote station
CODESYS Forge
talk
(Post)
I would figure out, how to create a simple html webpage with 2 frames. One frame with buttons to select the plc. A second frame with hyperlink to the webvisu of the plc ("XXX.XXX.XXX.XXX:8080/webvisu.htm"). Selecting other PLC Button has to change the hyperlink in 2. frame. Costs only some time to figure out :-) Or setup a raspberry Pi with small visualization. Set up a button for each plc and add one browser element. Each button writes the URL of the depending plc to the URL setting of the browserelement. Costs 55€ for runtime licence and a Raspberry Pi.
Last updated: 2023-12-04
Post by ton on How to create a stopwatch?
CODESYS Forge
talk
(Post)
One i wrote this to measure elepse time When xMeasure is true is starts en when false it stops and time is messured. FUNCTION_BLOCK FB_ElapseTime VAR_INPUT xMeasure: BOOL; END_VAR VAR_OUTPUT xRisingEdge: BOOL; xFallingEdge: BOOL; tElapsed: TIME; ltElapsed: LTIME; ltPrev_Elapsed: LTIME; ltElapsedMax: LTIME; END_VAR VAR xLastValue: BOOL; LTIMEStart: LTIME; LTIMEEnd: LTIME; tonReset: TON:= (IN:= TRUE, PT:= TIME#30S0MS); END_VAR ------------------------------------------- xRisingEdge:= (xLastValue XOR xMeasure) AND xMeasure; xFallingEdge:= (xLastValue XOR xMeasure) AND NOT xMeasure; IF xRisingEdge THEN ltPrev_Elapsed:= ltElapsed; LTIMEStart:= LTIME(); END_IF IF xMeasure OR xFallingEdge THEN LTIMEEnd:= LTIME(); END_IF ltElapsed:= LTIMEEnd - LTIMEStart; ltElapsedMax:= MAX(ltElapsedMax, ltElapsed); tElapsed:= LTIME_TO_TIME(ltElapsed); xLastValue:= xMeasure; tonReset(); IF tonReset.Q THEN tonReset.IN:= FALSE; ltElapsedMax:= LTIME#0NS; END_IF Meaby this will help.
Last updated: 2023-12-09
Post by niloufar on Execution Order of Function Blocks
CODESYS Forge
talk
(Post)
Hi, Our program incorporates various function blocks and programs written in different languages such as St and SFC. They implement numerous actions and methods using different languages from their function blocks. My question is whether the execution order of function blocks is associated with the programming languages used. I understand that cycle time can be configured in the task configuration, but I'm curious if there is a specific sequence order of execution for function blocks written in different languages. For example, all function blocks in (ST) are executed first, followed by the execution of (SFC). Specifically, when the function is written in (ST) and the action is implemented in (SFC). I modified all function blocks in the main PLC program and configured a task configuration for the main program.
Last updated: 2023-12-13
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 fajean on Issues with "Add all instance path"
CODESYS Forge
talk
(Post)
In the past, we have routinely used the "add all instance paths" function to automatically add variables to VAR_CONFIG lists. My recollection is that compiling a project did not require VAR_CONFIG to be fully populated, and, once successfully compiled, instance paths could be added. Errors related to missing declarations, if I recall correctly, were thrown when downloading to the PLC, they did not prevent a successful compile. At some point, it stopped working. Missing declarations in a VAR_CONFIG now cause a compile error, so the application is never "current", the only reason I can see being the missing VAR_CONFIG declarations themselves (no other error). We observe the same behavior across all our projects. This is really aggravating, and I must be missing something simple. We use 3.5 SP17p3, 64 bits. Can anyone help?
Last updated: 2023-12-29
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 anderson on function block output
CODESYS Forge
talk
(Post)
I'm trying to make a CNC machine, but I'm having problems because the drive I'm using only has the option of communicating through digital inputs. In this case, I should use the CLP's digital outputs to communicate with it, correct? However, in the function blocks it seems that they are already pre-programmed and I didn't find the pulse output options, for example, so that I could associate a digital output from the PLC to connect this to the drive's pulse input. My question is: is it possible to associate the pulse output of the function block with a digital output of the PLC? and how to do this?
Last updated: 2024-01-05
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 toby on Ethercat Servo Setup
CODESYS Forge
talk
(Post)
Hi everyone, so a little update to this, I've come back to this project in the new year, and got it working. Yeah!, However, now with the new licensing setup, I need a new SoftMotion license, but it doesn't seem to be compatible with the previous Raspberry Pi SL license. Has anyone had any luck with Raspberry Pi and SoftMotion_Lite? Specifically the licensing of such? My customers new installation needs to be rebooted every 30min which is causing headaches! Another option is to not use the SoftMotion function blocks, and control the EtherCat amplifier directly, but I'm not sure how to do so. Does anyone have a specific example project of how to control a servo without the use of the SoftMotion function blocks? Thanks everyone for any assistance rendered. It's very much appreciated! Toby
Last updated: 2024-01-10
Post by ignat on Change date range of Trend
CODESYS Forge
talk
(Post)
Hi ryusoup, looking for the same functionality. I tried to use your code but couldn't figure out all the details. to enable Listener should it be called once or cyclically? the listener should be called with the intance of FB which you described? should it be this instance to be called cyclically too? I tried to make it simpler, just force the uiYear/uiMonth etc. but couldn't make it work. Could you please share some details how the whole struckture looks like? Would be great if you share an example UPD: found the issue. Your code works. Thanks for the posts
Last updated: 2024-01-17
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
.