Search talk: Communication task

 
<< < 1 .. 21 22 23 24 > >> (Page 23 of 24)

Post by timvh on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20) CODESYS Forge talk (Post)
If you have a Windows system (RTE), then why not run the CODESYS HMI as separate controller. This could easily be moved to another PC if required. In the HMI you could also still use the Symbolic Var access as part of the Data Source Manager, although maybe OPC is the preferred way to make it more future proof. Or what about the Remote Target Visu. Then you can reduce the load of the main controller, while still only having to create one application including Visualization. This is now also supported for Linux systems. See: https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_target_visu_for_linux.html https://content.helpme-codesys.com/en/CODESYS%20Visualization/_visu_execute_remote_target_visu.html
Last updated: 2024-09-28

Post by smeitink on Timeout Error in Modbus Communication with WAGO PFC200 and iEM2050 Meter using 750-652 Module CODESYS Forge talk (Post)
Hi all, I'm looking for help with an issue I've come across while trying to facilitate Modbus communication between a WAGO PFC200 PLC using a 750-652 communication module and an iEM2050 Series Single Phase Energy Meter. I believe to have everything wired and setup correcty, but I keep running into a "Error time out" message, and by now I don't really know what else to try. My setup is as follows: A PFC200 Wago PLC, which has 2 750-652 Serial Interfaces extension modules connected to its field bus. I'm using one of these to talk to a Schneider iEM2050 - kWh-meter over modbus. I have connected terminal 23 (A) of the iEM2050 to connector 6 (A) on the 750-652. I have connected terminal 24 (B) of the iEM2050 to connector 2 (B) of the 750-652. I'm using 200mm of twisted together wires to connected them both, and I have placed a 120 ohm resistor between A and B at both ends. I've attached relevant pinout images to this post. I then wrote a simple program that configures the Mobus port, as per the datasheet of the iEM2050. You can find an image of the relavent page attached to this post too. This is my program: PROGRAM PLC_PRG VAR Master: FbMbMasterSerial; xIsConnected: BOOL; xError: BOOL; iIndex: INT := 1; xTrigger: BOOL; utQuery : typMbQuery := ( bUnitId := 1, // The Modbus unit or slave address bFunctionCode := 4, // Function code for reading input registers uiReadAddress := 1829, // adress for the Power on off counter uiReadQuantity := 1 // Quantity of registers to read ); iStep: INT; oStatusModbus: WagoSysErrorBase.FbResult; utResponseModbus: typMbResponse; xConnect: BOOL := FALSE; delayTimer: TON; END_VAR Master( xConnect:= xConnect, I_Port:= _750_652_24_1, udiBaudrate:= 9600, usiDataBits:= 8, eParity:= WagoTypesCom.eTTYParity.Even, eStopBits:= WagoTypesCom.eTTYStopBits.One, eHandshake:= WagoTypesCom.eTTYHandshake.None, ePhysical:= WagoTypesCom.eTTYPhysicalLayer.RS485_HalfDuplex, xIsConnected=> xIsConnected, xError=> xError, oStatus=> oStatusModbus, eFrameType:= WagoAppPlcModbus.eMbFrameType.RTU, tTimeOut:= T#5S, utQuery:= utQuery, xTrigger:= xTrigger, utResponse:= utResponseModbus); delayTimer(IN := TRUE, PT := T#3S); // Use the Q output of the timer to set xConnect after the delay IF delayTimer.Q THEN xConnect := TRUE; END_IF CASE iStep OF 0: //Wacht totdat de master de poort geopend heeft IF xIsConnected THEN iStep := 1; END_IF 1: //Stuur request naar de slave xTrigger := TRUE; iStep := 2; 2: //Wacht totdat de master klaar is met het afhandelen van de request IF NOT xTrigger THEN iStep := 3; END_IF END_CASE The TON delay before opening the port is due to a an error I encountered when opening it straight away. This seems to be a bug, as described here. However, the TON solved that particular issue. I tried reading multiple registers, but like I said, I still always end up with the "Error time out". What else can I test or try at this point?
Last updated: 2024-02-24

Post by r-niedermayer on OPC UA subscriber not operational CODESYS Forge talk (Post)
Hi. As far as projects in "old version"s are concerned, these can be upgraded to newer versions at any time. To do this, the device must be updated accordingly and the copilers and library versions must be adapted. You can find instructions on how to proceed in the online help/FAQ: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_changing_compiler_version.html https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_cmd_update_device.html See also 4.3.22.4 "How to open an Example Project" within the following pdf for more details on the single steps: https://forge.codesys.com/lib/counit/tickets/_discuss/thread/3e991befbc/ca97/attachment/Public%20FAQ-v13-20240610_075228.pdf Regaring your OPCUA connection state always showing just "DISABLED", without knowing both sides of the assembly in detail, one can only approach the problem theoretically. We can give a chekclist on how to proceed: Fist, please recheck the communication settings in the OPC UA connection function block to ensure that the server URL, endpoint URL, and other settings are correct and match the configuration of the OPC UA server. Verify that the OPC UA server is running and accessible. -You can try to connect to the OPC UA server using a separate client, such as UAExpert, to ensure that the issue is not related to the OPC UA server itself. Test the security settings in the OPC UA connection function block to ensure that the correct security policy and certificate are selected. If you are using a dynamic connection to the OPC UA server, probe that the connection settings are correctly configured and that the OPC UA client is able to establish a connection to the OPC UA server. Also, please loock into the log files for any errors related to the OPC UA connection function block, these should be listet there. The log files may also provide additional information about the issue and help you to further troubleshoot the problem. FYI - Please see https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_opc_ua_server.html: Her you can finde the Communication settings via OPC UA Server -> layout Browse Live Server: The client connects to the server and detects the existing variables and types. From Information Model The client reads the data structure (layout) of the OPC UA Server from the information model set here and as a result receives the information about available variables and types. A connection to the server is not required. The list contains the information models installed in the OPC UA Information Model Repository. "Read Connection" Settings from IEC Variable (option set): - The connection settings used by the device are not read here from the dialog, but at runtime from the IEC variable specified here. - For this possibility, please see the Using a Dynamic Connection to an OPC UA Server (https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_use_dynamic_opc_ua_server_comm_settings.html) The settings for the communication of a Client-data source to an OPC UA Server can also be dynamically configured from the IEC code and can also be changed at runtime. For such a purpose, a structure is available in the DatasourceOpcUAServer library (For a description of the OPC UA Server, there is one included in the standard installation of CODESYS, https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_encrypt_communication_data_sources_opc_ua_client.html)
Last updated: 2024-11-04

Post by sturmghost on Initialization of visualization variables and cyclic code execution CODESYS Forge talk (Post)
I'm looking for a smart and short way to implement initialization of visualization variables depending on the visualization input. For an easy example consider a rectangle which rests at XPos := 0 when the input state is false and at XPos := 50 when the input state is true. My visualization variables look like this: VAR_IN_OUT State : BOOL; END_VAR VAR XPos : INT; END_VAR I put this rectangle via a visualization frame element into another visualization and link a frame reference variable with the state to it. If the variable is true, the rectangle should rest at XPos := 50 and false at XPos := 0 at visualization init but how should I assign the 50 or 0 to the internal visualization variable XPos? I would need some init-methode for the visualization but I dont want a global init-method for such tasks. I want to do it inside of the visualization element but I can't see any solution for this? It would be good to be able to define ST-code within the visualization element which runs cyclic at each VISU_TASK task-cycle then I could just check the input state and change the XPos accordingly. Does someone have a solution?
Last updated: 2023-10-01

Post by martinlithlith on Mux I2C CODESYS Forge talk (Post)
Hi! I´ll try to get this thread going again as i´m having simliar problems. Right now i get a red triangle on my connected devices (i´m testing with a BME280 sensor and a PCA9685 resvo driver). The TCA9548 have the green symbol beside it. On the "red" devices i get that the bus is not running. I have tried to either run it using the parent bus cycle setting or creating a new freewheeling task prio 1 but nothing helps. I have compared my settings to the settings from the example from the MUX package and i have read (i think) every thread in forge that could be of interest. EDIT: The ic2detect only shows the mux (70-70) and the servo drive (70-76) so i´ll look in to if i managed to burn the 280-sensor while soldering). Another question regarding the 280 sensor. I have a sensor GY-BM E/P 280 that should record humidity and temperatur. Could this be a problem with the library? Does anyone have an idea of what i might be doing wrong? I have some experience from Codesys but not much so this could be an easy one. All suggestions are welcome. I tried to upload the project archive but it did not work. Should i upload the export or how could i show you my horrible project? Best, Martin
Last updated: 2023-10-22

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 mondinmr on Direct Pointers in IOMapping for EtherCAT with IoDrvEthercatLib.ETCSlave_Dia CODESYS Forge talk (Post)
Using SDO, I can read the EtherCAT mappings and offsets from various registers like 0x1c12, 0x1c13, etc. When I obtain registers mapped in the PDOs and various offsets, I could technically access directly to the statusword, controlword, etc., if they are mapped. I have noticed that on IoDrvEthercatLib.ETCSlave_Diag I can find pointers to the input and output buffers. However, although the input buffer can be easily read by referring to what has been obtained from the SDOs, it is not possible to write to the output buffer, as it is overwritten in each cycle by the data from the IOMapping task. Is there a way, knowing an instance of IoDrvEthercatLib.ETCSlave_Diag, to obtain the pointer to the first data in the IOMapping? The offsets are identical to those of the PDOs, but obviously the data is a copy. For me, the cleanest thing would be to access the pointers on IOMapping, for DS402a devices to retrieve the key data and point them to internal references. I need to know this as, having developed our own motion library, I would like to simplify the initial setup by eliminating unnecessary and nonsensical mappings that can lead users to unnecessary errors. In the current version that we have been using for years, we have to map everything manually. I would like to pass only the slave reference to the FB_init constructors and eliminate the mapping.
Last updated: 2024-02-12

Post by manuknecht on High Cycle Times for SoftMotion_PlanningTask when using AxisGroup CODESYS Forge talk (Post)
Hello all I am using an AxisGroup with the Gantry2 Kinematics to move a 2D-Gantry system. When creating the AxisGroup, the SoftMotion_PlanningTask is created automatically with a cycle time of 2 ms in my case. I realized that the maximum cycle time of this task can spike to very high values (up to 60 ms) at lower speeds of the motion, leading to synchronization issues and errors on the axes. The same behaviour - though not as drastic - can be observed with virtual axes too. Is this behaviour intended or to be expected? Can the cycle time or type of the SoftMotion_PlanningTask be changed to prevent these errors? Or is there another fix for this issue? I tried changing the cycle type to Freewheeling, which solved the synchronization issues, but caused an error on the AxisGroup after a while, reading SMC_CP_QUEUE_UNDERRUN. Thanks in advance and best regards Manuel
Last updated: 2024-03-07

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 trusty-squire on CNC - How to manipulate SMC_GeoInfo objects CODESYS Forge talk (Post)
I have an application using CNC GCode interpolation, but I need to modify the GCode provided to the PLC based on certain parameters. I am currently attempting to modify the SMC_GeoInfo objects in the SMC_OutQueue using the code below. Note that all the other code is pretty standard and works fine, but when I add the below it errors. PROGRAM TEST VAR fbReadCncFile : SMC_ReadNCFile2; fbCncInterpreter : SMC_NCInterpreter; arrCncInterpreter : ARRAY[1..99] OF SMC_GeoInfo; pGeoInfo: POINTER TO SMC_GeoInfo; giGeoInfo: SMC_GeoInfo; // ... END_VAR // ... Some code here in order to read CNC file using SMC_ReadNCFile2 and provide to SMC_NCInterpreter pGeoInfo := SMC_GetObj(poq:=ADR(fbCncInterpreter.poqDataOut), n:=1); IF pGeoInfo <> 0 THEN giGeoInfo := pGeoInfo^; // Do some manipulation here, then update the queue at the same position MC_SetObj(poq:=ADR(fbCncInterpreter.poqDataOut) , n:=0 , pgi:=ADR(giGeoInfo) ); END_IF It throws an error when I get to the line giGeoInfo := pGeoInfo^; Error: EXCEPTION [AccessViolation] occured: App=[Sim.Device.Application], Task=[PathTask] How do I use SMC_GetObj and access the data? It creates a pointer with the value as shown in the photo, but all the dereferenced values say dereference of invalid pointer.
Last updated: 2024-07-26

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

