Skip to content
forked from dmroeder/pylogix

Read/Write data from Allen Bradley Compact/Control Logix PLC's

License

Notifications You must be signed in to change notification settings

garrosh/pylogix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USAGE:

1) import the EIP file: import eip as PLC

2) init:  PLC.__init__()

3) Set the IP Address property: PLC.IPAddress("192.168.1.10")

4) If your processor is in a slot other than 0, set that: PLC.ProcessorSlot(n)

5) Do one of the following:

    Read a value:  value = PLC.Read("tagname")
	ex: value = PLC.Read("MyTimer.ACC")
		    print value
	
    Read an array: value = PLC.Read("tagname", length)
	ex: value = PLC.Read("MyDINT", 10)
		    print value(3)
		    
    Multi-read values = PLC.MultiRead("Tag1", "Tag2", "Tag3")
			print values
			
    Write a value: PLC.Write("tagname", value)
	ex: PLC.Write("MyTimer.PRE", 100")
	
    Get a list of the controller tags:  taglist = PLC.GetTagList()
	taglist will be an object with the following properties:
	    .TagName
	    .Offset
	    .DataType
	if you want to know how many tags: print len(taglist)
	access one:  print taglist[4].TagName
	
    Get the PLC Clock time: time=PLC.GetPLCTime()
	ex: time=PLC.GetPLCTime()
	    print time
	
	
So a complete script to read a tag would look like this:

import eip as PLC
PLC.__init__()
PLC.IPAddress("192.168.1.10")
value = PLC.Read("MyTimer.ACC")
print value


*************************************************************************
Added identify.py.  If you call the ListIdentity() function, it will send out a
UDP packet which will request that all listening devices respond with some
information about each device.  It will be returned to you in a list.

Usage would look like this:

from identify import *
devices=ListIdentity()
for i in xrange(len(devices)):
  print devices[i].Address, devices[i].ProductName
  
The complete data structure returned is:
  .Address
  .VendorID
  .Vendor
  .DeviceID
  .DeviceType
  .ProductCode
  .Revision
  .Status
  .SerialNumber
  .ProductName
  .State

About

Read/Write data from Allen Bradley Compact/Control Logix PLC's

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%