Hi there, I am using the Python library mcculw on a Windows 10 mcahine. I am using the USB 231 DAQ.
When I send voltages for the first time (using a_out_scan() method) everything works fine. When I send it for the second time, I get this error:
daq_device_info.py, line 37,in __init__
raiseULError(ErrorCode.BADBOARD)
mcculw.ul.ULError:ErrorErrorCode.BADBOARD:Invalid board number.
Notes:
I have stored the board number in a variable board_num=0. I am not changing it at all during program execution. So, I don't know how it changes and how I get the error.
I initialize the device using the following code each time I try to send voltage. The following is an excerpt from my code:
classDaqLogic:'''
This class has various methods to interact with the DAQ
'''def __init__(self):
self.board_num =0
self.daq_info =DaqDeviceInfo(self.board_num)
self.ao_info = self.daq_info.get_ao_info()#Useful constants for the DAQ
self.low_chan =0
self.high_chan =1
self.num_chans = self.high_chan - self.low_chan +1
self.ao_range =ULRange.BIP10VOLTS
self.use_device_detection =True
self.dev_id_list =[]
self.calibrationFactor =1
self.lcdFreq =200# in Hzdef configure_first_detected_device(self):'''
Configures the first detected device. Ingores Instacl config.
'''
ul.ignore_instacal()
devices = ul.get_daq_device_inventory(InterfaceType.ANY)ifnot devices:raiseException('Error: No DAQ devices found')print('Found', len(devices),'DAQ device(s):')for device in devices:print(' ', device.product_name,' (', device.unique_id,') - ','Device ID = ', device.product_id, sep='')# Add the first DAQ device to the UL with the specified board number
ul.create_daq_device(self.board_num, devices[0])def intialize_daq(self):'''
Initializes the DAQ
'''try:
self.configure_first_detected_device()
daq_dev_info =DaqDeviceInfo(self.board_num)ifnot daq_dev_info.supports_analog_output:raiseException('Error: The DAQ device does not support ''analog output')exceptULErroras e:# Todo: Create alert windowprint("Error: ", e)
Is it that I should not initialize the device each time I wish to send voltage ?
I guess, I must initialize only once and then store some reference to the device for further use, like sending voltages for 2nd time.
Question
Sid_1
Hi there, I am using the Python library mcculw on a Windows 10 mcahine. I am using the USB 231 DAQ.
When I send voltages for the first time (using a_out_scan() method) everything works fine. When I send it for the second time, I get this error:
Notes:
Is it that I should not initialize the device each time I wish to send voltage ?
Edited by Sid_1I guess, I must initialize only once and then store some reference to the device for further use, like sending voltages for 2nd time.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now