Search talk: IF OR THEN

 
1 2 3 .. 42 > >> (Page 1 of 42)

Execution of IF THEN CODESYS Forge talk (Thread)
Execution of IF THEN
Last updated: 2009-12-19

If Then Else and Case in FBD CODESYS Forge talk (Thread)
If Then Else and Case in FBD
Last updated: 2020-01-24

Check if a directory exists and then copy a file in it CODESYS Forge talk (Thread)
Check if a directory exists and then copy a file in it
Last updated: 2016-06-25

Post by ph0010421 on How to create a stopwatch? CODESYS Forge talk (Post)
FUNCTION_BLOCK fbdStopwatch VAR_INPUT Condition: BOOL; END_VAR VAR_OUTPUT TimeTaken: TIME; END_VAR VAR StartTime: TIME; fbiStartOs: R_TRIG; fbiStopOs: F_TRIG; END_VAR and then: fbiStartOs(CLK := Condition); fbiStopOs(CLK := Condition); IF fbiStartOs.Q THEN StartTime := TIME(); END_IF; IF fbiStopOs.Q THEN TimeTaken := TIME() - StartTime; END_IF;
Last updated: 2023-12-07

Post by caprez95 on Trace Restart Visuelement CODESYS Forge talk (Post)
Hallo zusammen. Ich habe schon länger mit dem Problem zu kämpfen, dass ich einen Trend (Visuelement) nicht resetten (neustarten) kann. Ich habe es jetzt mit dem Beispiel hinbekommen, die Trace-Aufzeichnung über die CmpTraceMgr Bibliothek zu steuern. Aber wie bekomme ich diese Trace-Aufzeichnung in ein Visuelement? Der Code sieht wie folgt aus: // Configure trace IF xInit THEN // Create a trace packet PacketConfig.pszName := ADR('IECTraceConfiguration.Trace1'); // Name of trace PacketConfig.pszApplicationName := ADR('IECTraceConfiguration'); // Name of the application PacketConfig.pszIecTaskName := ADR('Task'); // Name of the task PacketConfig.pszComment := ADR('Demo packet'); PacketConfig.ulEveryNCycles := 1; PacketConfig.ulBufferEntries := 1000; PacketConfig.ulFlags := TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_TIMESTAMP_MS AND TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_AUTOSTART; IF (NOT fbTraceManager.CreatePacket(PacketConfig := PacketConfig, hPacket=>hPacket1)) THEN xError := TRUE; END_IF // Create a trace record RecordConfig.pszVariable := ADR('iSignal'); // This is the name of variable to record RecordConfig.tcClass := INT_TO_UDINT(TypeClass.TYPE_INT); // Type of the recording variable RecordConfig.ulSize := SIZEOF(iSignal); // Size of the recording variable pApp := AppFindApplicationByName('IECTraceConfiguration', 0); AppGetAreaOffsetByAddress(pApp, ADR(iSignal), ADR(RecordConfig.tvaAddress.taAddress.Area.usArea), ADR(RecordConfig.tvaAddress.taAddress.Area.ulOffset)); // Get and set area offsets RecordConfig.tvaAddress.ulAddressFlags := TRACE_VAR_ADDRESS_FLAGS_IEC OR TRACE_VAR_ADDRESS_FLAGS_AREA_OFFSET; RecordConfig.ulGraphColor := 16#FF00FF00; // green RecordConfig.ulGraphType := 1; // Line with points IF (NOT fbTraceManager.AddRecord(RecordConfig := RecordConfig, hPacket := hPacket1, hRecord => hRecord1)) THEN xError := TRUE; END_IF xInit := FALSE; END_IF // Starts the recording IF xStart THEN IF (NOT fbTraceManager.StartPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStart := FALSE; END_IF // Stop the recording IF xStop THEN IF (NOT fbTraceManager.StopPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStop := FALSE; END_IF // Reset the recording IF xReset THEN IF (NOT fbTraceManager.ResetPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xReset := FALSE; END_IF
Last updated: 2024-06-04

