Comments (6)
I have managed to get something to work, but it seems to only read/write the arrays as arrays of dint/int etc, not as seperate bools. Does this therefore not support writing to an array of bools.
from pycomm.
Basically i have been able to write and read from the array of bools, but i cannot do it to individual bools in the array, instead the most amount of parts i can split the 128 bit array is into 4 parts, therefore viewing it as a 4 DINT array. Increasing the element count in the functions to 8 or 128 as i really want, doesn't return any output or error.
Is this a limitation with the library or something i am missing?
from pycomm.
Here is how I am reading from a (64 element) boolean array using my little test program:
print(bin(c.read_tag('B')[0])[2:64])
It prints the result like this:
111100001111
If you just straight-up read the content of the boolean array, you get:
(3855, 'DWORD')
The limitation is most likely due to a combination of the way Rockwell handles boolean arrays (as integers / blocks of bits) in the processor and perhaps the way Python handles this data. It could probably be worked around. I'll try to give it some thought.
from pycomm.
I have run a test and look like the _parse_fragment function read an "unknown status" from the PLC. I will need to look at the log files to understand what's happening. Will keep you posted
from pycomm.
Thanks it would be great if you could get it working.
rkrupnek, I used your method to read from an element in my array, but you cannot use this to write to a single element.
from pycomm.
Ok so this is more of a Rockwell representation. In other words Rockwell see the array of bool as DWORD type for both performance and space reasons (I read this somewhere in the documentation). If you try to define an array of BOOL of dimension 3 Rockwell will automatically create an array of dimension 32 BOOLS, or if you try to define an array of dimension 33 Rockwell (RSLogix I should say) will automatically create an array of 64.
The only way at the moment is to use the read and write array function as DWORD size for example:
I defined in my plc an array of 32 Boolean; now if I need set the first 3 bool to 1 i will have to write 15 in the whole DWORD .
w_array = []
w_array.append(15)
c.write_array("AGO_BOOL_TEST", w_array, "DWORD")
If i need to read the array I will need to pass the size in term of DWORD , so if I need to read the first 4 bit i will have to use size of 1 because this 4 bits resize in the first DWORD
r_array = c.read_array("AGO_BOOL_TEST", 1)
This will read the entire word.
This is not the best solution because you will need to do some coding to extrapolate the bit needed. To be honest this code could be easily write inside both "read_array" and "write_array" and I will try to do it but later because now I'm in the middle of a startup.
Hopefully this help a bit
Ago
from pycomm.
Related Issues (20)
- Implicit Messaging: How to use forward open request for continuous message communication in connected mode on UDP? HOT 1
- Large Array Read and Write Speed
- CommError: must be str, not bytes HOT 1
- Problem to write tags Micrologix 1100
- NameError: name 'defaultdict' is not defined HOT 1
- Pycomm to micro 820 HOT 1
- Should it work with AB Emulator 5000? HOT 1
- check for warnings
- Micrologix 1200 HOT 5
- Reading Hundreds of Tags Fast HOT 2
- Fully connect to a MicroLogix1100 in UBUNTU Py3.6.7, but not on an WINDOWS server.
- Non-AB EthernetIP connections?
- Retrieving IO tags in plc.tags HOT 1
- Multiple Connections to Same PLC HOT 2
- Reading multiple Timers HOT 1
- SLC Driver to Read RTC:0 [YR, MON, DAY...] HOT 1
- Pycomm3 running on Linux Ubuntu. '\x08\x00\x00\x00Galera 1'
- GUI test app for pycomm and python 2 HOT 1
- Reading and Writing to I/O tags
- os.getpid() doesn't fit into word, problem with sequence number
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 pycomm.