Commit c965df9f authored by Martin Drechsler's avatar Martin Drechsler

daq found now should work better: it tries to read a value from DI 0 to check the daq .

parent 703b32d7
...@@ -7,6 +7,8 @@ Created on Wed May 30 15:27:17 2018 ...@@ -7,6 +7,8 @@ Created on Wed May 30 15:27:17 2018
#from __future__ import absolute_import, division, print_function #from __future__ import absolute_import, division, print_function
import warnings import warnings
from messages import show_warning
daqfound = True daqfound = True
...@@ -20,15 +22,29 @@ try: ...@@ -20,15 +22,29 @@ try:
ao_range = ULRange.BIP10VOLTS ao_range = ULRange.BIP10VOLTS
except: except:
warnings.warn('Warning: either the daq was not found, or there was some error with the mcculw drivers. ') warnings.warn('There was some error with the mcculw drivers. ')
daqfound = False
try:
d_props = DigitalProps(0)
port = next(
(port for port in d_props.port_info
if port.supports_output), None)
ul.d_bit_in(0, port.type, 0)
print('daq found')
except:
#daqfound = False
warnings.warn('daq not found')
#%% #%%
class daq_DO(object): class daq_DO(object):
def __init__(self, out_num): def __init__(self, out_num):
global daqfound global daqfound
#ul.ignore_instacal()
self.board_num = 0 self.board_num = 0
self.out_num = out_num self.out_num = out_num
if daqfound: if daqfound:
...@@ -47,6 +63,8 @@ class daq_DO(object): ...@@ -47,6 +63,8 @@ class daq_DO(object):
self.board_num, self.port.type, DigitalIODirection.OUT) self.board_num, self.port.type, DigitalIODirection.OUT)
except ULError as e: except ULError as e:
self.show_ul_error(e) self.show_ul_error(e)
print('puerto: ', self.port)
print(self.port.type)
if daqfound: if daqfound:
def set_out(self, bit_value): def set_out(self, bit_value):
...@@ -64,6 +82,8 @@ class daq_DO(object): ...@@ -64,6 +82,8 @@ class daq_DO(object):
class daq_AO(object): class daq_AO(object):
def __init__(self, out_num): def __init__(self, out_num):
global daqfound global daqfound
#ul.ignore_instacal()
self.board_num = 0 self.board_num = 0
self.out_num = out_num self.out_num = out_num
if daqfound: if daqfound:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment