max. string length in Codesys is 255 chars. It's not possible to cram 20,000 things in a string. If you need to send the data to another device, send the whole data[] array (as byte array, without doing anything to it) and extract the information on the other end. As each struct member has a fixed size (81 bytes, as per you declaration), this will be easy. To save some resources, consider declaring string lengths - e.g. if the max possible length for key is 10 chars, declare it key: STRING(10); and...
Hi, I'm using a Festo Codesys PLC (CPX-CEC-C1-V3), which is connected to a HMI panel. Both exchange data via OPC UA. Occasionally, the HMI stops displaying data, and looks as if there is no connection. If the HMI stops, the only way to make it work again is to restart the PLC. Restarting HMI has no effect. When the PLC is restarted, HMI starts working normally again. Is it possible to restart the OPC UA server from PLC code? I hope this will make fixing the HMI possible without a PLC restart. Th...
Thanks Georg, that fixed it.
Hi, I have a XY system and use a CNC file to move it. Everything works OK, except for the following: when CNC execution starts, the system rushes at high speed to (X=0, Y=0) point, and only then goes to the first line of the CNC file. If one of the axes is near 0, the system jumps and immediately stops with an error. In the CNC file settings (screenshot attached) I specified low default values for speed/acceleration and a start position different from 0,0 - but all that is ignored. Any idea how to...
Okay I found the problem. In case someone else has it .. I had to add a webserver component under one of the ethernet adapters (and OPC-UA server also has to be added manually). I can't remember that being necessary in any other brand of PLC, adding a webvisu usually adds whatever is necessary. But it's mentioned in the docs. So that's just another RTFM case.
if the IF condition is not satisfied, it's simply skipped and the FOR loop continues with the next iteration. So you call cmd_LinuxSysCallAsync() in 5 successive scans. Try to do in steps with a CASE, e.g. CASE x OF 10: count := 0; x := 20; 20: cmd_LinuxSysCallAsync(xExecute:=TRUE,sCommand('touch txt.txt'); x := 30; 30: if cmd_LinuxSysCallAsync.xDone = TRUE THEN do_something(); count := count + 1; if count >= 5 then x := 40;//exit else x := 20; end_if; end_if; 40://end ; END_CASE;
if the IF condition is not satisfied, it's simply skipped and the FOR loop continues with the next iteration. So you call cmd_LinuxSysCallAsync() in 5 successive scans. Try to do in with steps with a CASE, e.g. CASE x OF 10: count := 0; x := 20; 20: cmd_LinuxSysCallAsync(xExecute:=TRUE,sCommand('touch txt.txt'); x := 30; 30: if cmd_LinuxSysCallAsync.xDone = TRUE THEN do_something(); count := count + 1; if count >= 5 then x := 40;//exit else x := 20; end_if; end_if; 40://end ; END_CASE;
I think you can simply declare both at the same fixed memory address, e.g. aWhole AT %MB100: ARRAY [0..Main.Length] OF REAL; aDivided AT %MB100: ARRAY [0..Main.Width,0..Main.Groups] OF REAL; and use whichever you want, a change in one will automatically be reflected in the other.