Exchange data with Logix based PLC's via Python

I looked back to find what we changed to make multiple copies of PyComm work with the same PLC and it was in this region of code:
Code:
self.attribs = {'context': '_pycomm_', 'protocol version': 1, 'rpi': 5000,
 'port': 0xAF12, 'timeout': 10, 'backplane': 1, 'cpu slot': 0,
 'option': 0, 'cid': '\x27\x04\x19\x71', 'csn': '\x27\x04', 
 'vid': '\x09\x10', 'vsn': '\x09\x10\x19\x71', 'name': 'Base',
 'ip address': None}

I do not remember exactly, but we changed the value for either cid or csn. As I mentioned, I'm not a Python programmer, so I wasn't sure the best thing to do, so we just changed the value. Just a recommendation, but making it a random generated number would avoid the problem of 2 devices trying to connect to the same PLC.
That's the right place and 'cid' is the right property. 'sel.attribs' is a dictionary with the attributes of the class, so if you need to change the CID then you can use my_class.attribs['cid']='/x01/x02/x03/x04/' (with my_class being an instance of pycomm)

In this way you can easily map an external configuration file to the dictionary, and that's why I didn't make a random number. Anyway these feedback is very helpful, so I will make a change sooner.

thanks
Ago
 
BTW, if you want a good implementation of python then get the anaconda package. It includes numpy, scipy and matplotlib.
I just use idle for editing for now.
I will give it a try, for me pycharm works really well. The community edition is free and is very well integrated with github and lots of other good stuff

Ago
 
Hi, as an additional option, you can use libplctag (a C library for the same thing) which has a Python wrapper. The main developer is currently seeking input on the functionality of the library for v2.0. Have a taste: https://github.com/kyle-github/libplctag

Edit: I should also add that once you compile the library, one of the produced executables is a command-line utility called tagrw that allows you to read/write tag values for Logix/PLC5/SLC500/MicroLogix etc.
 
Last edited:
Thanks dmroeder
I followed your instructions on a video I found on youtube.
I haven't tried it yet but going to now. Thanks for the effort though and have fun "tinkering"
 

Similar Topics

Hi there, Can anyone suggest the solution to communicate between AB Compactlogix L36ERM controller(Which is having remote flex IOs over ethernet)...
Replies
9
Views
3,570
Hi, i want to exchange data between 2 micrologix 1100 and devicenet. Each plc have a devicenet device, exactly 1761-net-dni. it´s possible to make...
Replies
18
Views
4,140
Hi. Is there anyone there have an idea to exchange data between a Creston control system ( http://www.crestron.com/ ) and a Rockwell Flexlogix...
Replies
1
Views
2,150
Hi all. I'm trying to set up communication between a 1756-L72 (EN2TR) and a 1756-L82 (CPU port) using produced / consumed tags. From the L72...
Replies
13
Views
357
Gents, I've a Beckhoff TwinSAFE project in TwinCAT 3 where I've 2 EL6910 Safety controllers, and need to exchange data between them. So I...
Replies
2
Views
812
Back
Top Bottom