updated for new version of PyComm
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import sys
|
||||
import sqlite3 as lite
|
||||
from pycomm.ab_comm.clx import Driver as ClxDriver
|
||||
|
||||
con = lite.connect("/mnt/usb/data.db")
|
||||
PLC_IP_ADDRESS = "192.168.1.10"
|
||||
@@ -28,10 +29,9 @@ def main(tagName):
|
||||
global PLC_IP_ADDRESS
|
||||
getPLCIP()
|
||||
|
||||
#PYCOMM Connection to PLC
|
||||
from pycomm.ab_comm.clx import Driver as ClxDriver
|
||||
|
||||
c = ClxDriver(True, 'ClxDriver.log')
|
||||
|
||||
c = ClxDriver()
|
||||
|
||||
def readString(tag):
|
||||
read_vals = c.read_array(tag, 82)
|
||||
|
||||
@@ -28,7 +28,7 @@ def getPLCIP():
|
||||
def readTag(tagName):
|
||||
global PLC_IP_ADDRESS
|
||||
|
||||
c = ClxDriver(True, 'ClxDriver.log')
|
||||
c = ClxDriver()
|
||||
|
||||
def readString(tag):
|
||||
read_vals = c.read_array(tag, 82)
|
||||
@@ -66,7 +66,7 @@ def main(tag, value):
|
||||
value = int(value)
|
||||
elif tagType == "REAL":
|
||||
value = float(value)
|
||||
c = ClxDriver(True, 'ClxDriver.log')
|
||||
c = ClxDriver()
|
||||
if c.open(PLC_IP_ADDRESS):
|
||||
r = c.write_tag(tag, value, tagType)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user