-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the StringPlcMapper, Omron is not present #365
Comments
Thanks - do you know how strings are encoded for your device? |
No, how can I check? |
Use the core library test tool tag_rw to read a string tag. If I remember correctly, strings on Omron have a counted string with a 2-byte count, no padding. I do not know the maximum length of a string. |
I can read string from .Net wrapper, where can i find the maximum length of it? In the PLC myString is defined as STRING[Custom Length] If i run tag_rw:
libplctag-release\src\wrappers\python\windows_x64\plctag.dll Exist [WinError 193] %1 is not a valid Win32 application is thrown when load library (lib = ctypes.cdll.LoadLibrary(library)) |
The command line should look more like this:
The tag_rw2 executable can be found in the releases part of the main project. Hmm, I see a problem with the latest release. Somehow I managed to skip the Win32 part. The previous release has it though. Download the binaries for your platform (looks like x86 Win32?). Unzip the release somewhere by itself. You will see the libraries (DLLs) and some executables. The tag_rw2 executable is there. |
In the log file you will see a lot of output. If it works, you will see, near the bottom of the file, lines that look like:
The first two bytes are probably the count of the string length. The remaining bytes are the character data. |
|
How is "MyIP" working? Do you have DNS set up for the PLC? It looks like the core library is correctly handling strings in this case. So if there is a problem, it must be somehow in the .Net part? |
MyIp is localhost, i change it in this comment |
When the string is empty and not initialized/written by the PLC it looks like this |
This is the same error from .NET (on write) With Debug:
|
This is the main error |
The library does not automatically extend the buffer for strings. It probably should but it is a bit difficult to get this right. The buffer is only 4 bytes. Two of those are for the count word. So there is only sufficient space for two characters. You need to set the tag buffer to a size large enough to hold the string. In this case, that would be 6 bytes. Here is the documentation for the core C API. |
Also, that error should probably be something about size rather than configuration. |
sorry but I don't understand, is the error an error in the library or in my configuration? As I told you, the strings were created with [10] or [20], but I noticed that even an unlimited string gives the same problem. What can I do to resolve Returning to the ElementSize, they told me that the maximum of a string should be 256. |
@kyle-github, I tried to change the size but without success, look what I did in this comment: #359 (comment) |
@zN3utr4l - your diagnosis was correct and a new version of libplctag.NET has been published with a fix. |
I believe this issue can be closed although no changes have been made to StringPlcMapper. I'm not sure that the memory layout of this particular String tag is widespread enough to make a change to the StringPlcMapper. @zN3utr4l if you believe otherwise can you point to what the layout is and some Omron docs that discuss it. |
#359 (comment) |
Page 2-10 of this manual says that STRING types can be a range of sizes. In ControlLogix devices, there is a default STRING type which has a certain size (I think 88) but you can create other STRING types with other sizes. Is 256 the size of the default STRING type for Omron NJ? Are there any manuals you can point to? |
Yes of course, they can be declared of various lengths but the maximum default size is 256. |
In the StringPlcMapper, Omron is not present
I have the same issue as #359
The text was updated successfully, but these errors were encountered: