Skip to content
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

How to use 'read_multi_vars()' when variables is more than 20? #155

Closed
su600 opened this issue May 8, 2020 · 3 comments
Closed

How to use 'read_multi_vars()' when variables is more than 20? #155

su600 opened this issue May 8, 2020 · 3 comments
Labels

Comments

@su600
Copy link

su600 commented May 8, 2020

Hi!
I have a problem when variables more than 20 in read_multi_vars(data_items)

snap7.snap7exceptions.Snap7Exception: b'CLI : too may items (>20) in multi read/write'

So I try to read variables by groups(each group have 20 variables) use read_multi_vars(data_items[0:20]), but there also has an error:

TypeError: byref() argument must be a ctypes instance, not 'list'

When print the type below:

print(type(data_items))
print(type(data_items[2]))
print(type(data_items[0:20]))

Got:

<class '__main__.S7DataItem_Array_48'>
<class 'snap7.snap7types.S7DataItem'>
<class 'list'>

Which means date_item[0:20] return a list, so what should I do to read more than 20 variables ?

Could you please help me to solve this problem, thank you!

@spreeker
Copy link
Collaborator

spreeker commented May 8, 2020 via email

@su600
Copy link
Author

su600 commented May 8, 2020

@spreeker
Thanks for your solution, I'll consider this solution later.

Your solution may have to do some reprogram in the PLC, my application is more focus on connecting to an old PLC without program changed, which may not suitable very much.

I think Multiple calls is same as what I mean read by group, I also done this in PyLogix for Rockwell Allen Bradley PLCs. The key problem in this issue is how to slice the S7DataItem_Array and retain the datetype.

Thank you again, I'll continue try to find a solution.

@gijzelaerr
Copy link
Owner

Since there has been no activity on this issue I consider the question answered and will close this issue.

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

No branches or pull requests

3 participants