Activity for nothinrandom

  • nothinrandom nothinrandom modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Looking at the versions, you just downgrade until it works correctly. https://us.store.codesys.com/iiot-libraries-sl.html#product.attributes.wrapper

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Looking at the versions, you just downgrade until it works correctly. https://us.store.codesys.com/iiot-libraries-sl.html#product.attributes.wrapper.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Try to downgrade the MQTT Client SL to 1.1.0.0, which is the last known good working version. CoDeSys posted on their store that 1.3.0.0 is supposed to fix this issue, but it looks like not yet. MQTT Client SL-1.3.0.0 Important Bugfix (for topics > 80 chars) Bugfix (AsyncProperty) Improved error handling of the subscriber FB

  • nothinrandom nothinrandom modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Not sure what settings you have, but maybe the server isn't set up correctly? For example, check /etc/CODESYSControl_User.cfg (Linux) to make sure these items are in place: [CmpOPCUAServer] SECURITY.CommunicationMode=SIGNED_AND_ENCRYPTED SECURITY.Activation=ACTIVATED NetworkPort=4843 NetworkPort is optional

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Not sure what settings you have, but maybe the server isn't set up correctly? For example, check /etc/CODESYSControl_user.cfg (Linux) to make sure these items are in place: [CmpOPCUAServer] SECURITY.CommunicationMode=SIGNED_AND_ENCRYPTED SECURITY.Activation=ACTIVATED NetworkPort=4843 NetworkPort is optional

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    When you're filling out this array, couldn't you just keep track of the filled index via a separate variable? This is especially important if you're re-using this array since each transaction might not have the same size.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    This is just a lookup table. Are you interested in all columns or just the angle and stroke? If only angle and stroke, then simply create a REAL array with index of 0 (e.g. myTable: array[0..33] of REAL := [0, 27.88, 55.77, 83.66, (fill in the rest here)]. If you're interested in all columns, then probably need to create multiple arrays (e.g. one for angle, one for stroke, one for difference) since angle is INT, and the other two are REAL. Anyway, then just index through them.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    there should be an input field called eContentType. Fill out this field with Web_Client.CONTENT_TYPE.APPLICATION_JSON

  • nothinrandom nothinrandom modified a comment on discussion Runtime πŸ‡¬πŸ‡§

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    Use the NBS library to make your life easier. https://faq.codesys.com/display/CDSFAQ/TCP%3A+Example+for+Server+and+Client

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    You could also just use bits of a UDINT since it also has 32 bits. For example: udiTest : UDINT; udiTest.0 = TRUE; // same as BOOL1 udiTest.1 = False; // same as BOOL2

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    You could: 1. use SIZEOF to get the total size of the STRUCT in bytes. 2. use memcpy to copy chunks of 8 bytes at a time: https://help.codesys.com/webapp/ZidVRTnfzfI0LAYUwLYCsY_W-O4%2FMemCpy;product=MemoryUtils;version=3.5.17.0 3. Increment index offset using while/for loop until you're at the end. don't have codesys open, but something like the below should work. // VAR uliData : ULINT; uiOffset : UINT := 0; pbStruct : POINTER TO BYTE; uiTotalSize : UINT := 0; uiDataBlock : UINT := 8; pbStruct :=...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    You could possibly write the value(s) out to a CSV file and have your python code run it. You can execute python via Sysprocess.SysProcessExecuteCommand. So when you click this button, write values out to a file, and also execute python code that you can read back in the result to be displayed on the screen or something.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Found the answer, use parameter NetworkPort=4843. More details can be found in: https://faq.codesys.com/display/CDSFAQ/OPC+UA+Server

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Hey folks. Does anyone know what is the parameter to change the OPCUA port from 4840 (default) to 4843 (SSL)? Webserver uses the WebServerSecurePortNr=PORT_NUMBER, so maybe OPCUA uses something similar? Hmm... I have a feeling @eschwellinger or @i-campbell can quickly answer this. Thanks!

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    you should be able to call the generic TO_STRING() operator. For example, myString := TO_STRING(myDint);, where myString is a variable of type STRING and myDint is a variable of type DINT.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    What is the device that you are using and its operating system? If you are using Linux (e.g. Ubuntu as OS), then you can install something called KeepAlived on both systems. Have both systems talk to each other and handle the codesys runtime.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    They say a picture is worth 1000 words... https://www.youtube.com/results?search_query=codesys. There's plenty of learning material in this quick search and should get you going all the way.

  • nothinrandom nothinrandom posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    Thanks Ian! Also thanks for confirming. Yes, this would be super useful. I guess for now, it's concating then.

  • nothinrandom nothinrandom posted a comment on discussion Visualization πŸ‡¬πŸ‡§

    Hey Folks, I am not sure what the proper format is to print both text and time in the same object (e.g. textbox, lable, rectangle, etc). For formatting guide is located via https://help.codesys.com/webapp/_visu_placeholder_with_formatting_sequence_in_a_string;product=core_visualization;version=3.5.17.0. Currently, I have two labels: one that prints the string variable (%s) and one that prints the time (%t[yyyy-MM-dd dddd]); regarding time, no need to specify a variable. These two show correct data....

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    In order to prevent the address from changing when you update code, you'd need to map the first byte parameter to a variable to keep it static. For example, let's say your first byte of the first EtherNet/IP device is mapped to IB%01, then just map that to a global variable so that it won't change. Ideally, we should be able to access the parameters directly via interface. For example, let's say you have an EtherNet/IP scanner (master) that speaks to a few adapters (slaves) called MyDevice1, MyDevice2,...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    What do you mean by "download codesys app offline"?

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Oh good catch! I didn't notice the system endianess. Typically, I would avoid adding additional libraries just to use a single function. Let's get back to the basics where packing bytes is simply bit shifting. In this case, the output could be computed via (assuming receiving system is little endian): dwOutput := SHL(Application.GVL_IO_LINK.Port1_inputs[4], 24) + SHL(Application.GVL_IO_LINK.Port1_inputs[3], 16) + SHL(Application.GVL_IO_LINK.Port1_inputs[2], 8) + Application.GVL_IO_LINK.Port1_inputs[1];...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    πŸ‘‹ @h-hermsen, 127.0.0.1 is a virtual interface that is typically referenced as localhost and serves as loopback traffic. It's mainly used to diagnostic within the host itself since traffic can't go anywhere outside... listening (binding) to localhost would work across services if their traffic also originated from the same host. If you want your service to listen on all interfaces, then you could listen on 0.0.0.0 instead. In Linux, a good way of checking to see what services are listening to what...

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    @eschwellinger, Wouldn't this be more than a runtime crash because the device can't be pinged or accessed via SSH. This seems like an OS layer issue. @MadsKaizer, If you SSH in and run this command ls -la /var/log/, do you see log files that have been gzipped? If yes, then try zcat the files (e.g. zcat /var/log/kernel.*)... though I'm not sure if zcat is installed. If not, then move the file to your computer using WinSCP or something similar and try to read the file.

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    @dgirard, Could you provide more details such as your cloud provider, which service of your cloud provider is going to store this CSV file, etc? With more details, you might not even need the IIoT library at all to make this transfer. For example, let's take AWS as cloud provider with S3 is the storage solution. You just need to follow these steps: 1. Install onto the device: 1. AWS CLI client (windows/linux) 2. AWS simple system manager (linux is preferred). This is to provide the short live cloud...

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    @MadsKaizer, The PFC200 is nothing more than a device that's running on Linux operating system (OS). This sounds like a kernel panic that's stopping everything. I would recommend you check, if exists, the kern.log file or other files that's OS related. Try to SSH in and look under the /var/log/ path.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    You can pretty much send anything to AWS IoT Core, but probably the best format is json; thus it should be in a format like {"val1":10,"val2": 20,"val3": 30} or formatted for better readability: { "val1": 10, "val2": 20, "val3": 30 } Since you're just pointing the publishing client at some data location via pbPayload and specifying the data's size via udiPayloadSize, you just need to wait until xDone is active, and then load new data into the same location. For example, you could create a STRING...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @thecolonel26, You will probably need to provide more data (e.g. remote IO vendor, model type, etc), but this seems like an issue when configuring the electronic keying (i.e. Vendor ID, Device Type, Product Code, Major Revision, Minor Revision)... essentially your EDS file.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @alberth007, Probably the easiest and most efficient way is to use pointer. Just create a pointer to DWORD since it's 4 bytes. For example: // create variable pdwValue : POINTER TO DWORD; // map variable to memory address pdwValue := ADR(Application.GVL_IO_LINK.Port1_inputs); // dereference pointer to get value and operate on it directly IF (pdwValue^ > 500) THEN // do something END_IF // less efficient way would be to copy value to another variable myValue := pdwValue^;

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @damian177, This is pretty much the format that most, if not all, industrial control protocols (e.g. EtherNet/IP, S7, SLMP) follow. Some header that specifies command type and length of the message and is followed by the message data itself. The best way to handle this would be to create a byte array, then use sysmem.cpy and copy the bytes into such array to be sent other some medium (e.g. Ethernet). For example: 1. Create a byte array called `_abOutput : ARRAY [1..4096] OF BYTE;` 2. Create a STRUCT...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @laxexo, I do not believe there is an available function that handles this conversion for you, so try this out. This handles partial hex (e.g. 20F) and also padded (020F). Notes: 1. Make sure to fill out the _asChar array with all of the chars from the ascii table (e.g. https://www.asciitable.com/). I just tested the first few chars, but the ones of interest should start at 48 (0) and ends at 122 (z), but feel free to adjust further (e.g. from 32 (space) to 126 (~)). If you have other methods that...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @jebates31, You are probably still missing the udiMaxPayloadSize parameter. From the screenshot, it is set to 0, so it is expecting an empty string. You could do something like: 1) udiMaxPayloadSize := SIZEOF(_sMyTestString); 2) udiMaxPayloadSize := 35; // some fixed string length that would cover your test case

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @jebates31, Pointer means that you need to get the memory address that stores the data. This can be done using the ADR instruction, so in your case you could do things like: 1) reading from a string variable like pbPayload := ADR(_sMyTestString) 2) reading from a static string variable like pbPayload := ADR('My Test String')

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    I believe one works for ARM architecture (Linux ARM SL), whereas the other works for AMD64 (Linux SL)... so they are not interoperable.

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    @galexis, could you elaborate and maybe provide some inputs and results of what you are expecting? There are many types of string sort algorithms. A "quick and simple" one can be implemented by performing memory comparison of strings and then sort them.

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @unzu, There are multiple ways as suggested here, you could create a function with multiple datatypes for INs and OUTs, initialize them with 0, and then select whichever data type you need to use. Another method is to leverage ANY like what TVM pointed out. So for example, the below allows you to take two variables and multiple them to gain output using ANY datatype. You could modify the below to mix and match certain datatypes if needed. FUNCTION Multiply : BOOL VAR_INPUT aVar1 : ANY; aVar2 : ANY;...

  • nothinrandom nothinrandom posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    @yann2021, I believe you should be able to achieve this inside of CoDeSys. 1) Find this file /etc/CODESYSControl_User.cfg and add the following to it: [SysProcess] Command=AllowAll 2) In your project, add the SysProcess library in Library Manager and execute the following command (example to set pin 18 to pull-up): SysProcess.SysProcessExecuteCommand2(pszCommand := 'gpio -g mode 18 up'); Another example to set it as output: SysProcess.SysProcessExecuteCommand2(pszCommand := 'gpio -1 mode 18 out'...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @sivan, If I remember correctly... it operates directly on your array, so it should be sorted already.

  • nothinrandom nothinrandom posted a comment on discussion Forge πŸ‡¬πŸ‡§

    @kislov, No, the CoDeSys_EIP library only handles explicit communication as of now. I guess I could integrate implicit communication, but that's what the CoDeSys EIP scanner already does... I'll put it on my roadmap, but certainly don't hold your breath. Looking at the specs sheet of the IO module and communication setup on page 59/61, it looks like you'll need to use implicit communication. BR,

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Glad it works for you. With this endian, shift right is divide by 2 and left is multiply by 2 for each bit (i.e. shift right by 3 is the same as dividing by 222). I noticed that you also need to divide by 10 to remove decimal, so a one liner looks something like this: // shift right 2 (/4) and /10 uiOutput := (SHL(TO_UINT(%IB10), 8) OR %IB11) / 40;

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    @dsongra, Thanks for the Conversion info.png. This makes more sense and it is probably why you are not seeing the result. It looks like we would need to generate the uint from the byte pairs and then shift. Try this instead: // generate uint from byte pair uiOutput := SHL(TO_UINT(%IB10), 8) OR %IB11; // shift right by 2 uiOutput := SHR(uiOutput, 2); We also swapped %IB10 (previously low byte) and %IB11 (previously high byte) data starts with most significant bit (MSB) from data sheet. Doing rough...

  • nothinrandom nothinrandom posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Let me see if I understand what you're saying here. You have two bytes, lower and upper. For the low byte, you are interested in bits 2-7; everything for the high byte. Assuming %IB10 is your low byte and %IB11 is your high byte uiOutput : UINT; // to always ignore the last two bits of the low byte // using 16#FC for masking since it is 11111100 uiOutput := SHL(TO_UINT(%IB11), 8) OR (%IB10 AND 16#FC); // to shift right the 2 least significant bits // i.e. 11111111 becomes 00111111 uiOutput := SHL(TO_UINT(%IB11),...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @muzel, do you have a specific card that seem to not have CoDeSys support? Package appears to still be available via https://github.com/SequentMicrosystems/megaioind-CODESYS

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @Ingo, I tried using datatype ANY at first. However, we're not allowed to have something like ARRAY[1..10] OF ANY_NUM or POINTER TO ARRAY[1..10] OF ANY_NUM, so it can only be ANY_NUM inside VAR_INPUT. I am not sure how we could provide sorting in this scenario. Is it possible to move this thread into Engineering?

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @dfx, good stuff. Looks that min index needed to be a DINT so that you can shift minimum from 0 to -1. I've made updates on my end and incorporated your work: FUNCTION numInsertSort : BOOL VAR_INPUT pbBuffer : POINTER TO BYTE; // pointer to buffer diElements : DINT; // array length uiDataType : UINT; // data type: SINT(1), USINT/BYTE(2), INT(3), UINT/WORD(4), DINT(5), UDINT/DWORD(6), LINT(7), ULINT/LWORD(8), REAL(9), LREAL(10) bDescending : BOOL := FALSE; // default ascending END_VAR VAR _uiDataSize...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    @dFx, Excellent work! I sorted arrays of N=10, 100, 200, 400, 800 REAL. To measure my cycles/steps, I inserted a counter right after the for loop statement, and another inside the while loop. To measure your cycles/steps, I inserted a counter before the repeat (for loop) and again inside the DoWhile loop. _testCounter := _testCounter + 1; REPEAT _testCounter := _testCounter + 1; Insertion Sort N | Steps ----- | ----- 10 | 31 100 | 2554 200 | 9859 400 | 38719 800 | 153439 dFx's Insertion Sort N |...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    @dFx, Excellent work! I sorted arrays of N=10, 100, 200, 400, 800 REAL. To measure my cycles/steps, I inserted a counter right after the for loop statement, and another inside the while loop. To measure your cycles/steps, I inserted a counter before the repeat (for loop) and again inside the DoWhile loop. _testCounter := _testCounter + 1; REPEAT _testCounter := _testCounter + 1; Insertion Sort N | Steps ----- | ----- 10 | 31 100 | 2554 200 | 9859 400 | 38719 800 | 153439 dFx's Insertion Sort N |...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @dFx, Excellent work! I sorted arrays of N=10, 100, 200, 400, 800 REAL. To measure my cycles/steps, I inserted a counter right after the for loop statement, and another inside the while loop. To measure your cycles/steps, I inserted a counter before the repeat (for loop) and again inside the DoWhile loop. _testCounter := _testCounter + 1; REPEAT _testCounter := _testCounter + 1; Insertion Sort N | Steps ----- | ----- 10 | 31 100 | 2554 200 | 9859 400 | 38719 800 | 153439 dFx's Insertion Sort N |...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    Have you worked this out yet? Something even in psuedo-code would be useful since I do not see how shifting the elements will increase performance. Maybe in a special scenario it might?

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    I would recommend just process everything via SysProcessExecuteCommand2, so you don't need to do post processing in CoDeSys. Example command could be something like this to exclude "Linux Foundation" and include "Flash Drive": scmd:STRING:='lsusb | grep -v "Linux Foundation" | grep "Flash Drive"';

  • nothinrandom nothinrandom posted a comment on discussion Visualization

    The easiest way should be to leverage the Web Browser element under Special Controls under the Visualization Toolbox. From there, fill in the URL data (http://x.x.x.x:8080/webvisu.htm) and a boolean for Show and that should be it. You should see the other PLC's visualization inside the current PLC's visualization.

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @dFx, not sure what you meant by "If elements are swapped, then approximate the new index by halving the distance to the max possible (needs two index memory more)."

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    Probably the easiest approach to this is to implement a heartbeat. Server sends client a dummy message (e.g. "HI") every X seconds to keep connection alive (when you are not regularly sending data to client). Client also sends server a dummy message (e.g. "HI") every X seconds to keep connection alive (when you are not regularly sending data to server). If either side does not receive this dummy message within Y intervals of X seconds, then close connection. In each client/server function block,...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    Are you planning to do anything with the USB drive (i.e. read/write to it)? Just to list usb devices, you just need to run command lsusb. To read/write from it, I would recommend that you set up partition automount so that it will appear automatically after reboot/startup. I am not sure of your experience with Linux, so more information is needed.

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    Could you share example of the struct?

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Thanks! Yeah, I'm also exploring other sorting algorithms (e.g. quick, selection and potentially heap), but they get pretty complex to write in structured text. Forgot that USINT is equivalent to a BYTE, so I'll update the code above.

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    Thanks! Yeah, I'm also exploring other sorting algorithms (e.g. quick, selection and potentially heap), but they get pretty complex to write in structured text. Forgot that USINT is a BYTE, so I'll update the code above.

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of insertion sort, which is arguably better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numInsertSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom modified a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    Previous code uses bubble sort, which is easier to implement but not so great in performance. Below is an implementation of quick sort, which is arguably much better. asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in ascending order: // using LOWER_BOUND/UPPER_BOUND, but you can hard code directly numQuickSort(pbBuffer:=ADR(asiTest),...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    Hey All. This looks interesting and I didn't find something flexible, so below is an attempt. To use the following code is relatively straight forward. Let's say you have some arrays. (Disclaimer: wrote this during lunch, so I am sure there is room for improvement) asiTest : ARRAY [1..10] OF SINT := [-5, 1, 8, -9, 12, -51, 11, 3, 3, 2]; arTest : ARRAY [1..20] OF REAL := [5.1, 1.2, 8.001, 9.1, 12.4, 51, 11.1, 3.1, 3.2, 2.3, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10]; To sort SINT array in...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    I was facing same issue and decided to update to the latest RPi OS that's based on Buster (https://www.raspberrypi.org/downloads/raspberry-pi-os/). CoDeSys runtime 16/16.10 works great. pi@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @acasilla, as a word of advice... When asking for help on any forum, read through what you are about to post and ask yourself if the provided information makes sense for an internet stranger to be able to understand what you are asking. Things like what have you tried or code snippet would certainly help. Anyway, I have connected several Keyence devices to CoDeSys before. I would recommend starting out by visit their page to download the EDS file for the communication settings: https://www.keyence.com/products/vision/vision-sensor/iv/models/iv-hg150ma/downloads/?mode=so&o=12....

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    This is such a common issue that it rivals IT's "Have you tried turning it off and on again?"

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @kumareasu, I have not done that exact combo, but I have used EtherCat before with another drive. What are you trying to do exactly? Let us start with the basics first. Assuming you have done this already... right click on your Device -> Add Device -> Expand EtherCAT -> Choose EtherCAT Master SoftMotion. Right click on the newly added EtherCAT_Master_SoftMotion device -> Add Device -> Search for MDDLN45BE_SoftMotion. If you click on the drive info, you have inputs and outputs that you can control....

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @S1ack, I am not familiar with using this method, but I have used a library called "CmpApp". Inside, there are structs to get information for both "APPLICATION_INFO" and "PROJECT_INFO". There's a function called "AppGetProjectInformation" that will allow you to extract this unless I am incorrectly understanding your request.

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @audi0615, from library SysMem, SysMemCpy is relatively straight forward. You have three inputs: pDest (destination array), pSrc (source array), and udiCount (total bytes). You will need to use ADR to get reference pointer. SysMemCpy(pDest:=ADR(array2), pSrc:=ADR(array1), udiCount:=4000); // 4*1000

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @aliazz, hehe... should have watched this first. Thanks!

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @aliazz @i-campbell, any chance you guys could make a video and post it on your youtube channel on how to host library/project here? It would incentivize myself and others to host it here instead. It's certainly not as straight forward as mentioned, but the issue is probably a user error.

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    This issue also happens on RPi 3B+ compute module after 30-ish seconds. I hope it's because of realtime kernel: $ uname -a Linux testPi 4.19.71-rt24-v7+ #2 SMP PREEMPT RT Mon Apr 13 17:34:00 PDT 2020 armv7l GNU/Linux $ sudo service codesyscontrol status ● codesyscontrol.service - LSB: Prepares and starts codesyscontrol Loaded: loaded (/etc/init.d/codesyscontrol; generated; vendor preset: enabled) Active: active (exited) since Thu 2020-07-23 23:18:58 PDT; 35s ago Docs: man:systemd-sysv-generator(8)...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    hahaha yes! I also ran into this back when I first evaluated CoDeSys, and it was a wonderful experience: https://forge.codesys.com/forge/talk/Engineering/thread/1db843fe1a/#00f9.

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @ristokarmas, I would highly recommend you upload your project, or at least some code for people to help troubleshooting. Going off your description, it could be anything really. Did you try to follow the CoDeSys example? https://faq.codesys.com/display/CDSFAQ/TCP%3A+Example+for+Server+and+Client

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @aliazz, To be honest, I am not a huge of this codesys SVN route; GitHub is easier to use for me. I guess if someone could point me to a tutorial on how to host here, then I might redirect the repo here instead.

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    Library is still new and there will be quick changes, so please be patient. If you guys have a feature request, feel free to open up an issue and I will try to implement it.

  • nothinrandom nothinrandom modified a comment on discussion Engineering

    Hello CoDeSys Enthusiasts, I would like to introduce a library called CoDeSys_EIP that I started working on roughly last Tuesday on my "spare" time. This library allows you to communicate with Rockwell PLCs using tag based communication. I decided to develop this library after trying to look for such feature in CoDeSys but without any luck and noticed that many folks asked for the same thing in a few different posts: https://forge.codesys.com/forge/talk/Runtime/thread/0e68f80e70/?limit=25#61cf Huge...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    loraul10, I decided to place the array into a global variable lists and called that instead. This way, we can guarantee that the data is always available. I was really bummed out when I noticed this was not available. Hopefully, SP17 can address this and allow you to download text list from library without using Visu Manager

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    Hello CoDeSys Enthusiasts, I would like to introduce a library called CoDeSys_EIP that I started working on roughly last Tuesday on my "spare" time. This library allows you to communicate with Rockwell PLCs using tag based communication. I decided to develop this library after trying to looking for this feature in CoDeSys without any luck and noticed that many folks asked for the same thin in a few different posts: https://forge.codesys.com/forge/talk/Runtime/thread/0e68f80e70/?limit=25#61cf Huge...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    So I am using the text list as a lookup dictionary in a library. I am using the function DynamicTextGetDefaultText to get index value from the text list. Some things that I noticed so far: 1) DynamicTextGetDefaultText requires an additional scan cycle to be able to read out the text. 2) You must have a visu manager in your project in order to download the text list to reference it. Else, the return string will be empty. My question is that if it is possible to somehow download this file into the...

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    @JAPIB, Thanks for confirming! I am a bit bummed out since this would make packing/unpacking structs not straight forward at all. But I guess the alternative would create possibility of buffer overflow, so it is not safe. Now, I need to really think about how to unpack structs with this limitation.

  • nothinrandom nothinrandom posted a comment on discussion Engineering

    I would like to create a struct that has variable string length. However, CoDeSys compiler is not happy since testLength is not a constant. STRUCT testLength : BYTE; testName : STRING[testLength]; END_STRUCT I have been reading through documentation but could not find an answer to this, so I hope it is not impossible. Maybe there is another way to approach this? Thanks,

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    If you haven't done so, maybe add ssh to /etc/CODESYSControl_User.cfg: [SysProcess] Command.0=shutdown Command.1=ssh shutdown is default. There's another option to allow all via Command=AllowAll, but this is way too permissive.

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    Codesys was working fine on 4.14-RT, but it looks like I'm facing similar issue for 4.19-RT on a regular RPI 3B+. Are you reading from /tmp/codesysedge_debug.log? Nothing unusual shows up from its status except that Codesys exists 10-20 seconds after starting: $ service codesyscontrol status ● codesyscontrol.service - LSB: Prepares and starts codesyscontrol Loaded: loaded (/etc/init.d/codesyscontrol; generated; vendor preset: enabled) Active: active (exited) since Sun 2020-06-21 01:44:57 PDT; 9h...

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    I would like to apply my own certificate, but I'm not sure how to do so. I've tried to use openssl to generate a self signed certificate that matches the exact same output as the one that gets automatically created, converted private key and cert to der format, and moved them both into the ./pki/own/key and ./pki/own/cert. However, when I restart codesys runtime, I get these errors in the logs. TlsCreateContext2: Private key for certificate jg?{U not available. Get TLS context failed!

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @Edwin, Thanks for your response. I'm running on 3.5.15.30 64b, and I followed your instructions. The issue that I'm noticing is that even if I create own certificate via Codesys IDE (delete or not delete previous cert), the IDE also creates its own certificate (30 days) on the controller with value of "Encrypted communication" under the Information column and uses that as default (/etc/CODESYSControl.cfg). If you manually delete .der file from /var/opt/codesys/.pki/own/cert and .key file from /var/opt/codesys/.pki/own/key....

  • nothinrandom nothinrandom posted a comment on discussion Runtime

    @Edwin, Are we still able to generate certificate without needing to use the IDE? I noticed that the certificate is only valid for 30 days. It looks like there's no way of increasing this? Thanks,

  • nothinrandom nothinrandom modified a comment on a wiki page

    Hello Guys, I believe there's an issue with nested structs on all verions. For example: TYPE stDebugJson : STRUCT timestamp : JSONVAR; messageType : JSONVAR; //message : JSONVAR; //works fine with setting MaxLevel to 1 message : stDebugMessageDetails; // missing end bracket END_STRUCT END_TYPE stDebugMessageDetails is just another type: TYPE stDebugMessageDetails : STRUCT message : JSONVAR; END_STRUCT END_TYPE The output looks like: {"debugMessageJson":{"timestamp":"2020-03-06T23:27:22.966Z","me...

1 >