-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Comments
My solution was to put all my variables in a single huge DB-block and just
every second or so read the entire thing in python using the read_db
functions.. Did 500+ variables this way, so basically
the entire PLC content.
How about doing multiple calls?
Stephan.
Senior Software Engineer.
+31 6 24 69 22 97
https://gitlab.com/spreeker/
https://github.com/spreeker/
https://www.nlx.io/
https://commondatafactory.nl/
…On Fri, May 8, 2020 at 9:58 AM Su600 ***@***.***> wrote:
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!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#155>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOSMJ2IJ5FN4CTEU6VCH3RQO3SFANCNFSM4M37D6ZA>
.
|
@spreeker 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 Thank you again, I'll continue try to find a solution. |
Since there has been no activity on this issue I consider the question answered and will close this issue. |
Hi!
I have a problem when variables more than 20 in
read_multi_vars(data_items)
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:When print the type below:
Got:
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!
The text was updated successfully, but these errors were encountered: