Up | Adam-6000 Series | Adam-4000 Series | Adam-6060

Release Notes
 

  

 
Adam-6000 Series

Allows access to ADAM 6050, 6051, 6017 and other 6000 series cards. Source code tested with ADAM-6051 model.

More information: Advantech Web

Methods:

  • Constructor
    a=Adam6000(ip='10.0.0.1',KeepOpen=1,timeout=1.0,unit=1,port=502)
    KeepOpen - 1: keep socket open until close() is called
    timeout - socket read timeout value
    ip,port - Adam IP,port
    unit - unit number. Use default 1
  • ReadInput(channel)
    read one digital input, specified by channel
  • ReadOutput(channel)
    read one digital output, specifed by channel
  • WriteOutput(channel,value)
    read one digital output, specifed by channel and value
  • ReadWord(address)
    read word starting at byte 0 + address, in bytes
  • WriteWord(addressOffset,data)
    write word starting at byte 0
    addressOffset - use 0 for the first 16 channels, use 2 for the next channels
    data - two bytes of data, LSB on the right, e.g. to set the first two output channels use WriteWord(2, 0x0003)
  • ReadRegisterWord(address)
    read word starting at address 40000 + address, in words, e.g. to read all digital inputs at 40301 - use ReadRegisterWord(300)
  • WriteRegisterWord(address, value)
    write word starting at address 40000 + address, in words, e.g to write all digital outputs at 40303 - use WriteRegisterWord(302)
  • ResetCounter(counterNumber)
    counter function, only for ADAM-6051
  • ReadCounter(counterNumber)
    counter function, only for ADAM-6051

For all functions a tuple ok,txt,val/msg is returned. If success - ok is 1 and data is found in val. If Failure - ok is 0 and error text found in txt.

Example 1: Read the 1st and the 2nd (0 and 1 channel)digital inputs

from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,val=a.ReadInput(0)
  print 'ReadInput(0):',val
  ok,txt,val=a.ReadInput(1)
  print 'ReadInput(1):',val
  a.close
except:
  print 'exeption'

Example 2: Read multiple inputs

from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,val=a.ReadWord(0x0000)
  print 'ReadWord(0x0000):',val
  a.close
except:
  print 'exeption'

Example 3: Write the 1st and the 2nd (0 and 1 channel) digital outputs

# 0 and 1 output channel set to 1
from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,msg=a.WriteOutput(0,1)
  print 'WriteOutput(0,1):',txt
  ok,txt,msg=a.WriteOutput(1,1)
  print 'WriteOutput(1,1):',txt 
  a.close
except:
  print 'exeption'

Example 4: Write multiple outputs

# 1 output channel set to 1, 0 and others channels set to 0
from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,msg=a.WriteWord(2,0x0002)
  print 'WriteWord(2,0x0002):',txt
  a.close
except:
  print 'exeption'

Example 5: Read the 1st and the 2nd counter/frequency (only for ADAM-6051)

from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,val=a.ReadCounter(0)
  print 'ReadCounter(0):',val
  ok,txt,val=a.ReadCounter(1)
  print 'ReadCounter(1):',val
  a.close
except:
  print 'exeption'

Example 6: Read the 1st channel counter/frequency value
ADAM 6050-6060 models have optionals counter/frequency channels
ADAM 6015-6024 models - this example is for reading 2nd channel Analog Input value

from adam6000 import *
try:
  a=Adam6000('10.0.0.100')
  ok,txt,val=a.ReadRegisterWord(2)
  print 'ReadRegisterWord(2):',val
  a.close
except:
  print 'exeption'

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.