Post by caprez95 on Trace Restart Visuelement CODESYS Forge talk (Post)
Hello everyone. I've been struggling with the problem for a long time that I can't reset (restart) a trend (visual element). With the example I have now managed to control the trace recording via the CmpTraceMgr library. But how do I get this trace recording into a visual element? The code looks like this: // Configure trace IF xInit THEN // Create a trace packet PacketConfig.pszName := ADR('IECTraceConfiguration.Trace1'); // Name of trace PacketConfig.pszApplicationName := ADR('IECTraceConfiguration'); // Name of the application PacketConfig.pszIecTaskName := ADR('Task'); // Name of the task PacketConfig.pszComment := ADR('Demo packet'); PacketConfig.ulEveryNCycles := 1; PacketConfig.ulBufferEntries := 1000; PacketConfig.ulFlags := TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_TIMESTAMP_MS AND TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_AUTOSTART; IF (NOT fbTraceManager.CreatePacket(PacketConfig := PacketConfig, hPacket=>hPacket1)) THEN xError := TRUE; END_IF // Create a trace record RecordConfig.pszVariable := ADR('iSignal'); // This is the name of variable to record RecordConfig.tcClass := INT_TO_UDINT(TypeClass.TYPE_INT); // Type of the recording variable RecordConfig.ulSize := SIZEOF(iSignal); // Size of the recording variable pApp := AppFindApplicationByName('IECTraceConfiguration', 0); AppGetAreaOffsetByAddress(pApp, ADR(iSignal), ADR(RecordConfig.tvaAddress.taAddress.Area.usArea), ADR(RecordConfig.tvaAddress.taAddress.Area.ulOffset)); // Get and set area offsets RecordConfig.tvaAddress.ulAddressFlags := TRACE_VAR_ADDRESS_FLAGS_IEC OR TRACE_VAR_ADDRESS_FLAGS_AREA_OFFSET; RecordConfig.ulGraphColor := 16#FF00FF00; // green RecordConfig.ulGraphType := 1; // Line with points IF (NOT fbTraceManager.AddRecord(RecordConfig := RecordConfig, hPacket := hPacket1, hRecord => hRecord1)) THEN xError := TRUE; END_IF xInit := FALSE; END_IF // Starts the recording IF xStart THEN IF (NOT fbTraceManager.StartPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStart := FALSE; END_IF // Stop the recording IF xStop THEN IF (NOT fbTraceManager.StopPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStop := FALSE; END_IF // Reset the recording IF xReset THEN IF (NOT fbTraceManager.ResetPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xReset := FALSE; END_IF
Last updated: 2024-06-04

How to know if output if function block is used CODESYS Forge talk (Thread)
How to know if output if function block is used
Last updated: 2024-10-15

IF Anweisung in CFC CODESYS Forge talk (Thread)
IF Anweisung in CFC
Last updated: 2006-07-12

IF not work CODESYS Forge talk (Thread)
IF not work
Last updated: 2017-10-07

IF NOT AND question CODESYS Forge talk (Thread)
IF NOT AND question
Last updated: 2018-11-26

Post by dkugler on Web Browser special tools errors CODESYS Forge talk (Post)
If there is a runtime + webvisu running at the .101 then the link should be: http://192.168.1.101:8080/webvisu.htm
Last updated: 2024-03-06

Post by timvh on Alarm Configuration Notification Action CODESYS Forge talk (Post)
If it is a BOOL, then use: ...Error_Active := ALARM BOOL: ALARM INT: STATE
Last updated: 2024-05-14

Post by eschwellinger on CODESYS control on RPi starts, shortly runs, then exits CODESYS Forge talk (Post)
if you use Bookworm uodate to 4.11.0.0 version please.
Last updated: 2024-06-13

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 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 displaying all incoming CAN bus messages CODESYS Forge talk (Post)
Create a (global) array of Messages: aMessage : ARRAY[0..NR_OF_MESSAGES-1] OF CAN.RxMESSAGE; Then add each received message to the array. IF UserVarGlobal.g_countMsg_RPMset < NR_OF_MESSAGES THEN aMessage[UserVarGlobal.g_countMsg_RPMset] := Message; UserVarGlobal.g_countMsg_RPMset := UserVarGlobal.g_countMsg_RPMset + 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 naks on Change IP address from IEC code CODESYS Forge talk (Post)
Hi, I'm working with wago 750-8212 controller. I want to change the IP address of the Ethernet adapter from webvisu. I have read some other threads in this forum and I have tried the following: Added the following text to the config file CODESYSControl.cfg: [SysSocket] Adapter.0.Name="br1" Adapter.0.EnableSetIpAndMask=1 Used the below code : IF xUpdateEthernet THEN Ethernet.Enable := FALSE; Reconfig ( xExecute := TRUE, itfNode := Ethernet, eError => ErrorReconfig, xBusy => xBusy, xDone => xDone, xError => xErrorReconfigure); IF Reconfig.xDone THEN ErrorCode := Ethernet.UpdateConfiguredIPSettings(IpAddress := NewIp, gateway := newGateway, subnetmask := newSubnetmask); END_IF IF Reconfig.xDone OR Reconfig.xError THEN reconfig(xExecute := FALSE); END_IF Ethernet.Enable := TRUE; Reconfig(xExecute := TRUE, itfNode := Ethernet ); END_IF I could change the IP address but when i restart my Controller then the IP address resets to the original, Is there anything I have missed, what else can i try ? Thank you in advance.
Last updated: 2024-07-08

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

Sliding across a HMI bigger then my screen CODESYS Forge talk (Thread)
Sliding across a HMI bigger then my screen
Last updated: 2020-10-09

CODESYS control on RPi starts, shortly runs, then exits CODESYS Forge talk (Thread)
CODESYS control on RPi starts, shortly runs, then exits
Last updated: 2024-06-14

EtherCAT_Master error if integrated into project CODESYS Forge talk (Thread)
EtherCAT_Master error if integrated into project
Last updated: 2017-08-28

IF-Anwesiung mit Überprüfung mehrerer Bedingungen? CODESYS Forge talk (Thread)
IF-Anwesiung mit Überprüfung mehrerer Bedingungen?
Last updated: 2006-02-28

Detect if Visualization is in Focus CODESYS Forge talk (Thread)
Detect if Visualization is in Focus
Last updated: 2020-06-15

1 2 3 .. 42 > >> (Page 1 of 42)

Showing results of 1028

Sort by relevance or date