Post by joshskellig on Publish a JSON payload via MQTT Publish (using IIot Libraries)
CODESYS Forge
talk
(Post)
I am trying to figure out how to get a JSON payload to properly publish to my MQTT Broker. I am able to generate JSON using the examples from Codesys, but when I send that payload via MQTT there are characters that are extra or not recognized by my MQTT client. Any idea what could be causing it? PROGRAM PLC_PRG VAR hostname: STRING := 'localhost'; port: UINT := 1883; topic: WSTRING(1024) := "testing/"; payload: BYTE; factory : JSON.JSONDataFactory; eDataFactoryError : FBF.ERROR; pJsonData : POINTER TO JSON.JSONData := factory.Create(eError => eDataFactoryError); fb_JBuilder : JSON.JSONBuilder; wsValue : WSTRING := "Value1"; diRootIndex, diObject1Index : DINT; iValue : INT := 1234; jsonArrayWriter : JSON.JSONByteArrayWriter; wsJsonData : WSTRING(1000); xFirst : BOOL := TRUE; mqttClient: MQTT.MQTTClient; mqttPublish: MQTT.MQTTPublish; mqttPublishProperties: MQTT.MQTTPublishProperties := (bPayloadFormatIndicator := 1, wsContentType := "application/json"); END_VAR // Json Functionality IF xFirst THEN fb_JBuilder(pJsonData := pJsonData, diRootObj => diRootIndex); fb_JBuilder.SetKeyWithValue("Key1", wsValue, diParentIndex := diRootIndex); diObject1Index := fb_JBuilder.SetKeyWithObject("Key2", diParentIndex := diRootIndex); fb_JBuilder.SetKeyWithValue("Key3", iValue, diParentIndex := diObject1Index); xFirst := FALSE; END_IF jsonArrayWriter(pwData := ADR(wsJsonData), udiSize := SIZEOF(wsJsonData), jsonData := pJsonData^, xAsyncMode := FALSE); MSU.StrTrimW(pString:= ADR(wsJsonData)); // MQTT Functionality mqttClient( sHostname:=hostname, uiPort:=port, eMQTTVersion:=MQTT.MQTT_VERSION.V5 ); mqttPublish( mqttClient:=mqttClient, pbPayload:=ADR(wsJsonData), udiPayloadSize:=SIZEOF(wsJsonData), wsTopicName:=topic, mQTTPublishProperties:=mqttPublishProperties );
Last updated: 2024-04-10
Post by rabaggett on CODESYS control for Raspberry Pi 64 SL errors
CODESYS Forge
talk
(Post)
Hi, I am trying to create a project using a raspberry pi, I have added the modules for the Pi and MCP3008. I have encountered som errors that I don't know how to track down. 1. The GPIOs give preprocessor errors, but I read that this does not prevent compiling. This seems to be true. I can build the empty project with no errors. 2. After adding a SPI master and MCP3008, the preprocessor errors double, but seem similar and the project again builds with no errors. 3. I add a DUT and GVL, with a function, and I get the following errors. They remain even if I delete these things. ------ Build started: Application: Device.Application ------- Typify code... [ERROR] crr: C0032: Cannot convert type 'Unknown type: 'ADR(GVL_Io_17160064_c083_41f8_9e53_208be7537753_HPS_7.Io_17160064_c083_41f8_9e53_208be7537753_HPS_7)'' to type 'POINTER TO IoConfigParameter' [ERROR] crr: C0077: Unknown type: 'GVL_Io_17160064_c083_41f8_9e53_208be7537753_HPS_7.Io_17160064_c083_41f8_9e53_208be7537753_HPS_7' [ERROR] crr: C0046: Identifier 'GVL_Io_17160064_c083_41f8_9e53_208be7537753_HPS_7' not defined Compile complete -- 3 errors, 0 warnings I attach the project. What am I doing wrong? Thanks!
Last updated: 2024-05-02
Post by hanoues on setting date and time on CPX-E
CODESYS Forge
talk
(Post)
Hello, Can anybody here tell me how to modify the time and date on my CPX-E? I used the code I found on CODESYS online help, but it doesn't work. What am I missing? FUNCTION current_date_time : STRING VAR stUTC_Timestamp : SysTime; //utc time // ULINT#1528280694913 stLocal_TimeStamp : SysTime; //local time but is in general equal // ULINT#1528280694913 stdNow : SysTimeDate; //local time in an object to access each number (day, month...) dtNow : DATE_AND_TIME;//DT#2018-6-6-10:24:54 todNow : TIME_OF_DAY; // TOD#10:24:54.913 datNow : DATE; // D#2018-6-6 END_VAR SysTimeRtcHighResGet(stUTC_Timestamp); // ULINT#1528273494913 SysTimeRtcConvertHighResToLocal(stUTC_Timestamp, stdNow); //convert UTC ULINT to Local SysTime // stdNow.wYear = UINT#2018 // stdNow.wMonth = UINT#6 // stdNowy.wDay = UINT#6 // stdNow.wHour = UINT#10 // stdNow.wMinute = UINT#24 // stdNow.wSecond = UINT#54 // stdNow.wMilliseconds = UINT#913 // stdNow.wDayOfWeek = UINT#3 // stdNow.wYday = UINT#157 SysTimeRtcConvertDateToHighRes(stdNow, stLocal_TimeStamp); // ULINT#1528280694913 dtNow := TO_DT(stLocal_TimeStamp / 1000 ( ms )); // DT#2018-6-6-10:24:54 todNow := TO_TOD(stLocal_TimeStamp MOD TO_ULINT(T#1D)); // TOD#10:24:54.913 datNow := TO_DATE(dtNow); // D#2018-6-6 (convert to appropriate string) current_date_time := concat('$N[', TO_STRING(dtNow)); current_date_time:= concat(current_date_time,'.'); current_date_time:= concat(current_date_time, TO_STRING(stdNow.wMilliseconds)); current_date_time:= concat(current_date_time,'] - '); RETURN;
Last updated: 2024-05-21
Post by tortilla on J1939 connection between two devices
CODESYS Forge
talk
(Post)
Hey, I'm pretty new to CoDeSys so I don't know a lot of things yet. I have to create a connection between two devices (CANbus - J1939 connection). The idea for now is to send a message from one to another (one operates on 3.5 SP11 the other one on 2.3) I watched a few videos, worked with the documentation and worked with chatGPT 4o and was able to build the attached file. This part is about the device on 3.5.11: I'm using the J1939LocalECUDiag, TransmitParameterGroup, TransmissionTrigger Function blocks to send the message but my TransmitPG.xBusy / .xDone never turns to True and therefore my message is not sent while TransmitPG.xExcecute is True. I added the two devices in the CANbus in the J1939Manager and addapted the options like I've seen in the documentation. Can anyone explain what's wrong with my code in this casse or give me advices how to properly create a connection between my two devices? Thanks in advance!
Last updated: 2024-05-23
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by jkessler on IoDrvModbusTCP_Diag not defined when using MODBUS
CODESYS Forge
talk
(Post)
Hi, Same for me ! Works in Codesys 3.5.19 but not in 3.5.20. I'm currenly using with a WAGO PLC200 [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'IoDrvModbusTCP_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'IoDrvModbusTCP_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlave_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlave_Diag' n’est pas un composant de 'IoDrvModbusTCP' [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0046: Identificateur 'ModbusTCPSlaveUnit_Diag' non défini [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0080: Le bloc fonctionnel 'IoDrvModbusTCP' doit être instancié pour permettre l’accès [ERREUR] EmPlcProgram: Application [Device: Logique API]: C0004: 'ModbusTCPSlaveUnit_Diag' n’est pas un composant de 'IoDrvModbusTCP' Thanks in advance
Last updated: 2024-05-29
Post by greenwood on CODESYS Control Raspberry Pi mit Servotreiber T6 von StepperOnline
CODESYS Forge
talk
(Post)
Hallo, Ich scheine den Grund gefunden zu haben, das Kabel mit dem RJ45 Stecker ist für RS232 verdrahtet (am anderen Ende des Kabels ist ein 9-poliger SUB-D Stecker, nicht wie von mir im Eingangspost behauptet ein USB Stecker). In der Anleitung des Treibers ist immer nur von RS 485 die Rede. Alerdings habe ich es gestern abend noch geschafft eine funktionierende Version der setup-software herunterzuladen, und die verbindet sich offenbar über RS232. Daraufhin habe ich mir in der Anleitung des Treibers das Pinout der RJ45 Buchse nochmal angesehen, und die hat Kontakte für RS232 und für RS485. (Die liegen jeweils ganz am Rand, so ist mir das vorher nicht aufgefallen). Ich muss also als Nächstes ein richtig verdrahtetes Kabel auftreiben, und dann sehen ob das mit dem Adapter den ich habe funktioniert. An einen Abschlusswiderstand habe ich auch schon gedacht, nur weiss ich nicht wo ich den an einem RJ45 Stecker / Buchse - Paar anbringen soll... Ich bitte um Entschuldigung für die Verwirrung, ich mache das alles zum ersten Mal und es ist ganz schön viel auf einmal für mich. Nochmal vielen Dank für die Unterstützung!
Last updated: 2024-06-01
Post by nikgind on Codesys Communication Manger - Required information model version exists in the model repository but is not found
CODESYS Forge
talk
(Post)
Hi I am trying to import a custom information model that I created using UA Modeler. I have only added two new methods and two new object types. It is possible to add the information model to the Communication Manager and the two new object types are shown in the Information Model tab. After compiling i get the following error: Communication Manager [Device: PLC Logic: Application]: The information model http://opcfoundation.org/UA/ is required by http://yourorganisation.org/Bsp_3.1/ with a minimal publication date from 15.12.2023 but the device has only a model from 15.09.2021 installed. Probably the information model from 15.09.2021 is missing in the information model repository. The error message does not make sense to me. Should it not be “Probably the information model from 15/12/2023 is missing in the information model repository”? Anyway I have installed the information model from 15/12/2023 but not from 15/09/2021. Which makes the error message even stranger.
Last updated: 2024-06-09
Post by caprez95 on Deleting the trend recording history
CODESYS Forge
talk
(Post)
Hallo Ich möchte eine laufende Trendaufzeichnung stoppen, den Inhalt löschen und Trend-Diagramm auf 0 zurücksetzen. Laut Codesys soll das mit dem folgenden Code möglich sein: You can insert an input element in the visualization which the operator can use to delete the previous value recording in the trend visualization at runtime. The curve displayed until then is removed and the display starts over. In the application (example: in the program PLC_PRG), implement the following code: itfTrendRecording : ITrendRecording; itfTrendStorageWriter : ITrendStorageWriter; itfTrendStorageWriter3 : ITrendStorageWriter3; sTrendRecordingName : STRING := 'TrendRecording'; itfTrendRecording := GlobalInstances.g_TrendRecordingManager.FindTrendRecording(ADR(sTrendRecordingName)); xClearHistoryTrend: BOOL; IF xClearHistoryTrend THEN itfTrendRecording := GlobalInstances.g_TrendRecordingManager.FindTrendRecording(ADR(sTrendRecordingName)); IF itfTrendRecording <> 0 THEN itfTrendStorageWriter := itfTrendRecording.GetTrendStorageWriter(); IF __QUERYINTERFACE(itfTrendStorageWriter, itfTrendStorageWriter3) THEN itfTrendStorageWriter3.ClearHistory(); END_IF END_IF In the visualization of the trend recording, add a button for deleting the previous curve. Configure its Toggle property with the variable PLC_PRG.xClearHistoryTrend. ⇒ When xClearHistoryTrend is set to TRUE, the previously recorded curve is deleted. The recording immediately starts again. Dies löscht auch die Daten vom Trend, aber das Diagramm wird nicht auf 0 zurückgesetzt, sondern läuft einfach da weiter wo man gestoppt hat. Braucht es für den Diagramm-Reset noch einen zusätzlichen Befehl? Gruss
Last updated: 2024-06-11
Post by brubingh on Download Missing Libraries not working
CODESYS Forge
talk
(Post)
We are working on a project and the customer required 3.5.16 BF4. After working on the project for a few weeks I opened it the next morning and it could not access libraries. IecVarAccess could not be accessed. I checked if windows updated - it did not. So no explanation for why it lost access other than that I shut down the computer for the night. Note that I am using a demo license. I still haven't figured out any reason to purchase a license. So I spent the next hour reinstalling CodeSys. Note that I did NOT uninstall first. After install I waited another 5 minutes for it to open the first time. I clicked File->Open to open the project. Previously I had selected File->Recent Projects - not sure if that makes and difference. But after this process it did open the project and compile it just fine. This is miserable. If this had happened when I went on site to a customer I would have lost hours of work doing the reinstall. Is there a different and quicker fix?
Last updated: 2024-06-13
Post by marek71 on Ambiguous use of name - CO136
CODESYS Forge
talk
(Post)
My PLC is WAGO PFC200 Firmware Revision 26. target After updating WAGO_Devices_and_Libraries with newer Firmware 27, CODESYS wants to update all libraries to new versions. I will only add that I did not update the Firmware in the PLC. After compiling the program, I received the following errors: ------ Build started: Application: Device.Application ------- Typify code... [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): FbSerialInterface_internal: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): FbSerialInterface_internal: C0136: Ambiguous use of name 'RTS_IEC_RESULT' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): Initialize [FbSerialInterface_internal]: C0032: Cannot convert type 'Unknown type: 'RTS_INVALID_HANDLE'' to type 'POINTER TO BYTE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): Initialize [FbSerialInterface_internal]: C0136: Ambiguous use of name 'RTS_INVALID_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): Initialize [FbSerialInterface_internal]: C0046: Identifier 'RTS_INVALID_HANDLE' not defined [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): comextra_is_tx_empty: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): comextra_get_line_state: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): comextra_is_line_available: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): COMSW_SET_MODE: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' [ERROR] wagosyscom_internal_pfc, 1.0.2.5 (wago): comextra_set_line_state: C0136: Ambiguous use of name 'RTS_IEC_HANDLE' Compile complete -- 10 errors, 0 warnings Build complete -- 10 errors, 0 warnings : No download possible The problem was caused by the WagoSysPlainMem(WAGO) library in the original version 1.5.3.0 after updating to 1.5.3.1. After returning to version 1.5.3.0, the problems disappeared. Probably the version number of this library is responsible for supporting the appropriate Firmware Revision. Can anyone confirm or deny my suspicions?
Last updated: 2024-07-06
Post by xgongx on What is the insights of IoDrvEtherCAT.DCInSyncWindow?
CODESYS Forge
talk
(Post)
It is well known that you need to increase the value of IoDrvEtherCAT.DCInSyncWindow to solve the "Fieldbus lost synchronicity" issue. In the official document, IoDrvEtherCAT.DCInSyncWindow is explained as the toleration of a certain jitter. But the official document doesn't explain what kind of the jitter is. Is it the jitter of DC sync deviation, master timer or something else? It is very important to know the insights of IoDrvEtherCAT.DCInSyncWindow. For example, if it is the toleration of DC sync deviation, and the official recommending value is 200us for CODESYS SoftMotion. It means maximum of DC sync deviation is 200us. It is unacceptable for some high precision motion control tasks, for example high speed gear task, etc. Increasing the value of IoDrvEtherCAT.DCInSyncWindow will increase the deviation of motor rotation sync if it is the toleration of DC sync deviation. So, would anyone tell me what the insights of IoDrvEtherCAT.DCInSyncWindow is? Thanks.
Last updated: 2024-07-09
Post by berto on Opening PDF in Web Browser in Target Visu HMI
CODESYS Forge
talk
(Post)
Hi everybody, I've been facing problems with the PDF visualization in Web Browser. I am trying to open a pdf file called 'sample.pdf' which I manually saved inside PlcLogic/visu folder. I am setting the web browser URL as: 'http://127.0.0.1:8080/sample.pdf' but I get 'refused connection'. I got a similar error trying to open https sites and I discovered that I can only open http websites. Opening 'http://de.wikipedia.org' everything works fine. I also tried to check using code whether the sample.pdf is present in the directory. Unfortunately, when I try to read directories of 'PlcLogic' I get file FILE_OPERATION_DENIED (I am using File.DirList). I would like to be able to open PDF files in web browser. Possibly to move new PDF files in the folder as my customer wants to display different pdf manuals on the hmi. Here you find some screenshots and my .project. I am using Codesys 3.5.19.70. Best regards, Berto
Last updated: 2024-07-11
Post by trusty-squire on Confused by dwIpoTime input for SMC_Interpolator
CODESYS Forge
talk
(Post)
Hi, Learning Codesys CNC, and I am confused by the dwIpoTime parameter. I have a basic demo application, using SMC_Interpolator feeding into SMC_TRAFO_Gantry2Tool2, which then sets the position of the x/y SM_Drive_Virtual axis. I also have a C axis which revolves the tool, which is controlled using a simple tangential angle calculation SMC_CalcDirectionFromVector. The GCode I'm using has feed/accel set at 500. The axis configuration limits are well above that (2000). What's strange is that, when I run the simulation, the feed speed changes drastically when I update the variable dwIpoTime. The larger the number, the faster it moves. What's going on here? The documentation only says "This variable has to be set for each call. It represents the cycle time in ÎĽsec." Why does it change the feed speed I'm seeing the in simulation? What is a good number to use? The example I was looking at set it at 5000. Screenshot attached.
Last updated: 2024-07-18
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 denkihitsuji on Content update through Data URI on Web Brower on Visualization Toolbox
CODESYS Forge
talk
(Post)
Objective: I want to dynamically update the content with strings and JPEG images received from a TCP/IP socket. For this purpose, I am exploring the possibility of utilizing the Web Browser feature of the Visualization toolbox. Example: In a standard web browser, entering data:text/plain;charset=utf-8;base64,SGVsbG8gc3RyYW5nZXI= in the URL window will display "Hello stranger" on the webpage. Issue: When attempting to use this method in the Web Browser of the Visualization toolbox, the content does not display as expected. Instead, it shows the error:'Navigation to the webpage was canceled.'. Request: I seek guidance on how to resolve this issue so that the Web Browser in the Visualization toolbox correctly interprets and displays the data URI content. Alternative Solution Welcomed: Or, if it is possible to directly use Codesys Structured Text (ST) variables within an HTML page, this approach would also meet my requirements. Thank you for your attention.
Last updated: 2024-07-30
Post by sturmghost on Mimic behavior of the visualization button element with a custom button
CODESYS Forge
talk
(Post)
Im wondering how Codesys is doing the mouse event capturing with their visualization button element? If you add such a button without configuring any input configuration event (like OnMouseDown) or button state variable and then click on the button, the button changes to the visual pressed state and back if you release the button (so they must react to an OnMouseDown event). But how? If I try to mimic this behavior with my custom button visualization element (like a basic rectangle) I need to use an input configuration event to change the color of the button (to make it look like the button was pressed on OnMouseDown event). When I try to add this button via a Frame-Element to my main visualization page I'm unable to use an input configuration event on the Frame-Element because the input configuration event on the button element won't be evaluated anymore (it seems like you can't stack input fields, e.g. invisible input elements, onto each other). Hence the button is not shown pressed anymore. How they do it?
Last updated: 2024-08-04
Post by c3po on Von SNMP auf IIoT wechseln
CODESYS Forge
talk
(Post)
Hallo, 1. ich bin komplett NEU was Codesys angeht 2. ich muss direkt ein Retrofit machen von V2 auf V3 3. Neue Steuerung: WAGO 750-8211 PFC200. 4. das Projekt in V2 hat über SNMP daten im Netzwerk zur Verfügung gestellt, oder diese gelesen 5. das Projekt in V3 kann SNMP nur noch eingeschränkt nutzen, deswegen wurde mir vom WAGO Support nahegelegt die IIoT Lib zu verwenden. Frage: Wie mach ich das? Konkret: Ich habe die WagoAppSNMP Bibliothek installiert, damit kann ich schon mal Set und Get nutzen (hoffentlich, hab es ja noch nicht getestet, sondern nur programmiert). Ist das ein schlauer Weg, das über diese Lib zu machen? Denn: was macht der SNMP_SET_PLCDATA_WRITEAREA ? Den kann ich über die Wago Lib nicht nutzen und weiß auch nicht, was dieser Baustein konkret tut (Bild im Anhang). Es scheint mir, hier werden Daten auf ein Word im Netzwerk geschrieben? Aber geht das nicht auch einfacher? Es ist ja keine Adresse hinterlegt, wo das hin gehen soll oder? Also, ich verstehe den Baustein nicht so ganz und konnte bisher auch keine Erklärung dazu finden. Vielen Dank schon mal für eure Unterstützung, K.
Last updated: 2024-08-19
Post by otbeka on CmpCrypto CryptoGenerateHash Not Outputting
CODESYS Forge
talk
(Post)
Hi, I have been trying to use CryptoGenerateHash from the CmpCrypto Implementation library. My code is taken almost directly from the CryptoDemo.project example provided on Codesys Forge, yet the CryptoGenerateHash function does not write to the address listed in pHash. RTS_IEC_RESULT is OK, but I am getting nothing out of the function. No errors either, all my libraries are up to date. Any help would be appreicated! PROGRAM PLC_PRG VAR sMessage : MESSAGE := 'The red fox runs across the ice'; abyHashCode : HASH_CODE := [ 16#52, 16#ED, 16#87, 16#9E, 16#70, 16#F7, 16#1D, 16#92, 16#6E, 16#B6, 16#95, 16#70, 16#08, 16#E0, 16#3C, 16#E4, 16#CA, 16#69, 16#45, 16#D3 ]; xMessageOK : BOOL; END_VAR xMessageOK := CheckMessage(sMessage, abyHashCode); FUNCTION CheckMessage : BOOL VAR_INPUT sMessage : REFERENCE TO MESSAGE; abyHashCode : REFERENCE TO HASH_CODE; END_VAR VAR _hHASH : RTS_IEC_HANDLE := CryptoGetAlgorithmById(ui32CryptoID:=RtsCryptoID.HASH_SHA1, pResult:=0); Result : RTS_IEC_RESULT; bsMessage : RtsByteString := (ui32MaxLen:=SIZEOF(sMessage), pByData:=ADR(sMessage), ui32Len:=TO_UDINT(LEN(sMessage))); abyNewHashCode : HASH_CODE; bsNewHashCode : RtsByteString := (ui32MaxLen:=SIZEOF(abyNewHashCode), pByData:=ADR(abyNewHashCode)); diCmpResult : DINT; END_VAR Result := CryptoGenerateHash(hAlgo:=_hHASH, pData:=ADR(bsMessage), pHash:=ADR(bsNewHashCode)); diCmpResult := SysMemCmp(pBuffer1:=ADR(abyHashCode), pBuffer2:=ADR(abyNewHashCode), udiCount:=SIZEOF(HASH_CODE)); CheckMessage := diCmpResult = 0;
Last updated: 2024-09-06
Post by bruceae on Ethernet/IP Scan
CODESYS Forge
talk
(Post)
Hello, I have a robot configured as a Generic Ethernet Module under Ethernet/IP Scanner. I can not see the change of state of the outputs coming from the robot on the codesys side in real-time. (The robot has it's own internal program that would changes the values of remote outputs 0-3 off and on). Also when I send data down to the inputs of the robot it doesn't transfer over as expected. As an example I'll send to the robot's input bit 0 a value of 1. It doesn't see that value change. However, when I write that input bit 0 back to a value of 0, the robot changes state and shows a value of 1. And if I change the state of a different bit, the other bits update properly, except for the bit that I changed. Any advice would be greatly appreciated, and if anything else is needed let me know.
Last updated: 2024-09-10
Post by bjarne-pagaard on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20)
CODESYS Forge
talk
(Post)
Hi, I would like to divide a project into multiple applications - as a minimum: one handling visualization and Alarm Manager, one handling I/O and plant control logic. But how to exchange variables between the applications? What have you done to get such a solution? In versions 3.5.19 and earlier, you can have Child applications, where the children can access a GVL in the Parent application. Children apps is no longer possible in 3.5.20 - but you can have 'sibling' apps - Several apps directly under PLC Logic, that is. But how do they best communicate? The Communication Manager / Data Sources Manager is sort of possible via OPC UA, but it seems like overkill and with some limitations - for example no ARRAY OF STRUCT possible this way. If you have separate devices in your project, you can exchange data via 'CODESYS ApplicationV3', but not other applications in the same device (see attachment Datasources.png). You can do it via 'Select the project type'->'Other Project' and select the same project file, but this leads to crashing the Development system when working with the variables afterwards. It would be great to hear your thoughts / experiences on this topic - Bjarne
Last updated: 2024-09-27
Post by z870623 on About CPU Loading
CODESYS Forge
talk
(Post)
I am running a runtime environment on an ARM A35 dual-core processor (1.5GHz) and have encountered some issues. The CPU load (both CPU0 and CPU1) occasionally spikes above 50% before returning to normal, and this happens around 2-3 times per minute. At the same time, I’ve noticed that the Max Cycle Time in the Codesys monitoring screen shows much worse performance compared to the A53 (1.2GHz), with nearly double the cycle time. The optimizations I have made so far are as follows: Set the CPU to performance mode. Isolated CPUs: CPU0 is dedicated to running Linux services and the runtime itself, while CPU1 runs the EtherCAT task and the MainTask. Despite CPU1 only running these two tasks, the utilization still increases above 50%, which I find unreasonable. Additionally, I performed tests using cyclictest both without and with the runtime running. The performance is shown in the following image: From the results, I believe the CPU performance should be fine, but I am unsure why the monitoring results are not as expected. The testing outcomes should ideally be as close as possible to the cyclictest results. Does anyone have related solutions to this issue?
Last updated: 2024-10-14
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
.