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 scarter on Import/Export PLCOpen xml Task Configuration
CODESYS Forge
talk
(Post)
I'm Having the same issue. If I highlight PLC Logic and import it erases everything else and replaces the Task config. If I highlight the Application I get the same result. Simple manual fix is click and drag the task config onto the origional Application, and delete the second one. Easy fix but not the expected result of importing task config.
Last updated: 2024-01-17
Post by alexgooi on How to protect library project?
CODESYS Forge
talk
(Post)
Hi aniket-b, If you save the library as a compiled library you are not able to see the source code. When the end user tries to view inside the object, CODESYS will give a notification that the source code is missing, see attachment. In short if you don't send the source code, it will not show.
Last updated: 2024-01-25
Post by ferrim on IEC 61499
CODESYS Forge
talk
(Post)
Hello otdeveloper, I am very interested in this topic. I have been dedicated to IEC 61499 for some time and I would like to understand if the time has come to adopt it in the real world of automation or if it will continue to fill up research papers only.
Last updated: 2024-02-09
Post by manuknecht on High Cycle Times for SoftMotion_PlanningTask when using AxisGroup
CODESYS Forge
talk
(Post)
Hi, thanks a lot for the response. I did check all these parameters, but if the PlanningTask takes up to 60 ms, I can't increase the Buffer to such values. I contacted the Codesys support with a projectarchive. Let's see if they can help. Thanks again for your great support!
Last updated: 2024-03-22
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 timvh on Change the Opening Position of the Dialog using VU.FbOpenDialog
CODESYS Forge
talk
(Post)
Probably best to call the FB continuously. So something like this could solve it: IF xOpenLatchSettingDialog THEN xOpenLatchSettingDialog := FALSE; fbOpenLatchSettingsDialog.xExecute := TRUE; END_IF IF fbOpenLatchSettingsDialog.xDone OR fbOpenLatchSettingsDialog.xError THEN fbOpenLatchSettingsDialog.xExecute := FALSE; END_IF TopLeftDialog.iX := 100; TopLeftDialog.iY := 23; fbOpenLatchSettingsDialog( itfClientFilter:= VU.Globals.OnlyTargetVisu, sDialogName:= 'visu_AlarmLatchSettings', xModal:= TRUE, pTopLeftPosition:= ADR(TopLeftDialog) );
Last updated: 2024-05-09
Post by rajesh008 on i can't declear the address in GVL - codesys SP19 Patch5
CODESYS Forge
talk
(Post)
The β_AB AT %IW0:word; β if i called the value then im getting this error. like below "the declartion of the variable with an address assignment cannot be used in a PRG or GVL with the attribute 'subsequent'" This is happening when the GVL is selected in Redundancy Configuration. if i un-select the address declaration is working fine
Last updated: 2024-05-13
Post by oymyakon on Modbus Lockup
CODESYS Forge
talk
(Post)
Hi i have a project where i am communicating with many modbus devices using TCP to serial. This is all working extremely well except when i turn one of the remote devices off. If i leave the auto reconnect on it still doesn't talk to the rmianing devices and if i turn Auto reconnect off it locks up. Any help would be appreciated. Paul.
Last updated: 2024-08-07
Post by oymyakon on Modbus Lockup
CODESYS Forge
talk
(Post)
Hi i have a project where i am communicating with many modbus devices using TCP to serial. This is all working extremely well except when i turn one of the remote devices off. If i leave the auto reconnect on it still doesn't talk to the rmianing devices and if i turn Auto reconnect off it locks up. Any help would be appreciated. Paul.
Last updated: 2024-08-07
Post by davidbo on Modbus: Is there a way to get the channel index from the channel name?
CODESYS Forge
talk
(Post)
When I use the FUNCTION_BLOCK ModbusChannel I have to sepcify the integer iChannelIndex It can easily go wrong if one has many channels. It would be better if one could use the name. Is that possible? Attached a snippet of the channel name and the channel index to the left.
Last updated: 2024-10-21
Post by lsislsis on SIGABRT Error
CODESYS Forge
talk
(Post)
After many tests i see that problem comes when serial communication established for modbus rtu. If the slave device not connected we don't see the exception. If the slave device connected at serial port then we have exception about 1 hour after startup and every 10 or 15 minutes. Any suggestion?
Last updated: 2024-11-08
Post by timvh on Leitungsverzweigung mit einem existierenden Block (z.B. AND-Glied) zu verbinden
CODESYS Forge
talk
(Post)
If you are really happy with PLCnext engineer, then just use that. There is probably also something in CODESYS that cannot be done in PLCnext engineer. But if you are forced to make something like this in CODESYS, then maybe just use CFC instead of FBD.
Last updated: 4 days ago
Post by timvh on How to implement an interface (IElement)?
CODESYS Forge
talk
(Post)
See: https://forge.codesys.com/prj/codesys-example/element-collect/home/Home/ This contains an application "OnlineChangeSafeLinkedListExample". What you should do is create a new interface which has your "Priority" property. Then your FB should extend the base element function block and implement your own interface: E.g. FUNCTION_BLOCK MyElement EXTENDS COL.LinkedListElementBase IMPLEMENTS I_MyInterface Then the __QUERYINTERFACE does the magic to check if your "element" also implements your interface. Something like this: // Compares this element with itfElement. // Returns 0 if the elements are equal, < 0 if the element is less than itfElement, // > 0 if the element is greater than itfElement. // This method will be called from sorted collections (e.g. |COL.SortedList|) to sort the elements. // IMPORTANT: The underlying value to be compared with MUST NOT be changed during the lifecycle of the object. METHOD ElementCompareTo : INT VAR_INPUT (* The element to compare*) itfElement : COL.IElement; END_VAR VAR itfIntElement : I_MyInterface; xResult : BOOL; END_VAR // We use integer iInt1 for sorting. xResult := __QUERYINTERFACE(itfElement, itfIntElement); IF xResult THEN IF iInt1 < itfIntElement.Priority THEN ElementCompareTo := -1; ELSIF iInt1 > itfIntElement.Priority THEN ElementCompareTo := 1; ELSE ElementCompareTo := 0; END_IF ELSE ElementCompareTo := -1; END_IF
Last updated: 2024-07-22
Post by jari-koivuluoma on Problem trying Net Base Services 3.5.15.0 TCP connection
CODESYS Forge
talk
(Post)
I have a need to send messages between 2 PLCs and I cant use network variables (because of size limit) so I tried writing this simple test program. This seems to work fine. I can send messages back and forth when a first "Start server" and then "Connect client". See the attached image. However, if I disconnect the client by setting ClientConnect to false and try to re-connect then the TCP_Client just gives me TIMEOUT error. When I stop and start the server again, then Im able to reconnect. How is this supposed to work? Why reconnecting wont work. There is not other way of disconnecting the client than setting xEnable of the TCP_Client to false. This is just a testing program and I will try it on 2 seperate devices once this works. PROGRAM PLC_PRG VAR CONSTANT mySize : UDINT := 255; END_VAR VAR Server: NBS.TCP_Server; ServerIpStr: STRING := '127.0.0.1'; ServerIP: NBS.IP_ADDR; ServerPort: UINT := 50000; ServerConnection: NBS.TCP_Connection; Client: NBS.TCP_Client; ServerRead: NBS.TCP_Read; ServerWrite: NBS.TCP_Write; ServerSend: STRING(mySize); ServerReceive: STRING(mySize); ServerConnect: BOOL; bServerSend: BOOL; IP: NBS.INADDR; ConnectedClientIP: STRING; ClientPort: UINT := 50000; ClientIpStr: STRING := '192.168.1.49'; ClientIP: NBS.IP_ADDR; ClientRead: NBS.TCP_Read; ClientWrite: NBS.TCP_Write; ClientSend: STRING(mySize); ClientReceive: STRING(mySize); ClientConnect: BOOL; bClientSend: BOOL; Error: BOOL; Message: BOOL; END_VAR // Server ServerIP.sAddr := ServerIpStr; Server( ipAddr := ServerIP, uiPort := ServerPort ); ServerConnection( xEnable := Server.xEnable, hServer := Server.hServer, ); IP := ServerConnection.IPAddress; ConnectedClientIP := F_Concat7( BYTE_TO_STRING(IP.S_un_b.s_b1),'.', BYTE_TO_STRING(IP.S_un_b.s_b2),'.', BYTE_TO_STRING(IP.S_un_b.s_b3),'.', BYTE_TO_STRING(IP.S_un_b.s_b4)); ServerRead( xEnable := ServerConnection.xActive, hConnection := ServerConnection.hConnection, szSize := SIZEOF(ServerReceive), pData := ADR(ServerReceive) ); IF ServerRead.xReady AND ServerRead.szCount > 0 THEN Message := TRUE; END_IF IF ServerRead.eError > 0 THEN Error := TRUE; END_IF ServerWrite( xExecute := ServerConnection.xActive AND bServerSend, hConnection := ServerConnection.hConnection, szSize := LEN(ServerSend)+1, pData := ADR(ServerSend) ); IF ServerWrite.xDone THEN bServerSend := FALSE; END_IF IF ServerWrite.eError > 0 THEN Error := TRUE; END_IF // Client ClientIP.sAddr := ClientIpStr; Client( xEnable := ClientConnect, ipAddr := ClientIP, uiPort := ServerPort, udiTimeOut := 10000000 ); ClientRead( xEnable := Client.xActive, hConnection := Client.hConnection, szSize := SIZEOF(ClientReceive), pData := ADR(ClientReceive) ); IF ClientRead.xReady AND ClientRead.szCount > 0 THEN Message := TRUE; END_IF IF ClientRead.eError > 0 THEN Error := TRUE; END_IF ClientWrite( xExecute := Client.xActive AND bClientSend, hConnection := Client.hConnection, szSize := LEN(ClientSend)+1, pData := ADR(ClientSend) ); IF ClientWrite.xDone THEN bClientSend := FALSE; END_IF IF ClientWrite.eError > 0 THEN Error := TRUE; END_IF
Last updated: 2024-10-03
Post by alexgooi on Modbus writing on value change
CODESYS Forge
talk
(Post)
Hi Duvan, You could make this in 1 single object (FB), Indeed don't use a function for this beacuse you need some memory to keep the old value. For i := 0 TO 200 BY 1 DO //Check if the value has been changed IF Old_Value[i] <> Value[i] THEN //Set the trigger to TRUE Trigger[i] := TRUE; Old_Value[i] := Value[i]; END_IF END_FOR If you define the Value array as an In_Out and the Trigger as an In_Out you arn't claiming any aditional memory to your system. You ofcourse then need to add some code arround it that does something with the trigger and writes it back to FALSE again. If you want more flexability you also could use pointers instead of using the IN_OUT FOR i := 0 TO 200 BY 1 DO address := address_Input + i * SIZEOF(*Put type here); IF Address^ <> Old_Value[i] THEN Trigger[i] := TRUE; Old_Value[i] := Address^; END_IF END_FOR
Last updated: 2024-04-02
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 sturmghost on Visualization using methods and cyclic ST-calls
CODESYS Forge
talk
(Post)
I found a way to do it: You can use, for example, the text variable property of any visualization element and call a function in it. Example: Write a test POU as a function (FUN), like MyTestFun which need a boolean Variable as an input value. Now write into the text variable property: MyTestFun(bBooleanValue) Thats it. The function is called at each visu_task cycle.
Last updated: 2024-01-22
Post by nano on Is there any support for I2C on Raspberry Pi?
CODESYS Forge
talk
(Post)
hello jdj this question can be answered well with a pretty good forge documentation: https://forge.codesys.com/drv/io-drivers/doc/Generic/ u r also able to create in codesys directly an iec-code by using the i2c-interface as driver using the codesys ide and st depending on the stepperdriver, used in yΓΆur hat, its possible that an driver is already available in the device-repository. which mcp-device is used on the hat?
Last updated: 2024-03-01
Post by andy-yemm on Assertion Failed
CODESYS Forge
talk
(Post)
I had similar assertion failed error messages today. I am fairly new to Codesys. I tried using SFC for the first time, I usually use ST. Anyway I had errors in some of my transitions. I copied and pasted transition code and forgot to change the target of the code. I started getting lots of the assertion errors but now I have sorted out the problems and it compiles OK the assertion error messages seem to have stopped. There do not seem to be any other responses to your post, did you resolve your problem?
Last updated: 2024-03-19
Post by konradkmiller on Variable assignments
CODESYS Forge
talk
(Post)
I have a snippet of code that I was given as a reference in ST. ** ModbusMasterRTU( xConnect:= TRUE, IPort:= IoConfigGlobals.COM1, // IoConfigGlobals.RS232485Interface, // COM1=Front Port / Serial module = Name of module in Devices structure I/O list udiBaudrate:= 19200, usiDataBits:= 8 , eParity:= WagoTypesCom.eTTYParity.None , eStopBits:= WagoTypesCom.eTTYStopBits.One , eHandshake:= WagoTypesCom.eTTYHandshake.None , ePhysical:= WagoTypesCom.eTTYPhysicalLayer.RS485HalfDuplex, xIsConnected=> xIsConnected , xError=> , oStatus=> , eFrameType:= WagoAppPlcModbus.eMbFrameType.RTU , tTimeOut:= T#1S, utQuery:= utQuery , xTrigger:= SEND, utResponse:= utResponse)** What is the meaning of => in this context?
Last updated: 2024-07-20
Post by andrebrandt on FB string and naming
CODESYS Forge
talk
(Post)
Hi all. I have a FB written in ST. FUNCTION_BLOCK NTC10k VAR_INPUT Syst:STRING; In:REAL; END_VAR VAR_OUTPUT Out:REAL; OTag:STRING; Out_St:Struct_NTC10K; END_VAR VAR Tag:STRING; InstanceName: STRING; Structure:Struct_NTC10K; END_VAR What i'm trying to do, is to pass data to structure. In structure i want to add a tag with systemnumber and sensorname. '320.001-RT401' In pou i use this RT401: NTC10k;, and tried this RT401: NTC10k(Tag:='RT401'); Anyone done this?
Last updated: 2024-09-26
Post by warrumungi on Opening a Dialog on a specific Client from ST
CODESYS Forge
talk
(Post)
Hi Thanks, Manuel, for providing this solution and insight. I too had exactly the same problem as you did. While I did implement a custom filter, I'd also like to point out what jinlee mentioned above...I see no reference to VU.PublicVariables.Clients.Current anywhere?? In my case I only needed to show a dialog on a "master" client, not all the clients, so I filtered by IP address to do this.
Last updated: 2024-11-05
Post by riccardo on Codesys SP19 patch 4
CODESYS Forge
talk
(Post)
Hallo everyone, I am working on new PLC of Weidmueller that uses Codesys SP19. I made the upgrade at the Patch 4 coming from patch 0. Unce made the upgrade everything is working well in the progect except the web visu user menagent. In the new version, when I perfom the login, I cannot use the keyboard of the device; the window where to digit the user name and password opens, the buttons "OK" and "Cancel" work but the system doesn't allow to put input from the device keybord, the mouse behaves as it is an image. If I active the virtual keypad or numpad it works otherwise nothing. I am wondering if it is a bug of the new package or if I must set something else. Thanks in advance, Riccardo.
Last updated: 2023-11-27
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
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
.