ruscito / pycomm

pycomm is a package that includes a collection of modules used to communicate with PLCs
MIT License
139 stars 85 forks source link

How can I do an "atomic" bit write using the write_tag() #26

Closed gman8a closed 7 years ago

gman8a commented 7 years ago

See Wiki page for my "Read-Modify-Write" code.

When multiple clients are connected to a PLC, and the "bit write" method is accomplished at the application layer, by doing "Read-Modify-Write" operation, then there is a good possibility the PLC bit write register will become corrupted, as there are no lock semaphore across connected clients.

Thus the low-level-driver (LLD) needs to support the AB bit write.

Question: Does pycomm support device bit write ?

ruscito commented 7 years ago

Not really sure what are you asking, but you can use "write_tag" to write a boolean

gman8a commented 7 years ago

see AB Control logic manual

URL: http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm020_-en-p.pdf

page 30

Read Modify Write Tag Service The Read Modify Write Tag Service provides a means to modify Tag data with individual bit resolution. Within ControlLogix, the Tag data is read, the logical or modification masks, or both, are applied, and finally the data is written back to the Tag. It can be used to modify a single bit within a Tag without disturbing other data. Its purpose is similar to the PLC-5 style Read Modify Write PCCC command described in Chapter 5

gman8a commented 7 years ago

I see the Read Modify Write Tag Service (0x4e) was not implemented.

ruscito commented 7 years ago

gman8a yes you are right Read Modify Tag Service is not implemented yet; I will take a look, but at the moment I'm focusing more to handle STRING datatype correctly

Thanks Ago