Post by breiter on Frustration-Fueled Feedback on Project File Management and Git Integration CODESYS Forge talk (Post)
Hi, supporting a text based storage format is on our roadmap, see https://www.codesys.com/the-system/releases-updates-lifecycle/release-plan-roadmap.html It will be an Add-On feature called "File Based Storage" for the professional developer edition. Structured text POUs will be stored as plain text. Other graphical languages will remain in an xml format. You will be able to switch the storage type for projects. Certain workflows will become easier this way. Nevertheless restrictions will remain because of CODESYS specific storage logic (for example how methods below function blocks are stored as file). So merging using our Git Integration Add-On remains the recommended workflow. A workflow involving Visual Studio Code as the main IDE is not supported. Simply because many topics like library management, task configuration or fieldbus configurators are not available for VS Code. A PLC project is a lot more than just some ST POUs. Best Regards
Last updated: 2024-10-16

Post by ellocco on XOR with four Inputs with OR-, NON- and AND-Operators CODESYS Forge talk (Post)
My topic is more of academic nature, I would like to implement an XOR-operation with four inputs on my own (without the predefined XOR-operator) in a function block diagram (FBD). I have two proposals. One works fine and the other one is just an idea, but I do not know, if it is possible to code it in CODESYS V3.5 SP18 in form of a FBD. Here the one that works: And here an idea, which I have not managed to code it as an FBD: Any ideas? Is the 2nd diagram a correct interpretation of the coding task? And is there a way to implement it in form of an FBD in CODESYS V3.5 SP18? Followup (08-Nov-2024): Also in the current version of CODESYS (V3.5SP20Patch3) I have not managed to connect the existing blocks. In the alternative SPS-IDE PLCnext Engineer it is possible.
Last updated: 7 days ago

Post by ofey on Codesys Soft PLC OPC UA server CODESYS Forge talk (Post)
Hi! I'm sorry if this has been asked before. I have tried looking up previous topics regaring this, but even though I'm following tutorials and other posts I cant seem to get this to work consistently. I actually got the connection established on a test project after some trial and error. I only got it to work with the "Anonymous login". But after i deleted the test project and tried to get the same thing to work on another project I cant get it to work anymore. What I'm trying to do: Set up and OPC UA Server using CODESYS with the free soft PLC. I then try to connect to the OPC UA Server with the program "UaExpert". What happens: I get the error Error "'BadUserAccessDenied' was returned during ActivateSession". What I have done in CODESYS: - Added the object "Symbol configuration" and checked some test variables - Checked "Support OPC UA features - In "Communication settings -> device -> Change runtime security policy" I have checked "Allow anonymous login" What I have done in UAExpert: - Found the OPC UA server under "local". (It is showing two servers though, I do not know why. It showed the same when it worked yesterday). Se attachment - Checked "Anonymous" under "Authentication settings in the OPC UA server. I'm new to CODESYS, so it could be something elementary wrong in my settings. Maybe something in the user settings in CODESYS regarding user rights or something?
Last updated: 2023-09-14

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 forest on SM Drive license error CODESYS Forge talk (Post)
Hi, when it comes about license, I used INVTmatic Studio, which uses Codesys, for programming INVT plc. I bought Codesys Modbus license, it was not expensive, and then realised that INVT didn't have License Manager option (greyed out in program) which is needed for using of Codesys License. I contacted support from INVT, but developers told me that option is still not available. So depending on environment for programming Codesys, you can or not use Modbus license. Good thing about this version of Modbus TCP it works both direction. I could send commands and receive feedbacks from drive. But communication stops after 30 mins. So I used simple version of ethernet modbus which is somewhere in INVT or Condesys library (I can check tomorrow) which works only one way. I could send cmd to drive, and control it, but didn't have any feedback, like some readings back in PLC. which is bad, but at least I could start it and it didn't fail after 30 mins.
Last updated: 2024-01-10

Post by toby on Ethernet/IP communication with Omron NX1P2 CODESYS Forge talk (Post)
Hey guys, I'm very much a noob with networking, it's my achillies heel, and this is my first networking project using Ethernet/IP. Any help offered is GREATLY appreciated. I'm trying to network a Codesys Project with an Omron NX1P2 PLC. I'm using EIP due to hardware restrains. I've added the fieldbus, EIP scanner (as the master), and made a Network Variable List. On the Sysmac Studio end, I've made the variables and set them to network inputs/outputs, registered them in EIP settings, but when I try to set the target device (the Codesys project), I suspect I need to import an EDS file for the EIP mapping. Back in the Codesys project, I'm not sure how to: - Make an EDS file to share with Sysmac Studio - How to link the target device (Omron PLC) to the EIP fieldbus - How to map the inputs from the Omron PLC. Im sorry for my very open request for help, i'm kind of lost looking through the various forums/video/tutorials as many of them dont match what im trying to do. Any help, or sample programs would be so so greatly appreciated. If you need any further clarifications, please feel free to ask. Thanks in advance, Toby
Last updated: 2024-01-24

Post by yannickasselin on Connect to remote PLC via local pc and teamviewer CODESYS Forge talk (Post)
Yes it is possible. I did it a lot of times using TeamViewer VPN. Unfortunately, TeamViewer VPN only works on Windows. If the remote PLC is a Codesys runtime running on Windows, you should be able to login directly using TeamViewer VPN if it is installed on the PC/PLC. If it is not Windows based, you can still do it but you need to have a Windows based PC acting as a gateway in the middle. In this case you need to enable IP Forwarding on the Windows remote PC (the gateway) and you need to setup the gateway IP address on the PLC to be the address of the Windows PC. Then you need to add a route on your local PC to point to the gateway PC for Codesys communication. I know it may not be detailed enough but I did not want to make a whole tutorial on how to do it. Bottom line, it is possible. I do it all the time.
Last updated: 2024-02-02

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 bjarne-pagaard on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20) CODESYS Forge talk (Post)
Thanks for this - I have now been looking in to just having an extra (non-RTE) runtime on the same machine, as you suggest. I will probably proceed this way. Even though it still seems very odd to me, that variable exchange to a different runtime is easier than between applications on the same controller. There will be some fun with the licensing, it seems. Does anyone know if it is possible to specify which license container/specific license the runtime is going to use at runtime. Let's say I have two available licenses with different resources available, for example one license allows multicore and multiple EtherCAT channels, but not many visu tags (for the RTE). Another with less resources but a lot of visu tags (for the Visu controller). Let's say the program in one of the controllers could be fully licensed by either of the two available licenses, but picks the 'largest' first. A bit later, the larger application starts, but is left with the smaller license.. How can I make sure that the 2 runtimes select the right license at startup?
Last updated: 2024-10-01

Post by mubeta on Some 'pathetic' errors in SoftMotion program CODESYS Forge talk (Post)
Hello everyone, I have a very simple program for the process, but it's driving me crazy and I can't see the problems I'm left with: Short topological description: Dual Core Berghof controller with softmotion runtime version 3.5.19.30; Two axes with servodrive on canopen bus, clocked distributed from master; Ethercat I/O node; 2 ms ethercat task, 2 ms canopen bus cycle time; I/O objects of the canopen master and canopen drives connected to the ethercat task cycle; Problem 1: Two separate programs each manage their own axis and drive, with separate state machines. A first axis moves primarily in velocity, except having to position itself absolutely at a predetermined point at the end of the job; the second axis, on the other hand, is a paper unwinder that changes, for each job cycle, from actions in absolute, relative, and cam displacement with the master axis. Well, the state machine of both axes was written in such a way as to call running the useful FB and change it on state change in this way: CASE i_stateMachine OF 0: o_Power(Enable := TRUE, bRegulatorOn := FALSE, bDriveStart := FALSE, Axis := o_PaperUnwinderAxis); o_MoveAbs(Execute := FALSE, Axis := o_PaperUnwinderAxis); o_MoveRel(Execute := FALSE, Axis := o_PaperUnwinderAxis); o_CamSelect(Execute := FALSE, Master := o_MachineAxis, Slave := o_PaperUnwinderAxis, CamTable := cam_PaperUnwinder); o_CamIn(Execute := FALSE, Master := MachineEncoder, Slave := o_PaperUnwinderAxis); o_CamOut(Execute := FALSE, Slave := o_PaperUnwinderAxis); o_SetPosition(Execute := FALSE, Axis := o_PaperUnwinderAxis); IF ... THEN i_StateMachine := 10; END_IF; 10: o_Power( Enable := TRUE, bRegulatorOn := TRUE, bDriveStart := TRUE, Axis := o_PaperUnwinderAxis ); IF o_Power.Status THEN i_StateMachine := 20; END_IF; 20: (* Avanzamento carta *) o_MoveAbs( Execute := TRUE, Position := o_Somewhere, Velocity := 25.0, Acceleration := 3666.7, Deceleration := 3666.7, Jerk := 48000.0, Direction := MC_DIRECTION.positive, Axis := o_PaperUnwinderAxis ); IF o_MoveAbs.Done THEN o_MoveAbs(Execute := FALSE, Axis := o_PaperUnwinderAxis); i_StateMachine := 30; END_IF 30: d_HomingPosition := ...; o_SetPosition( Execute := TRUE, Position := d_HomingPosition, Mode := FALSE, Axis := o_PaperUnwinderAxis ); (* ... *) IF o_SetPosition.Done = TRUE THEN o_SetPosition(Execute := FALSE, Axis := o_PaperUnwinderAxis ); o_LogServer.Append(sMessage := '...', lscClass := LOGSERVER_CLASS.ALWAYS, sdt := o_CommonsMgrData.systime.sdtLocal); i_StateMachine := 40; END_IF; 50: ... The code above is a sketchy example of what I wanted to write. But it gives me a spot problem: in some, the state change results in a drive error, which is unrecoverable except with a reinitialization via SM3_ReinitDrive(). Things are improved a little if in the program I always run the call of all softmotion blocks in this way: o_Power(Axis := o_PaperUnwinderAxis); o_Jog(Axis := o_PaperUnwinderAxis); o_Halt(Axis := o_PaperUnwinderAxis); o_MoveAbs(Axis := o_PaperUnwinderAxis); o_MoveRel(Axis := o_PaperUnwinderAxis); o_CamIn(Master := MachineEncoder, Slave := o_PaperUnwinderAxis); o_CamOut(Slave := o_PaperUnwinderAxis); If I don't execute all the calls of all the motion FBs used, when exchanging machine state often (but not always), the axis goes into error with event id THE_FB_WASNT_CALL... Done a little diagnostics it seems that the FBs return the bDone, before they are completely terminated. I tried doing the machine state exchange not with the bDone bit of the FBs, but with the 'standstill' state of the axis. It didn't seem to change anything. Problem 2: During the use SM3_ReinitDrive() I get the erro in the log: "NetID 0: SDO read error for object 16#607C..." Assuming that the device involved it's one of the two servodrive, (no others device are present in the network), I don't found any object 0x607C in the 'possible object list in/out' of the two drive, and I don't understand where this object can be listed. So any ideas and suggestions regarding these two issues will be very, very welcome. If you need the source project, I am willing to send it.
Last updated: 2024-07-17

Post by maldus512 on How to adapt Codesys Control SL to custom board CODESYS Forge talk (Post)
Hello everyone, I have been given the task to develop I/O drivers for a custom made, Linux based board to allow for Codesys applications to run and control the hardware. I have successfully installed Codesys Control SL for ARM/Linux and tested it with a simple demo application. Now I should start interfacing the runtime to the actual hardware; I should be able to interact with 2 RS485 serial ports, a few GPIOs and an I2C port, all of which already have the corresponding /dev/ interface in the Linux system. I am having trouble understanding how it should be approached. I have found sporadic references that fail to lead to a really comprehensive documentation. For example: The store page (https://store.codesys.com/en/codesys-control-for-linux-arm-sl-1.html#options) mentions a "runtime package" that should allow "Integration of existing C code" and "Usage of local I/Os", which seems exactly what I need to interact with custom peripherals. I have found no further reference to Codesys-C interpop. The Codesys Help page for the runtime package has a page on the "Development of Drivers" (https://content.helpme-codesys.com/en/CODESYS%20Control/rtsllinuxrbpdriverdevelopment.html) that suggests to either "Implement a function block" or "Implement I/O drivers". Those in turn lead to this page (https://forge.codesys.com/drv/io-drivers/doc/Generic/) which describes briefly an XML schema to describe new devices; unfortunately, it doesn't mention what to do with such a description (i.e. how does the runtime know about it) or how it is in any way connected to the actual hardware. Could anyone give me some pointers? I should also mention I have no prior experience with Codesys, so maybe I'm missing an obvious answer.
Last updated: 2024-08-09

Post by imdatatas on MC_CamIn did not work properly with SMC_FreeEncoder on SoftMotion 4.17.0.0 CODESYS Forge talk (Post)
Hello, I am facing a problem with the new Softmotion 4.17.0.0 version. Has anyone encountered a similar problem, what is the solution? I would be happy if you could share it. Problem description: -- "SMC_FreeEncoder" encoder axis is the master, -- The motor of the servo driver on the EtherCAT bus is the slave axis. -- When the MC_CamIn block executed, the InSync output is activated. However, although the master encoder axis position value changes, there is no movement in the slave servo axis! Test steps: 1-) EtherCAT servo axis installed, configured and motion test was performed with MC_Jog. No problem. 2-) Softmotion general axis pool > SMC_FreeEncoder was added and pulse amount configuration was performed. No problem. 3-) Incremental encoder actual count value was transferred to the "SMC_FreeEncoder.diEncoderPosition" variable as DINT under the ethercat task in every cycle and the encoder axis position value was observed. No problem. 4-) A simple CAM table with a 1:1 ratio was created under the project tree. (For example: Simply, when the encoder rotates 1 turn, the motor will rotate 1 turn.) 5-) The SMC_FreeEncoder axis enabled with MC_Power and brought to the StandStill state. 6-) The MC_CamTableSelect block was run with default input values ​​(all absolute) and only the Cam table name was specified. The Done output was seen successfully. No problem. 7-) The MC_CamIn block was activated with default input values ​​(absolute) and only the master encoder axis name, slave servo axis name, CamTableID input pins was specified and then "Execute" input set to TRUE. 8-) The InSync output information of the MC_CamIn block observed as TRUE. However, although the encoder axis value changed, the position value of the slave axis did not change at all, it did not move. It always remained at 0.0mm. 9-) When I repeated the same steps above, only changing the master axis to SM_Drive_Virtual instead of FreeEncoder and gave movement to the virtual axis, this time the slave axis moved successfully. However, when the same steps and operations are performed with the same IDE just downgrade SoftMotion version from 4.17.0.0 to 4.10.0.0, everything works normally and without problems as expected in MC_CamIn block with FreeEncoder master. (By the way, The used IDE version is Codesys V3.5 SP20patch3.) Best Regards Imdat
Last updated: 4 days ago

Post by gilbert-mh on CAA net base TCP client cause PLC to crash - Kernel message : N0HZ_local_softirq_pending 80 CODESYS Forge talk (Post)
Hello all, I have been trying to implement a TCP client on a Festo PLC (CPX-E-CEC-M1) and it looks like it works well except that after some time (greatly varies between a few hours to more than 100h) my PLC crash. When I look into the log file the only thing I see is that before the crash happens a few kernel warnings : N0HZ_local_softirq_pending 80 and then the crash. I've looked into this warning and from what I could find on the net it seems that this is warning is triggered when the ethernet link is down. I've tried to correct this bug for quite some time and what I know is that : - The crash is caused by my TCP client, when I remove it from my code I see no crash - The crash happens more quickly the more the TCP client is used. - The time before the crash is not directly proportional to the number of communications or their size. But it looks like it is just more likely to happen if the client connect to the server at a higher frequency. - The precedent observation makes it seem unlikely that the crash is caused by some memory overflow because then the crash speed would be more proportional to the amount of data exchanged. SO from these observations, I believe that the crash could be caused by the PLC trying to connect to a server while there is some kind of issue with the ethernet link resulting in the PLC getting stuck in some indefinite state and making it crash. This still seems a bit unlikely to me because if the ethernet is down it simply shouldn't be able to contact the server and the communication would just fail which doesn't cause my PLC to crash. Has anyone encountered the same kind of problem (with the same kernel message) ? I am pretty sure the warning is not the direct cause of the crash but just an indicator that something is wrong with my PLC. Thanks in advance
Last updated: 2024-01-12

<< < 1 .. 21 22 23 24 > >> (Page 23 of 24)

Showing results of 582

Sort by relevance or date