Comments (5)
Is this a standard STRING type, or a custom string? How many characters were you trying to write?
from pylogix.
Sorry for the delayed response. More on this.
With the 4-byte unsigned integer format specifier '<I', I am able to write any length of string as long as the character groups are short enough. For example I was able to write the word "short " 385 times. The PLC truncated it to "short short short short short short short short short short short short short shor".
There were two cases that caused an error state.
1.
When I took out the space between one of the shorts, "shortshort short short.....", I received...
File "C:\Python38-32\lib\site-packages\pylogix\eip.py", line 1571, in _make_standard_string
temp = pack('<I', len(string)).decode(self.StringEncoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 0: invalid continuation byte
- (I began the thread here)
When I restarted my application which reads with the single-byte unsigned value format specifier '<B'.
File "C:\Python38-32\lib\site-packages\pylogix\eip.py", line 1496, in _parse_multi_read
value = str(s.decode(self.StringEncoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 84: invalid continuation byte
Relating to case 1. is when I wrote "shortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshortshorts". Then restarted my application and could not read. (adding an "h" makes the write fail)
Is the controller able to hold the full value? I would have thought the data would have been truncated and lost, so the format is valid when it's time to read.
Moving forward I will just limit to the 82 characters studio5000 indicates.
from pylogix.
No problem.
So you were trying to write more characters than actually fit in the string? Obviously that won't work, but I probably shouldn't let you try. Thanks for the information, I'll do some testing.
from pylogix.
All interesting stuff. I'm just wondering how the plc is holding onto the bad string and if it's only during runtime of the plc.
from pylogix.
Fixed by @ifTaylor
from pylogix.
Related Issues (20)
- Unknown Error 255 on Multi-Write when including a string HOT 6
- read tag from 80 sets of plc HOT 22
- Double read packets? HOT 6
- cannot import name 'Adapter' from 'pylogix' HOT 23
- Tag Write falsely reports Success HOT 7
- "Forward open failed" when trying to read tags from Berghof PLC HOT 8
- .GetDeviceProperties always returns DeviceType of "None" HOT 5
- Issues connecting to emulate HOT 7
- micro850 connection HOT 5
- Return data gets jumbled up on a multi write when the tags don't exist. HOT 13
- The return value is different when using a multi write compared to a single write for a string. HOT 4
- cannot get a tag list HOT 3
- Is it possible to inhibit a periodic task? HOT 2
- pylogix - returning a tag list as a row of values HOT 7
- PLC REAL values HOT 5
- Pylogix - compare a previously acquired tag list with the current one HOT 5
- Discover does not work while running pylogix in docker HOT 10
- Abnormal code termination. HOT 8
- Do I need to use routing? HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylogix.