Post by micik on Reverse bytes in an array
CODESYS Forge
talk
(Post)
Hello, I'm getting the data in Codesys that is an array of 8 bytes. From this array, I need to foram LREAL number, however, because of different endiannes I need to reverse bytes in this array and then copy to a LREAL variable. For this I'm using a loop and it works OK. I wonder if there is a built in function to do this. I have found CAA Memory library but it has functions like reverse bytes in DWORD. But it seems it doesn't have what I need. https://content.helpme-codesys.com/en/libs/CAA%20Memory/Current/CAA_Memory/Reverse-Bit-Swap-ByteWord-order/ReverseBYTEsInDWORD.html What I need is a function to reverse bytes in an 8 byte array, or something similar.
Last updated: 2024-08-22
Post by jonathan1321351 on IO-Link write parameters Ethernet/IP
CODESYS Forge
talk
(Post)
I want to read and write parameters of an IO-Link device using acyclic messages. I have a Cube67+ in Ethernet/IP, connected to an IO-Link master. In the datasheet, I can find the parameters required for the message (Service, Class, Instance, etc.). I see the function block "Set_attribute_single" in the "EthernetIP Services" library, but I'm not sure how to correctly send the index and sub-index for the IO-Link device. The class in the datasheet is 0x80 for the IO-Link Parameter Object, but it’s not present in the CPIClass enum. Is there another function block more suitable for configuring IO-Link devices? (similar to "iol_call" in PROFINET or what’s used in EtherCAT).
Last updated: 2024-09-02
Post by jonathan1321351 on IO-Link read/write parameters Ethernet/IP
CODESYS Forge
talk
(Post)
I want to read and write parameters of an IO-Link device using acyclic messages. I have a Cube67+ in Ethernet/IP, connected to an IO-Link master. In the datasheet, I can find the parameters required for the message (Service, Class, Instance, etc.). I see the function block "Set_attribute_single" in the "EthernetIP Services" library, but I'm not sure how to correctly send the index and sub-index for the IO-Link device. The class in the datasheet is 0x80 for the IO-Link Parameter Object, but it’s not present in the CPIClass enum. Is there another function block more suitable for configuring IO-Link devices? (similar to "iol_call" in PROFINET or what’s used in EtherCAT).
Last updated: 2024-09-04
Post by fefefede on Get the numer of day
CODESYS Forge
talk
(Post)
Hello i tro to create a program to turn on or off the air condition in relationship temperature and numer of day. I can't get the number of day. I try this after installing SysTime library but this not work and have this error on debug ------ Build started: Application: Device.Sim.Device.Application ------- Typify code... Generate code... [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'SysTimeCore(TRUE)'' to type 'TIME' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'SysTimeCore' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0032: Cannot convert type 'Unknown type: 'DayOfWeek(CurrentTime)'' to type 'INT' [ERROR] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0035: Program name, function or function block instance expected instead of 'DayOfWeek' [INFORMATION] giorno_accensione_aria: PLC_PRG Device: PLC Logic: Application: C0181: Related position Build complete -- 4 errors, 0 warnings : No download possible PROGRAM PLC_PRG VAR Temperatura: UDINT; AriaCondizionata: BOOL := FALSE; CurrentDayOfWeek: INT; //Variabile Giorno CurrentTime: TIME; GiornoDellaSettimana: INT; DayOfWeek: INT; END_VAR CurrentTime := SysTimeCore(TRUE); // Ottieni l'ora corrente CurrentDayOfWeek := DayOfWeek(CurrentTime); CASE GiornoDellaSettimana OF 1: // Azioni per Lunedì 2: // Martedì se più 10° accend altrimenti spegni IF Temperatura >= 10 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 3: // Mercoledì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 4: // Giovedì se più di 40° accendi altrimenti spegni IF Temperatura >=40 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 5: // Venerdì se più di 50° accendi altrimenti spegni IF Temperatura >=50 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 6: // Sabato se più di 25° accendi altrimenti spegni IF Temperatura >=25 THEN AriaCondizionata := TRUE; ELSE AriaCondizionata := FALSE; END_IF 7: // Domenica sempre spenta AriaCondizionata := FALSE; END_CASE
Last updated: 2023-09-14
Post by callumo1 on Check For Open Dialogs On Client
CODESYS Forge
talk
(Post)
Is it possible to make a function that checks to see if there are any open dialogs on a given clients. I think VisuDialogs.VisuDlgUtil_IsDialogOpen does this for a given dialog name, but is it possible to do this for any dialog. Appretiate any help Cheers Callum
Last updated: 2023-09-25
Post by callumo1 on Check For Open Dialogs On Client
CODESYS Forge
talk
(Post)
Thanks for the reply. I want to be able to check if any dialogs are open of any name. I already have a function similar to what you have send but I don't want to have to run it for all the different dialog names. Thanks
Last updated: 2023-09-26
Post by leon78 on Codesys 3.5 SP17 Patch 2 CheckBounds (POUs for Implicit Checks)
CODESYS Forge
talk
(Post)
Hello! I use CheckBounds (POUs for Implicit Checks). But I have a problem. I use an array as an VAR_IN_OUT of Function Block. If I try to monitor the array of variable length ([* ]), its does't work. The CheckBounds POU isn't called. If I use the array of fixed lenght ([lower..upper]), the CheckBounds POU is called. Why?
Last updated: 2023-11-14
Post by leon78 on Codesys 3.5 SP17 Patch 2 CheckBounds (POUs for Implicit Checks)
CODESYS Forge
talk
(Post)
Hello! I use CheckBounds (POUs for Implicit Checks). But I have a problem. I use an array as an VAR_IN_OUT of Function Block. If I try to monitor the array of variable length ([* ]), its does't work. The CheckBounds POU isn't called. If I use the array of fixed lenght ([lower..upper]), the CheckBounds POU is called. Why?
Last updated: 2023-11-14
Post by nz-dave on Bool turning on in case stament in wrong state?
CODESYS Forge
talk
(Post)
pretty sure its not. ive done a cross reference and only have one write that sets it to true. Only way i can stop it is to remove the function block call from the main pou that is running said case. its got me stumped:/
Last updated: 2023-12-16
Post by tvm on Function block method default arguments
CODESYS Forge
talk
(Post)
This works for me in Schneider Machine Expert 2.2, which is based on Codesys 3.5.19. It did not work in Machine Expert 2.1, which was based on Codesys 3.5.16. METHOD PUBLIC Method1 : INT VAR_INPUT TestVar: INT:= 5; END_VAR Method1:= TestVar; PROGRAM SR_Main VAR TestFB: TEST_FB; Var1: INT; END_VAR Var1:= TestFB.Method1();
Last updated: 2024-01-04
Post by aniket-b on How to protect library project?
CODESYS Forge
talk
(Post)
I have library projects which has few function blocks. I have assigned security to each FB. I want to protect them and user can only be able to use it without viewing the code inside. What kind of file I should send to user? Is it compiled library file?
Last updated: 2024-01-22
Post by nano on Modbus TCP/IP slave communication errow
CODESYS Forge
talk
(Post)
please tell us the exact error message from diagnostic. U can view it at devicetree in the node-element diagnostic from modbus-configuration. u also can activate the function auto-reconnect in master and increase a little bit the timeout and the repetition to male thw communication a little bit more robust
Last updated: 2024-02-04
Post by evanclegg on Digital Clock
CODESYS Forge
talk
(Post)
To display the current time, you’ll need to retrieve it from the system clock. In CODESYS, you can use the built-in function SysTime to get the current system time. Here’s an example of how you can use it: VAR dtCurrentTime: DATE_AND_TIME; sTime: STRING(8); END_VAR dtCurrentTime := SysTime(); sTime := TIME_TO_STRING(dtCurrentTime.t); The sTime variable now contains the current time in the format “HH:MM:SSuno online".
Last updated: 2024-02-28
Post by k4zz on Static Code Analysis
CODESYS Forge
talk
(Post)
I've already experimented with two methods, but unfortunately, they only function with projects of type *.project. Consequently, when executing: system.commands["staticanalysis", "run"].execute() For the 2nd Option: You'll need to ensure that in the Static Analysis Settings, the option "Perform static analysis automatically after compilation" is checked. # get Project values myProject = projects.primary # Creates an active application app = myProject.active_application # build Application and run static code analysis app.generate_code()
Last updated: 2024-03-15
Post by markushunter on Different behavior between the "Start" button in the IDE and the Cmp function "AppStartApplication()"
CODESYS Forge
talk
(Post)
One workaround is to create a second application which is started after the rested of the main application. The second application starts the main application after time x and is rest after done start of the main application. No problems during the fieldbus re-start by this workaround.
Last updated: 2024-03-22
Post by nano on Error building Extension SDK Linux code
CODESYS Forge
talk
(Post)
Hey schnepper, when i look into your c-file, i would say that only the main-function is declared with cext-addendum in your codesys-library-project. all yöur funtions in library has to be the cext-addendum when the external implementation is activ. if i remeber right, methods and other subelements dont need that, but every base-elements
Last updated: 2024-04-02
Post by hanoues on Holding brake release
CODESYS Forge
talk
(Post)
I've tried using the SMC3_BrakeControl function block to control the brake, but unfortunately, it's not functioning as expected. Despite setting the appropriate parameters and inputs, the brake control does not operate correctly. Any insights or suggestions on resolving this issue would be greatly appreciated. STATE_MANUAL.UNLOCK_BRAKE: IF Button_release_brake THEN GVL.drum1_Control_Brake:=TRUE; FBA.T11_ContBrake.bExecute := TRUE; GVL.manual_state := STATE_MANUAL.WAIT_FOR_BRAKE_RELEASE; END_IF STATE_MANUAL.WAIT_FOR_BRAKE_RELEASE: IF FBA.T11_ContBrake.bDone THEN FBA.T11_ContBrake.bExecute := FALSE; GVL.manual_state := STATE_MANUAL.WAIT_START_BUTTON; END_IF
Last updated: 2024-04-08
Post by idir93dz on Identifier 'IoDrvGPIO' not defined
CODESYS Forge
talk
(Post)
Hello, After installing the pi runtime and creating a pi project, I get these errors: [ERROR] Untitled3: Application [Device: PLC Logic]: C0046: Identifier 'IoDrvGPIO' not defined [ERROR] Untitled3: Application [Device: PLC Logic]: C0080: Function block 'IoDrvGPIO' must be instantiated to be accessed [ERROR] Untitled3: Application [Device: PLC Logic]: C0004: 'IoDrvGPIO' is no component of 'IoDrvGPIO'
Last updated: 2024-04-10
Post by k2saki on Automatic TOOL Length Measurement like Typical CNC Machine.
CODESYS Forge
talk
(Post)
I'd like to measure tool length using SW. How do I set variable from the accurate drive position when switch turn ON/OFF? Hopefully, I'd like to measure Z-Pos with M-Function in G-Code automatically, And I'd like to set it to G43 as tool length correction.
Last updated: 2024-05-09
Post by andreag0 on How to access to variable value through symbolic string name
CODESYS Forge
talk
(Post)
Hello, anyone know how to get valiable value using a symbolic string name? For example: - send string to runtime using TCP/IP contains "GVL.TestINT" and get back the value. I need function that will translate the string to symbolic variable. Thank you. Andrea
Last updated: 2024-06-13
Post by matt-purcell on Which Lib to use, connect to a socket with URL instead of IP address
CODESYS Forge
talk
(Post)
I've been searching through these libraries, syssocket and net base services and they all seem to use the same structure for IP address for the connect function, SOCKADDRESS. At a glance, it doesn't look like that'll work, maybe it's just missing in the documentation somewhere?? I'm wondering if anyone has done it.
Last updated: 2024-06-17
Post by rikher on Error: Too few outputs exixts for the box 'MemCopy' (minimum is 1).
CODESYS Forge
talk
(Post)
I am using MemCopy Function for this example: https://www.youtube.com/watch?v=DeTCT5Vyn28&t=482s It is from library WagoSysPlainMem. I want to use this for an MQTT example. However, Codesys is complaining the block does not have outputs. How to fix this?
Last updated: 2024-06-19
Post by jeffersonhui on SysProcessExecuteCommand2 terminate
CODESYS Forge
talk
(Post)
Hi, I am using the SysProcessExecuteCommand2 function from the SysProcess library to run the candump command in the PLC's Linux environment. However, the candump command stays running indefinitely. If I was running the candump command from a terminal (via PuTTy, etc), that command usually requires Ctrl+C to terminate. Is there a way to terminate a command that is executed with SysProcessExecuteCommand2?
Last updated: 2024-06-24
Post by tk096 on Some 'pathetic' errors in SoftMotion program
CODESYS Forge
talk
(Post)
Hi, I suppose that you are referring to the error code "SMC_FB_WASNT_CALLED_DURING_MOTION"? Starting of Softmotion version 4.15.0.0 the instance path of the function block that has not been called is logged into the device log. This might help you to identify why it has not been called.
Last updated: 2024-07-18
Post by timvh on Array to String
CODESYS Forge
talk
(Post)
The string_Util_Intern is not the library I referred to. With a CONCAT function (also with the string util library) a search is done for the NULL character. If you concatenate 20000 characters to one string, then the longer the string, the longer it takes to find this NULL character.
Last updated: 2024-07-24
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
.