Post by rjonker on codesys mqtt publish serialization
CODESYS Forge
talk
(Post)
pbPayload is a pointer, which it expects to point at a STRING. If you point it at an address holding a different data type, it will just assume those bytes are part of a string and likely trundle along memory until it finds a null byte (0x00) that would normally signify the end of a string PublishMessage := BOOL_TO_STRING(boolVariable);
Last updated: 2024-06-05
Post by mos89p on how to use UseDataExpanding() in datasource
CODESYS Forge
talk
(Post)
Hi I need to update by software some structures in my datasource, i found this example: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_update_data_interface.html it seems that because i use complex variable structure i need to use UseDataExpanding() instead of use data, the question is how to get an instance of IDatasourcesMgr3 i have the global variable g_Datasources is instantiated automatically
Last updated: 2024-06-18
Post by koppit on SysComRead Timeout Parameter
CODESYS Forge
talk
(Post)
Im using SysCom ver. 3.5.17.0 and seem to have the same issue on a Raspberry Pi. It's not waiting for the requested number of bytes, no matter if "ulTimeout := SYS_INFINITE" or any other value. The only solution I have found is to stall the program to allow the serial port to recieve the data.
Last updated: 2024-06-26
Post by tomast on Communication PLC with HMI - how to send DUT via NVL.
CODESYS Forge
talk
(Post)
Hi everyone, I am working with project where i have DUT wihth struct. I would like to fill this data trough a form on HMI. I use NVL to communicate and i would like to know how is it possible to do this? Thanks for all your advice in advance.
Last updated: 2024-08-23
Post by janber on REFERENCE TO in an array
CODESYS Forge
talk
(Post)
Hi all, in the online help it written, that array of reference to data type is not possible. Ok... but if I create array of struct of reference to - everything works fine - please see the screenshots: and it works this way OK. Is it intention or error in compiler 3.5.18.20 and we should avoid it? Thanks a lot, Jan.
Last updated: 2024-10-14
Post by egret on Issue with J1939, PGN 65267 (Vehicle Position)
CODESYS Forge
talk
(Post)
I have a J1939 network (ISOBUS) connected to my PLC. I can receive various PGNs such as 65256 (Vehicle Direction/Speed) and 65254 (Time/Date). However, I cannot receive 65267 (Vehicle Position). PGN 65267 (VP) contains SPN 584 (Latitude) and SPN 585 (Longitude). On the network both SPNs return a value of -210 (meaning the CAN message payload is zero in both cases). The conversion settings are the default values and appear to be correct (see attached screenshot). Using a CAN analyser I can see that PGN 65267 (Vehicle Position) is being transmitted over the network with valid (non-zero) data that matches the latitude and longitude coordinates I would expect. I've created a program to read the raw J1939 data and this also returns valid data. It seems that the Codesys J1939 database has a problem with reading PGN 65267 messages. Can anybody else confirm this? I'm using Codesys Version 3.5 SP16 Patch 5.
Last updated: 2023-09-13
Post by andrej on Write to File on soft PLC winV3x64
CODESYS Forge
talk
(Post)
Hello all, I would like to store some data in text file. I use the soft PLC Win V3x64, on Windows 10. I use the SysFile Library 3.5.17.0. If I store the file directly in the in the directory of the PLC i.e. in '/CODESYSControlWinV3x64/E1FA7ABE/PlcLogic/LogAU.txt' the file is correctly filled with the data. However, If I use an absolute path to a different directory no data is stored in the respective file. Despite the fact that the respective file exists and the Filehandler is correctly opened (see in picture _fdSysFHandle <> -1). // sFileName : STRING := 'LogAU.txt'; // STORES FILE IN ../CODESYSControlWinV3x64/../PlcLogic/LogAU.txt' sFileName : STRING := 'C/Temp/LogAU.txt'// DOES NOT WORK --------------------- // FILE DESCRIPTOR _fdSysFHandle := SysFile.SysFileOpen( szFile:= sFileName,am:= SysFile.AM_APPEND,pResult := ADR(_Result)); Does some have an idea where the problem is, resp. how I can get store a file in an arbitrary directory. Thanks a lot and kind regards Andreas
Last updated: 2023-10-24
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 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 giackanto on Eoe issues with Windows and Linux
CODESYS Forge
talk
(Post)
Hello, I've been trying to use EoE for communication between a Windows PC and an M753 drive from Control Technique. Despite following some online guides (https://content.helpme-codesys.com/en/libs/EtherCATStack/4.3.0.0/Ethernet_over_EtherCAT/fld-Ethernet_over_EtherCAT.html) I haven’t had any success. Both are connected to a Debian device where RTE is running: The PC is connected via the Ethernet port. The drive is connected via the EtherCAT port. I'm unable to ping the drive from my Windows PC. Here is my configuration: On Debian: (See attachments 1, 2, 3) enp1s0 = Ethernet port enp2s0 = EtherCAT port tap2 = TAP device IP forwarding and routes are both configured. On Windows: (See attachments 4, 5) On Codesys: (See attachments 6, 7) Version: Windows 11 Debian GNU/Linux 11 Codesys 3.5.17 Control for Linux SL 4.7.0 EtherCAT 4.4.0 With this configuration, I can ping the TAP device, but not the drive (See attachment 8). Could someone explain how to properly configure all these settings? Thank you, GA
Last updated: 2023-12-19
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Problem mit control runtime V3 und profinet
CODESYS Forge
talk
(Post)
Ich habe einen brandneuen Beckhoff-Panel-PC mit einer Codesys Control Runtime V3 eingerichtet. Ich habe es zusammen mit 2 Profinet-Feldgeräten konfiguriert: einem 16in/16out IO-Modul von Turck und einem MTS-Linearencoder. Die Maschine funktioniert einwandfrei, bis plötzlich die Kommunikation abbricht und die Profinet-Teilnehmer nicht mehr erreichbar sind. Zu diesem Zeitpunkt kann ich das Gerät noch anpingen, aber der Profinet-Master findet sie nicht mehr: Wenn ich einen Scan durchführe, werden sie nicht gefunden. Wenn ich einen Kaltstart durchführe, wird der Profinet-Master wieder aktiv und die Geräte werden wieder gefunden. Im Protokoll erhalte ich den Ethercat-Paketempfangsfehler: sysethernet. Ich bin etwas verwirrt, es gibt kein Ethercat-Gerät im Gerätebaum. Ich habe den Sendetakt und das Untersetzungsverhältnis bereits auf höhere Werte eingestellt, jedoch ohne Ergebnis. Kann Codesys so konfiguriert werden, dass die Kommunikation ohne Kalt-Reset wiederhergestellt wird? Das ist sehr ärgerlich und verursacht viele Produktionsausfälle. Grüße Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Problem mit control runtime V3 und profinet
CODESYS Forge
talk
(Post)
Hallo Edwin, meinst du das der control-win nicht wie SPS verwendet werden kann? Das program ist klein, und realtime brauch ich gar nicht, Es gibt im bus einem Turck inselstation mit 16 ein und ausgange, und ein MTS linearencoder, womit wir teile messen und abschneiden. Die cycluszeit reist auch nicht aus. Processorleisung bleibt unter 20%. Es geht mir darum das der profinet master in fehler geht, und nicht mehr seine telnehmer erkannen kann. Es kan passieren nach 10 minuten, aber auch nach 5 tage. Nur ein kaltstart bringt die bus wieder am laufen. (kein reconnect mochlich, auch die bus scannen functioniert nicht mehr) Wann ich aber ein ipscan durchfure mit Angryip auf der rechner sind alle telnehmer da. Ich habe noch eine andere application mit die gleiche anwendung, aber wo ein raspberry pi die SPS rolle spielt, und das functioniert einwandfrei. Soll ich fielleicht das OS von Rechenr nach linux umrusten? Der operator ist im moment sehr unzufrieden mit die "upgrade" von maschine... :-( lg Tim
Last updated: 2024-04-11
Post by tim-roelant on Problem mit control runtime V3 und profinet
CODESYS Forge
talk
(Post)
Hallo Edwin, meinst du das der control-win nicht wie SPS verwendet werden kann? Das program ist klein, und realtime brauch ich gar nicht, Es gibt im bus einem Turck inselstation mit 16 ein und ausgange, und ein MTS linearencoder, womit wir teile messen und abschneiden. Die cycluszeit reist auch nicht aus. Processorleisung bleibt unter 20%. Es geht mir darum das der profinet master in fehler geht, und nicht mehr seine telnehmer erkannen kann. Es kan passieren nach 10 minuten, aber auch nach 5 tage. Nur ein kaltstart bringt die bus wieder am laufen. (kein reconnect mochlich, auch die bus scannen functioniert nicht mehr) Wann ich aber ein ipscan durchfure mit Angryip auf der rechner sind alle telnehmer da. Ich habe noch eine andere application mit die gleiche anwendung, aber wo ein raspberry pi die SPS rolle spielt, und das functioniert einwandfrei. Soll ich fielleicht das OS von Rechenr nach linux umrusten? Der operator ist im moment sehr unzufrieden mit die "upgrade" von maschine... :-( lg Tim
Last updated: 2024-04-11
Post by rabaggett on Reading Named Pipes in Linux Is there a better way?
CODESYS Forge
talk
(Post)
I have a Python program that will handle things in my application such as VISA over IP and Telnet control of instruments. I want the main control and HMI in Codesys. My problem is communication between the two. I have looked at several ways to accomplish this, and settled on having the Python program create two named pipes, one to send information to Codesys, and one for Codesys to send information to Python. The information would be packetized with \n for end of packet.. Seems simple. I think the named pipes method should work, but file reading in Codesys using the CAA file library starts to get difficult when the file is never ending, as in this case. Before I spend too much time making something that may be fundamentally flawed I want to ask. Is there a better way? Is there a way to read the file 'one line at a time' which might solve my never ending file problem? Thanks!
Last updated: 2024-05-09
Post by fizzy-bubblech on 3.5 P20 hangs - no response
CODESYS Forge
talk
(Post)
Colleagues, i have the same problems. At the current time, I have to use the new version of the Codesys (3.5.20.10) + Control for Linux SL 4.11.0.0, but it works unstable : theree are a lot of freezes and not-respondings. I tested this on different projects: those that were created in the current version of the project, and those that were migrated from other versions of the development environment. Compiling a project without connecting to a controller is fast enough. The first downloading of the code into the controller, too. But as soon as you need to make edits and download a new code problems begin. Codesys "freezes" at the "Generation code" stage for 15-20 minutes. And only after that time loads the code into the controller. Previously, we used version 3.5.17.60 + Control for Linux SL 4.7.0.0. The process took 1-2 minutes. Do you have any ideas how can i fix it? I will be grateful for your answers.
Last updated: 2024-06-27
Post by psychoengineer on Cannot Save CSV File on Windows Computer Using CODESYS and Control Win
CODESYS Forge
talk
(Post)
I am currently working on a project using CODESYS and Control Win on a Windows computer. I've encountered an issue where I am unable to save a CSV file. I have followed the standard procedures and used the appropriate file handling functions, but the file is not being created or saved as expected. IF xStartTest THEN sFileName := '\logs.txt'; sFileName := CONCAT(gvl.g_sMainDirectory, sFileName); sFileNameCopy := '\CAAFileCopy.txt'; sFileNameCopy := CONCAT(gvl.g_sMainDirectory, sFileNameCopy); //eWriteState := FILE_OPEN_TRIGGER; xTestDone := FALSE; xError := FALSE; xStartTest := FALSE; END_IF VAR_GLOBAL g_sMainDirectory : STRING := 'C:\LogFiles'; // file path for CSV file END_VAR Despite this, the file does not appear in the specified directory, and no error messages are being generated. I've checked the directory permissions and ensured that the path is correct. Has anyone else experienced a similar issue or have any suggestions on how to resolve this? Any help would be greatly appreciated. Thank you!
Last updated: 2024-07-04
Post by ihatemaryfisher on Sorting array of any-sized structure
CODESYS Forge
talk
(Post)
With that I could make an array of varying size, but would still have to define the array type in the function's declaration VAR_IN_OUT stArray: array [*..*] of <pre-defined data type> END_VAR I wanted a function that could take an array of any type (e.g., a structured VAR) as an input. That way I could call it in multiple POUs to handle different arrays structures.
Last updated: 2023-08-18
Post by docker on Canopen connection. Unknown node id.
CODESYS Forge
talk
(Post)
hi, i am currently trying to adapt an i/o device for a project. the node id is unknown and there is no eds file available. no data is being emitted from the device as a giveaway, the baudrate is known but useless without the node id. is there an sdo request available to determine the id? i cannot get the device to leave pre op status even with a global nmt request. please help. no hair left.
Last updated: 2023-09-25
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 voffi on Converting UINT into bytes and converting 2Bytes into UINT
CODESYS Forge
talk
(Post)
There are some ways. One is to use SHR and SHL and it depends on your byte order in the data array. For Motorola byte order: PROGRAM PLC_PRG VAR u : UINT; byte_array_in : ARRAY [1..8] OF BYTE := [16#11, 16#12, 16#13, 16#14, 16#15, 16#16, 16#17]; byte_array_out : ARRAY [1..8] OF BYTE; END_VAR u := SHL(TO_UINT(byte_array_in[2]), 8) + TO_UINT(byte_array_in[1]); byte_array_out[1] := TO_BYTE(u); byte_array_out[2] := TO_BYTE(SHR(u, 8)); If it's Intel byte order just change 1 and 2 in the array indexes.
Last updated: 2023-12-07
Post by tvm on VisuFbFrameBase.SetInputPositionData: The element id for the input position cannot be determined
CODESYS Forge
talk
(Post)
I'm getting this error on one of my projects. Searching for it I came across this https://www.codesys.com/fileadmin/data/Images/System/Releaseinformation/Patch-Note-CODESYS-Visualization-4300.html which says it was a bug VIS-1394, fixed in Visualization 4.3.0.0. I'm using a previous visu version, what is the cause of this error, and what can be done to work around it?
Last updated: 2024-02-08
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
.