8000 string type size · Issue #71 · s7connector/s7connector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

string type size #71

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

Open
ghost opened this issue Sep 27, 2019 · 1 comment
Open

string type size #71

ghost opened this issue Sep 27, 2019 · 1 comment

Comments

@ghost
Copy link
ghost commented Sep 27, 2019

within the S7Type the different data types, their converter classes and theirs sizes are described. I think the sizes specified there are the type sizes on the PLC, aren't they? As far as i have seen the S7 PLCs always "reserve" 256 Byte for a STRING type even if the user does not use it completely. I wonder why STRING is specified like that within S7Type:

/** * String type, size must be specified manually */ STRING(StringConverter.class, 2, 0),

and not like this:

STRING(StringConverter.class, 256, 0),

@thomasrudin
Copy link
Contributor

From my experience (mostly reverse engineered): The S7 String has a dynamic size.

The first byte is the overall size and the second is the current size, but the overall size can't be more than 256 bytes anyway (1 byte length inidicator) and the current size can't be more than the overall size.

The code is pretty clear on that:

https://github.com/s7connector/s7connector/blob/master/src/main/java/com/github/s7connector/impl/serializer/converter/StringConverter.java#L23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0