Search talk: go on

 
<< < 1 .. 168 169 170 171 172 .. 175 > >> (Page 170 of 175)

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 rossanoparis on After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working CODESYS Forge talk (Post)
Hello at all. After un upgrade of "CODESYS Control for Raspberry Pi MC SL" from v4.7 to v4.9 SysFileOpen function stopped working. I'm not able to read or write files from the PLC application. Before this upgrade all worked fine. I've read this thread [ https://forge.codesys.com/forge/talk/Engineering/thread/3da9ded84e/ ] Despite I followed that indications I couldn't get my code working again. Perhaps I'm missing something or I didn't understand how to use placeholders at all. Is there a different syntax to use for "SysFileOpen" in order to use placeholders? Thanks in advance for your help. Information Compiler: CODESYS V3.5 SP19 Patch 2 Runtime: codesyscontrol 4.9.0 HW: KUNBUS RevPi Connect S Below the paths I want to access (The entire CODESYSControl_User.cfg file is attached) [SysFile] PlaceholderFilePath.1=/home/pi/hpca/bin, $hpcabin$ PlaceholderFilePath.2=/home/pi/hpca/cfg, $hpcacfg$ PlaceholderFilePath.3=/home/pi/hpca/logs, $hpcalogs$ PlaceholderFilePath.4=/home/pi/hpca/resources, $hpcares$
Last updated: 2023-08-22

Post by shooxplc on How to call the same program from library and get the vars updated. CODESYS Forge talk (Post)
Hi, I am writing to you today because I would like to create a library that would contain a program with its various subprograms, in my example "PLC_PRG" with "a", "aa", "aaa". But once the library is created as shown below: I would like to be able to drag and drop my folder as many times as I want (let's say I manage the same system multiple times). Once the drag and drop is done, we can see the second folder with the variables renamed successfully. As shown below: But my variables in CAD_1 remain the same as for CAD, so it's PLC_PRG instead of PLC_PRG_1, for example. Is there a solution to automate this? I wouldn't want to have to rename all my variables manually, considering that in the program where I want to do this, the number of variables is substantial. Lucas.
Last updated: 2023-08-23

Post by timvh on Detect "Cancel" Press in FileOpenSave Dialog CODESYS Forge talk (Post)
Maybe there is a better way, but a long time ago I created a test application that worked like this: With a button I opened the dialog and I added a "Input configuration - OnDialogClosed" "Execute ST-Code" action to this same button which called the following Function when the dialog was closed: F_OnFileDialogClosed(pClientData); Below this Function which handled the result: // This function is called from the visualization when the dialog is closed. FUNCTION F_OnFileDialogClosed : BOOL VAR_INPUT pClientData : POINTER TO VisuElems.VisuStructClientData; END_VAR VAR dialogMan : VisuElems.IDialogManager; FileOpenCloseDialog : VisuElems.IVisualisationDialog; result : VisuElems.Visu_DialogResult; _sFileName : STRING(255); END_VAR // the DialogManager is provided via the implicitly available VisuManager dialogMan := VisuElems.g_VisuManager.GetDialogManager(); IF dialogMan <> 0 AND pClientData <> 0 THEN FileOpenCloseDialog := dialogMan.GetDialog('VisuDialogs.FileOpenSave'); // gets the FileOpenSave dialog IF FileOpenCloseDialog <> 0 THEN result := FileOpenCloseDialog.GetResult(); // gets the result (OK, Cancel) of the dialog IF result = VisuElems.Visu_DialogResult.OK THEN // Original code gvlFile.FileListProvider(); _sFileName := CONCAT(gvlFile.FileListProvider._stDirectory, gvlFile.FileListProvider.stFile); // do something with this file name... END_IF END_IF END_IF
Last updated: 2023-09-19

Post by damian177 on Codesys and SMS in RPi CODESYS Forge talk (Post)
I tried initialize my GSM modem by write simple application in C, and GSM modem works, below used AT commands: AtChat: T : "AT" AtChat: F : "OK" AtChat: T : "AT+CMEE=1" AtChat: F : "OK" AtChat: T : "AT+CMGF=0" AtChat: F : "OK" AtChat: T : "AT+CGMI" AtChat: F : "WH_Ltd" AtChat: F : "WH_GM35" AtChat: F : "Revision: RDA BV5" AtChat: F : "OK" AtChat: T : "AT+CGMM" AtChat: F : "WH_GM35" AtChat: F : "OK" AtChat: T : "AT+CGMR" AtChat: F : "Revision: GM35-D_B5_R05_A01_D170914" AtChat: F : "OK" AtChat: T : "AT+CGSN" AtChat: F : "868221045990218" AtChat: F : "OK" AtChat: T : "AT+CNMI=2,1,0,1,0" AtChat: F : "OK" AtChat: T : "AT+CLIP=1" AtChat: F : "OK" AtChat: T : "AT+COPS?" AtChat: F : "+COPS: 0,2,\"26002\"" AtChat: F : "OK" operator name: "26002" AtChat: T : "AT+CREG?" AtChat: F : "+CREG: 1,1" AtChat: F : "OK" at+creg Modem is initialized I do not understand why Codesys SMS library send AT+CPIN? command ?
Last updated: 2023-09-29

Post by ryusoup on JSONByteArrayWriter problem? CODESYS Forge talk (Post)
Hello, I am trying to implement a FB to make JSON formatted WSTRING type message using JSON Utilities 1.9.0.0 included in the IIoT library. In my case, I want to set some objects or arrays and set values to them later. But when I wrote as the sample below, // init builder builder(pJsonData:=pJsonData, diRootObj=>diRootObj); // set the 1st key to root diKey1 := builder.SetKeyWithArray(wsKey:="key1", diParentIndex:=diRootObj, eError=>eError); // set a value to the 1st key wsValue:="value01"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey1, eError=>eError); // set the 2nd key to root diKey2 := builder.SetKeyWithArray(wsKey:="key2", diParentIndex:=diRootObj, eError=>eError); // set a value to the 2nd key wsValue:="value02"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey2, eError=>eError); // set a value to the 1st key again wsValue:="value03"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey1, eError=>eError); // set a value to the 2nd key again wsValue:="value04"; builder.SetValue(Value:=wsValue, diParentIndex:=diKey2, eError=>eError); // write build result writer(xExecute:=TRUE, pwData:=ADR(wsResult), udiSize:=SIZEOF(wsResult), xAsyncMode:=FALSE, jsonData:=pJsonData^); the result was: { "key1": ["value01"], "key2": ["value02", "value03", "value04"] } while my expection was: { "key1": ["value01", "value03"], "key2": ["value02", "value04"] } Inspecting pJsonData^, JSONData itself seems to be ok, so I believe the issue is something caused by the writer FB. Does anyone know how to fix it? Thanks,
Last updated: 2023-10-04

Post by captaincookie on increase default string length in queue CODESYS Forge talk (Post)
Hello, I'm using Codesys V3.5 SP18 Patch 4. In the ElementCollectionExample Project from Codesys, I test the SimpleQueueExample in a Control Win V3 x64 environment. I try to add a string of 95 characters length to a queue. The default length of strings is defined as 80 characters. In the initialization of a string variable, it is possible to increase the length by the definition of e.g. STRING(1000). But when I write the string defined like this to the queue, only 80 characters are written to it and the rest is missing. I think the default length is still set in the queue definition, so it is necessary to change this, isn't it? Is there any option to increase the default length of strings in the queue? Attached you can find the used project. Thanks in advance. If any information are missing or my description unclear please let me know.
Last updated: 2023-10-05

Post by markusef3 on Verhalten bei zu kurz gesetzter Task-Zyklus-Zeit CODESYS Forge talk (Post)
Hallo zusammen, ich habe eine Frage bezüglich dem Verhalten der Tasks. In der Hilfe und hier im Forum sowei im Internet konnte ich diesbezüglich leider nichts finden. Wie genau verhält sich Codesys wenn mehrere zyklische Task eingestellt sind und bei einem ab und zu die Abarbeitung des angehängten Programmes länger dauert als das Aufrufintervall eingestellt ist. D.H. der nächste Aufruf würde "theoretisch" erfolgen bevor alles im Program abgearbeitet ist. Z.B. Intervall ist 1ms, Abarbeitung dauert manchmel 1,1ms oder länger. (Watchdog ist zwar eingeschaltet, aber größer gewählt als das Zyklische Intervall zum Aufruf. Watchdog soll jetzt auch nicht das Thema sein). Was passiert in so einem Fall? - Wird das Programm zuerst zu Ende abgearbeitet und dann der nächste Aufruf gestartet? - Wird das Programm "mittendrin" unterbrochen und dann neu gestartet? - wie genau muss ich mir das vorstellen wenn dem so ist? - ...... - ...... Ich konnte überall nur Anleitungen finden wie die Tasks zu konfigurieren sind, jedoch nichts dazu was im oben genannten Fall genau passieren wird. Gruss Markus
Last updated: 2023-10-19

Post by janber0206 on Gateway doesn't come online, regarding a working internet connection CODESYS Forge talk (Post)
Solved EN: The Problem is that the Codesys Edge-Gateways have a License with a runtime of an half year, as long the Gateways are online they will self renew themselfs. In my Case the RevPi was more than a year offline and so the Edge-Gateway was not working anymore. The solution: I accessed a laptop that was directly connected to the RevPi. I installed the Codesys service tool and renewed the certificate manual. DE: Das Propblem ist das die Codesys Edge-Gatways eine Lizenz haben die nur ein halbes Jahr gültig ist. Solange das Gateway eine Internet verbindung hat aktualisiert sich das Zertifikat von alleine. In meinem Fall war das Gateway aber über ein Jahr offline und hat somit nicht mehr funktioniert. Die Lösung: Ich hab auf einen Laptop von Kunden mit TeamViewer zugegriffen, der Laptop wurde mit Kabel direkt mit RevPi verbunden. Codesys Service Tool installiert und dann das Gatewayzertifikat aktualisiert.
Last updated: 2023-10-26

Post by riccardo on VisuElems.CurrentUserGroupId is not stable CODESYS Forge talk (Post)
GoodMorning everyone. I have a system that, in case of alarm, have to block. When the operator logs in must have to acknoledge the alarm and should operate in the system freely. To perform this I detect the logged User by (VisuElems.CurrentUserGroupID <> 0) with a similar code to the the following: PROGRAM AlarmMngt VAR alarm : BOOL:= FALSE; Ack : BOOL:= TRUE; PushBottonOpening : BOOL:= FALSE; Valve : BOOL := FALSE; Flag: BOOL := FALSE; END_VAR IF alarm AND Ack AND (NOT Flag) THEN valve := FALSE; PushBottonOpening := FALSE; Ack := FALSE flag := TRUE; ELSIF (NOT alarm) AND Ack THEN flag := FALSE; END_IF (* if the system is in alarm but there is a logged operator that acknowledge the alarm the system allows the valve opening.*) IF (VisuElems.CurrentUserGroupID <> 0) AND Ack AND Alarm AND PushBottonOpening THEN Valve := TRUE; ELSIF (VisuElems.CurrentUserGroupID = 0) AND Alarm THEN valve := FALSE; END_IF The problem I have is in the last 5 lines of the code: Even if there is a logged in user, the GroupID variable is subjected to a refresh that cyclically set for an instant it to 0 and this close the valve making difficult to the user to work Now I solved it creating a time hysteresys cycle but it is not a good solution. Someone is able to explane me why the GroupID variable is sobjected to this refresh and how to stabilize to avoiding it? Thank you in advance, Riccardo
Last updated: 2023-11-10

Post by mm-sceg on Runtime geht sporadisch in Störung -> RaspiPi4 reagiert nicht mehr CODESYS Forge talk (Post)
Guten Tag, ich hab seit längerem das Problem, dass mein Raspberry Pi4 durch die PLC in Störung geht. Auf dem Raspi läuft eine einfache Software mit OPC UA server, InfluxDB und ein NodeRed-Server. (Und MQTT-Server) Daten werden von der PLC über OPC-UA an NodeRed übergeben. Es kann sein, dass der Raspi 2 Wochen läuft, dann geht die PLC in Stopp. Manchmal nur 2-3 Tage. Ein Neustart über Spannung aus & wieder an schafft Abhilfe. NodeRed wirft extrem viele Fehlermeldungen in kurzer Zeit. Wenn die PLC in Störung ist, kann man sich nicht mal mehr über SSH beim Raspi einloggen. Der Raspi ist aktiv gekühlt und im Normalbetrieb nicht überlastet. Ich hab einige logfiles mit vielen Einträgen die mir nichts sagen, eventuell hat hier jemand eine Idee wie ich dem Problem Herr werden kann :) Der letzte Datenbankeintrag von der SPS war am 11.11.2023 um 5:55:50 Uhr. D.h. danach muss die SPS gestorben sein. Siehe Raspi-Log im Anhang. Das LogFile von Codesys startet leider erst um 11 Uhr, weshalb weiß ich leider nicht. Vielen Dank schonmal
Last updated: 2023-11-11

Post by oi18ct on ARM SL Development Board Recommendation CODESYS Forge talk (Post)
Hello codesys forum, My company is looking at developing a solution with Codesys ARM SL. The requirements will not tax the capabilities of Codesys. I would like to buy an AMR 7 or 8 Dev Board for experimenting. I am looking for a recommendation as I have minimal experience with Linux. Any input from the forum would be most appreciated as the hardware requirements as provided by Codesys for ARM SL seem pretty minimal (basically a arm7 or 8 with Debian is all). Our needs are small in scale- something like 8 digital inputs, 6 digital outputs, 2 analog inputs and 1 analog output. A small gui will be published via web visualization for external display (no local display). Communications with ModbusTCP and uart/RS485. It may be necessary to access i2c and make c or python calls to some existing code that is pretty small. Something like the EMCraft STM32MP1 SOM Starter Kit or Octavo Systems OSD32MP1-RED development board? Ideally something that has a path to a SoM for production. Kontron appears to have some interesting options too. Just having a hard time deciding where to start. Thanks in advance... LC
Last updated: 2023-11-11

Post by annd on Migration von "CODESYS Control for PFC200 SL" zu WAGO FW26 "CODESYS V3.5.19.2" CODESYS Forge talk (Post)
Hallo, da Wago nun von eCockpit zum offenen "CODESYS Development System V3" wechselt, möchte ich meinen bestehenden 750-8212 von der PFC200 SL auf die Wago Firmware umstellen. Welche Schritte sind dabei notwendig? Den Controller würde ich auf die aktuelle FW 26 updaten und die 3.5.19.2 von Wago mit den Descriptions verwenden. Reicht es im Codesys Projektbaum mit "Gerät aktualisieren" auf den Wago Controller zu wechseln? Es wird dann statt dem "Pfc200Bus"ein leerer K-Bus und ein leerer Com-Port angezeigt. Müssen die einzelnen Module dann darunter neu angelegt und alle E/A Variablen manuell neu eingetragen werden? Das exportieren und danach wieder importieren funktioniert nicht, weil die Namen bzw. Adressen unterschiedlich sind. Ist das so richtig? Kann der Block "Modbus_COM_Port - Modbus_Master_COM_Port - Modbus_Slave" so bleiben wie bisher oder muss das auch unter dem neuen COM-Port neu angelegt werden? Für ein paar Hinweise wäre ich dankbar. Schöne Grüße, annD
Last updated: 2023-11-17

Post by annd on Migration von "CODESYS Control for PFC200 SL" zu WAGO FW26 "CODESYS V3.5.19.2" CODESYS Forge talk (Post)
Ich hab's hinbekommen: Nach dem Controller Update hab ich ein neues Projekt gemacht und nur den PFC200(8212) eingefügt (es erscheint dann ein leerer Kbus und eine serielle Schnittstelle COM1). Dann hab ich mich am Controller eingeloggt und den Kbus (Rechtsklick: Geräte suchen) mit allen Modulen automatisch ergänzen lassen. Bei den leeren Modulen hab ich dann das E/A-Abbild in csv exportiert. Dasselbe hab ich bei meinem alten "PFC200 SL" Projekt gemacht. Und dann in Excel alle Variablennamen in die leeren csv kopiert und danach wieder im neuen Projekt importiert. Dann hab ich noch alle Programmblöcke, Tasks, Visualisierungen und auch Modbus TCP Master u. Slave und auch Modbus COM Port Master und Slave in das neue Projekt kopiert. Weiters hab ich alle notwendigen Bibliotheken im Bibliotheksverwalter eingefügt. Dann noch ein paar kleine Fehler korrigiert (ich musst einen anderen Block zum Lesen der Uhrzeit nehmen) bis ich das neue Projekt fehlerfrei übersetzen konnte. Dann konnte ich es auf den Wago Controller übertragen und direkt starten. Es sieht so aus, dass alles läuft. Gruß annD
Last updated: 2023-11-18

Post by toffeebonbon on EL7041-0052 - does it run with EL7041 SoftMotion? CODESYS Forge talk (Post)
Good morning everyone. In my setup I am trying to use a couple of EL7041-0052 (the EL7041 variant without terminals for an encoder) to run stepper motors without feedback. When using the softmotion drivers for the EL7041 (Rev22 and Rev24, even selecting external feedback type doesn't work) the device log shows warnings for the corresponding hardware: "SDO write error 0x1 -> 0x8012:0x08 eError 0x1 AbortCode 0x6090011". 0x8012:0x08 is the register for the Feedback Type. My best guess was setting the the register value in the start parameters to zero, but the result is the same. What else can I try to get the hardware to work? I have screenshots attatched showing the running fieldbus and the log messages. EDIT: One clarification: the "device log" that shows the error is the PLC, not the ethercat terminal. The log of the terminal itself shows neither errors nor warnings. BR Robert
Last updated: 2023-11-29

Post by arundara on Variable Sync Issue In Soft Plc Redundancy CODESYS Forge talk (Post)
Hello, I was trying to create a redundancy POC for our application where we read data from few modbus tcp devices. As there is a limitaion that modbus tcp device support only for single master device, we wanted to test how the variable sync happens in redundancy mode. For that i have used the redundancy sample code added a variable "b" under a condition. What i observed was while active controller is running, if passive controller is powerup, passive controller is able to sync all the data configured for redundacny. But after that the variable data which resided under a condition is not synching from active to passive controller. I have attached the image where i have highlighter the variable. Can some help me to understand how redundacny work in codesys soft plc and if there is a solution to sync variable which are under condition, please explain the same or suggestion to achieve the same. Hardware - Raspberry Pi (2 qty) Redundancy licence used - yes in both controllers. Codesys runtime - 4.9.0.0 Codesys software version - V3.5 SP19 if i have posted this question in wrong section, please do let me know in whcih section i have to post this question.
Last updated: 2023-12-01

Post by user3000 on Can't find an Extended Pulse Timer (TP and LTP) CODESYS Forge talk (Post)
Hello, For my program I need an extended pulse timer, which can be referred to as a retriggerable pulse timer. Where every rising edge of the input resets the elapsed time zero, extending the lenght of the output pulse. The Codesys pulse timer (TP) is a one-shot timer and only resets the elapsed time with the falling edge of the input. There is also a pulse timer (LTP) in codesys, but in my simulation it was also functioning as a one-shot even though the description sounds like LTP should be retriggerable. I have uploaded some timing plots from another PLC program for reference. I am looking for a timer equivalent to the "TEP" diagram. Is there an Extended Pulse Timer in Codesys? Maybe there is a way to manipulate the input so it resets the elapsed time outside the function block?
Last updated: 2023-12-06

Post by open on How to create a stopwatch? CODESYS Forge talk (Post)
Hi @ph0010421, I tried the program the TimeTaken is calculated when stop is triggered. I want the TimeTaken to be continuously calculated and counting when a BOOL variable is true. I tried to program this way: Declaration: PROGRAM PLC_PRG VAR bStartStop: BOOL := FALSE; // Start/Stop button bReset: BOOL := FALSE; // Reset button bRunning: BOOL := FALSE; // Flag indicating whether the stopwatch is running tStartTime: TIME; // Variable to store the start time tElapsedTime: TIME; // Variable to store the elapsed time END_VAR Implementation: // Main program logic IF bReset THEN // Reset button pressed, reset the stopwatch bRunning := FALSE; tElapsedTime := T#0s; ELSIF bStartStop THEN // Start/Stop button pressed, toggle the running state IF bRunning THEN // Stop the stopwatch bRunning := FALSE; ELSE // Start the stopwatch bRunning := TRUE; tStartTime := tElapsedTime; END_IF; END_IF // Update the elapsed time when the stopwatch is running IF bRunning THEN tElapsedTime := tElapsedTime + T#1s; // Adjust the time increment as needed END_IF However counting of the seconds is not accurate. I tried changing the main task cycle time interval to 1000ms. The counting of seconds become slower. (see attached) Please help
Last updated: 2023-12-08

Post by ph0010421 on How to create a stopwatch? CODESYS Forge talk (Post)
Do you need an 'hours-run' counter? And 1 second resolution is ok? I think you're over-thinking it. (The task time needs to be < 1second) Have a look at the LAD... Then, the time in seconds can be made into hh:mm:ss with this FUNction Declarations: FUNCTION funSecondsToStringTime: string VAR_INPUT InSeconds: UDINT; END_VAR VAR AsString: STRING; Minutes: UDINT; Hours: UDINT; Seconds: UDINT; MinutesAsString: STRING(2); HoursAsString: STRING(2); SecondsAsString: STRING(2); END_VAR and the code: Hours := InSeconds / 60 / 60; //Derive hours Minutes := (InSeconds - (Hours * 60 * 60)) / 60; //Derive minutes Seconds := InSeconds - ((Hours * 60 * 60) + (Minutes * 60));//Derive seconds HoursAsString := UDINT_TO_STRING(Hours); MinutesAsString := UDINT_TO_STRING(Minutes); SecondsAsString := UDINT_TO_STRING(Seconds); IF LEN(HoursAsString) = 1 THEN HoursAsString := CONCAT('0',HoursAsString); END_IF; IF LEN(MinutesAsString) = 1 THEN MinutesAsString := CONCAT('0',MinutesAsString); END_IF; IF LEN(SecondsAsString) = 1 THEN SecondsAsString := CONCAT('0',SecondsAsString); END_IF; AsString := CONCAT(HoursAsString, ':'); //assemble string AsString := CONCAT(AsString,MinutesAsString); AsString := CONCAT(AsString,':'); AsString := CONCAT(AsString, SecondsAsString); funSecondsToStringTime := AsString;
Last updated: 2023-12-08

Post by andrax on Meine Gerätesammlung basierend auf TCA9548 CODESYS Forge talk (Post)
Hallo zusammen, ich programmiere öfters mal kleinere Messgeräte und Datenlogger. Je nach Einsatzzweck musste ich mir ein paar Gerätetreiber selber schreiben. Da es eine recht große Sammlung ist, stelle ich die hier einfach mal ein. Die Sammlung basiert auf den Gerätetreiber TCA9548 Multiplexer von Steffen Dreyer. Codesysversion: V3.5 SP18 Patch 4 Inhalt: -4channel Dimmer (Stefan Dreyer) -BMA456 (Andre Klien) -BME280 (Stefan Dreyer) -BMP280 (Stefan Dreyer) -EEPROM_24C512 (Stefan Dreyer) -ADS1115 (Andre Klien) -ICP10125 (Andre Klien) -PCA9555 (Stefan Dreyer) -PCA9685 (Stefan Dreyer) -PCF8575 (Stefan Dreyer) -SDP810 (Andre klien) -SSD1306 (Stefan Dreyer) -TCA9548 (Stefan Dreyer) -TSL2561 (Stefan Dreyer) Alle Gerätetreiber laufen über den Multiplexer, können aber auch ohne betrieben werden. Einschränkung: BMA456: Die Konfigurationsdaten werden erfolgreich in den Chip geschrieben, dieser meldet aber config wrong. Warum auch immer, der Sensor funktioniert und bringt hochempfindlich Beschleunigungsdaten. ADS1115: Hie habe ich nur die wichtigsten funktionen implementiert. 1-4 Kanäle, PGA, kontinuierlicher Modus, Datenrate. Alle anderen Funktionen (single-shot, komparator,alm) sind nicht implementiert. Das macht auch keinen Sinn, da diese Funktionen besser über die Steuerung realisiert werden können. Achtung beim ADS1115 ist zwingend ein Levelshifter notwendig, wenn ihr diesen mit 5V betreiben wollt. Ihr grillt sonst euren Raspi (SDA, SCL sind dann 5V) Gruß Andre
Last updated: 2023-12-18

Post by user0815 on Kommunikation zwischen ROS2 und CODESYS über Web Sockets CODESYS Forge talk (Post)
Hallo zusammen, ich hoffe ihr könnt mir weiterhelfen. Meine CODESYS Version ist die V3.5 SP19 Patch 4 und die Zielsystemversion ist die 4.10.0.0 . Ich verwende CODESYS ohne Lizenz. Ich probiere eine Verbindung über Web Sockets zwischen ROS und CODESYS aufzubauen. Der Client von CODESYS verbindet sich mit dem Ros Bridge Server aber ich weiß nicht wie ich dem Ros Server sage welches Topic er publishen soll. Über Node-Red habe ich eine Verbindung aufbauen können. Dafür habe ich "node-red-contrib-flowake-ros-nodes" verwendet. Den Daten Austausch habe ich mit mit Wireshark angeschaut und nun probiere ich den mithilfe von CODESYS nachzubauen. NAch dem sich der Client verbunden hat muss folgende Nachricht übermittelt werden:"{"op":"call_service","id":"call_service:/rosapi/topic_type:1","type":"rosapi/TopicType","args":{"topic":"/cmd_vel"}}." Ich vermute es funktioniert über Frames aber ich weiß nicht wie ich es umsetzten soll. Besten Dank für die Hilfe und schöne Grüße
Last updated: 2024-01-03

Post by spiessli on Softmotion axis to CANopen Maxon IDX drive CODESYS Forge talk (Post)
Thanks for the advise, indeed, this was somewhat, what my intention was. I tried around again with EDSes and DCFs, anyway. It appears that the DCFs end up in a subfolder in the attach device dialog. Astonishingly, when attaching the DCF version I get a device in the device tree, where I can add a SoftMotion axis, whereas when I attach the device not in the subfolder, then I cannot. Further astonishingly, when looking in the CANopen parameters in supported profiles, "402" is listed in the case of the DCF variant, whereas in the EDS variant "0" is shown. Comparing EDS and DCF files I cannot guess, where the difference is coming from. I cannot tell either why I have always attached the EDS variant and apparantly never the DCF variant. As I am not in the lab right now, I cannot test if the connection actually is working. Thanks again, spiessli
Last updated: 2024-01-07

Post by kevin123 on auto-answer dialog using system.prompt_answers CODESYS Forge talk (Post)
I am trying to do "update device" in a project which was saved in a different version of CODESYS using ScriptEngine, a dialog with 'Yes' and 'No' button popped up showing that "Do you want to upgrade the storage format for this project? -if you click 'Yes', storage format will be upgraded... -if you click 'No', storage format will not be changed..." I have to click the 'Yes' button automatically by scriptEngine. I know from others topics here in forum, that some dialogs can be auto-answered using system.prompt_answers. And I also get the messagekey of this dialog: Key: "<< No Key>>" Message: "Do you want to upgrade the storage format for this project? - If you click 'Yes',... i have tried using the system.prompt_answers command below, but the dialog was not auto-answered. system.prompt_answers["<<No Key>>"] = PromptResult.Yes Does someone know how to auto-answer the dialog using system.prompt_answers command with messagekey"<< No key>>"? or any suggestions to solve this issue, Thanks!
Last updated: 2024-01-26

Post by kevin123 on auto-answer dialog using system.prompt_answers CODESYS Forge talk (Post)
I am trying to do "update device" in a project which was saved in a different version of CODESYS using ScriptEngine, a dialog with 'Yes' and 'No' button popped up showing that "Do you want to upgrade the storage format for this project? -if you click 'Yes', storage format will be upgraded... -if you click 'No', storage format will not be changed..." I have to click the 'Yes' button automatically by scriptEngine. I know from others topics here in forum, that some dialogs can be auto-answered using system.prompt_answers. And I also get the messagekey of this dialog: Key: "<< No Key>>" Message: "Do you want to upgrade the storage format for this project? - If you click 'Yes',... i have tried using the system.prompt_answers command below, but the dialog was not auto-answered. system.prompt_answers["<<No Key>>"] = PromptResult.Yes Does someone know how to auto-answer the dialog using system.prompt_answers command with messagekey"<< No key>>"? or any suggestions to solve this issue, Thanks!
Last updated: 2024-01-26

Post by kevin123 on (no subject) CODESYS Forge talk (Post)
I am trying to do "update device" in a project which was saved in a different version of CODESYS using ScriptEngine, a dialog with 'Yes' and 'No' button popped up showing that "Do you want to upgrade the storage format for this project? -if you click 'Yes', storage format will be upgraded... -if you click 'No', storage format will not be changed..." I have to click the 'Yes' button automatically by scriptEngine. I know from others topics here in forum, that some dialogs can be auto-answered using system.prompt_answers. And I also get the messagekey of this dialog: Key: "<< No Key>>" Message: "Do you want to upgrade the storage format for this project? - If you click 'Yes',... i have tried using the system.prompt_answers command below, but the dialog was not auto-answered. system.prompt_answers["<<No Key>>"] = PromptResult.Yes Does someone know how to auto-answer the dialog using system.prompt_answers command with messagekey"<< No key>>"? or any suggestions to solve this issue, Thanks!
Last updated: 2024-01-26

<< < 1 .. 168 169 170 171 172 .. 175 > >> (Page 170 of 175)

Showing results of 4354

Sort by relevance or date