Sid_1 Posted October 10, 2022 Share Posted October 10, 2022 (edited) 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__ raise ULError(ErrorCode.BADBOARD) mcculw.ul.ULError: Error ErrorCode.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: class DaqLogic: ''' 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 Hz def configure_first_detected_device(self): ''' Configures the first detected device. Ingores Instacl config. ''' ul.ignore_instacal() devices = ul.get_daq_device_inventory(InterfaceType.ANY) if not devices: raise Exception('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) def intialize_daq(self): ''' Initializes the DAQ ''' try: self.configure_first_detected_device() daq_dev_info = DaqDeviceInfo(self.board_num) if not daq_dev_info.supports_analog_output: raise Exception('Error: The DAQ device does not support ' 'analog output') except ULError as e: # Todo: Create alert window print("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. Edited October 10, 2022 by Sid_1 Link to comment Share on other sites More sharing options...
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:
Is it that I should not initialize the device each time I wish to send voltage ?Edited by Sid_1
I 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
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 account
Already have an account? Sign in here.Sign In Now