I'm using 16 USB-2408 and 8 USB-3114 on one computer via 3 powered 10-port USB hubs (8 devices per hub). I have the problem that some of the boards (not always the same ones) do not return a valid measurement into the buffer given to a_in_scan(). I use 12 channels per AD board out of the 16 available. Here are the initialization code snippets relevant to the AD conversion.
ul.ignore_instacal()
self.model.HWData.allhwdevices = ul.get_daq_device_inventory(InterfaceType.USB)
nr_of_devices = len(self.model.HWData.allhwdevices)
# prepare analog I/O info data structure
self.model.HWData.aio_info = [None] * nr_of_devices
# Cycle through all found MC hardware and assign the board numbers
for device in self.model.HWData.allhwdevices:
board_num = Serial2BoardNr[device.unique_id] # My table to assign board numbers to board IDs
ul.create_daq_device(board_num, device)
daq_dev_info = DaqDeviceInfo(board_num)
self.model.HWData.devinfo.append(daq_dev_info)
if daq_dev_info.supports_analog_input:
self.model.HWData.aio_info[board_num] = daq_dev_info.get_ai_info()
for channel in range(self.model.HWData.aio_info[board_num].num_chans):
self.model.HWData.adchannels.append([board_num, channel])
ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADDATARATE, 1000)
ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADCHANAIMODE, AnalogInputMode.SINGLE_ENDED)
Now I want to start the conversion when a GUI button is pressed which calls the following code:
rate = 0
points_per_channel = 1
ad_scan_options = ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS | ScanOptions.SCALEDATA
inputpowerchannels = [tuple[1] for tuple in self.model.HWData.devicechannelmapping]
outputpowerchannels = [tuple[2] for tuple in self.model.HWData.devicechannelmapping]
allpowerinchannels = inputpowerchannels + outputpowerchannels
unique_adboardnumbers = list(set([tuple[0] for tuple in allpowerinchannels]))
vcaoutputchannels = [tuple[0] for tuple in self.model.HWData.devicechannelmapping]
unique_daboardnumbers = list(set([tuple[0] for tuple in vcaoutputchannels]))
self.memhandle = [None] * (len(unique_adboardnumbers) + len(unique_daboardnumbers))
for cur_board_number in unique_adboardnumbers:
ai_range = self.model.HWData.aio_info[cur_board_number].supported_ranges[2]
channel_numbers = [tuple[1] for tuple in [item for item in allpowerinchannels if item[0] == cur_board_number]]
low_chan = min(channel_numbers) # This is 1
high_chan = max(channel_numbers) # This is 12
num_chans = high_chan - low_chan + 1 # This is 12 for all AD boards
total_count = points_per_channel * num_chans
self.memhandle[cur_board_number] = ul.scaled_win_buf_alloc(total_count)
# ul.a_load_queue(cur_board_number, list(range(num_chans)), [ai_range] * num_chans, num_chans) # This is not necessary, correct?
actual_sample_rate = ul.a_in_scan(cur_board_number, low_chan, high_chan, total_count, rate, ai_range, self.memhandle[cur_board_number], ad_scan_options)
The actual_sample_rate in my case is give back as 51S/s for all boards.
Now some boards give back 0.0 on all 12 measured channels, no matter what the actual input voltage is. those boards are not always the same, especially if I unplug and re-plug the boards into the computer.
I also checked the status on the boards. both the working ones and the ones only giving 0.0 show the status as running. But the cur_count is only increasing on the working ones, whereas on the not working ones it stays zero. Also all the USB communication LED indicator lights are blinking no matter if it's a working board or a non-working one.
Question
MichaelF
Hi,
I'm using 16 USB-2408 and 8 USB-3114 on one computer via 3 powered 10-port USB hubs (8 devices per hub). I have the problem that some of the boards (not always the same ones) do not return a valid measurement into the buffer given to a_in_scan(). I use 12 channels per AD board out of the 16 available. Here are the initialization code snippets relevant to the AD conversion.
ul.ignore_instacal() self.model.HWData.allhwdevices = ul.get_daq_device_inventory(InterfaceType.USB) nr_of_devices = len(self.model.HWData.allhwdevices) # prepare analog I/O info data structure self.model.HWData.aio_info = [None] * nr_of_devices # Cycle through all found MC hardware and assign the board numbers for device in self.model.HWData.allhwdevices: board_num = Serial2BoardNr[device.unique_id] # My table to assign board numbers to board IDs ul.create_daq_device(board_num, device) daq_dev_info = DaqDeviceInfo(board_num) self.model.HWData.devinfo.append(daq_dev_info) if daq_dev_info.supports_analog_input: self.model.HWData.aio_info[board_num] = daq_dev_info.get_ai_info() for channel in range(self.model.HWData.aio_info[board_num].num_chans): self.model.HWData.adchannels.append([board_num, channel]) ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADDATARATE, 1000) ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADCHANAIMODE, AnalogInputMode.SINGLE_ENDED)
Now I want to start the conversion when a GUI button is pressed which calls the following code:
rate = 0 points_per_channel = 1 ad_scan_options = ScanOptions.BACKGROUND | ScanOptions.CONTINUOUS | ScanOptions.SCALEDATA inputpowerchannels = [tuple[1] for tuple in self.model.HWData.devicechannelmapping] outputpowerchannels = [tuple[2] for tuple in self.model.HWData.devicechannelmapping] allpowerinchannels = inputpowerchannels + outputpowerchannels unique_adboardnumbers = list(set([tuple[0] for tuple in allpowerinchannels])) vcaoutputchannels = [tuple[0] for tuple in self.model.HWData.devicechannelmapping] unique_daboardnumbers = list(set([tuple[0] for tuple in vcaoutputchannels])) self.memhandle = [None] * (len(unique_adboardnumbers) + len(unique_daboardnumbers)) for cur_board_number in unique_adboardnumbers: ai_range = self.model.HWData.aio_info[cur_board_number].supported_ranges[2] channel_numbers = [tuple[1] for tuple in [item for item in allpowerinchannels if item[0] == cur_board_number]] low_chan = min(channel_numbers) # This is 1 high_chan = max(channel_numbers) # This is 12 num_chans = high_chan - low_chan + 1 # This is 12 for all AD boards total_count = points_per_channel * num_chans self.memhandle[cur_board_number] = ul.scaled_win_buf_alloc(total_count) # ul.a_load_queue(cur_board_number, list(range(num_chans)), [ai_range] * num_chans, num_chans) # This is not necessary, correct? actual_sample_rate = ul.a_in_scan(cur_board_number, low_chan, high_chan, total_count, rate, ai_range, self.memhandle[cur_board_number], ad_scan_options)
The actual_sample_rate in my case is give back as 51S/s for all boards.
Now some boards give back 0.0 on all 12 measured channels, no matter what the actual input voltage is. those boards are not always the same, especially if I unplug and re-plug the boards into the computer.
I also checked the status on the boards. both the working ones and the ones only giving 0.0 show the status as running. But the cur_count is only increasing on the working ones, whereas on the not working ones it stays zero. Also all the USB communication LED indicator lights are blinking no matter if it's a working board or a non-working one.
Any idea how I can fix this?
Thanks,
Michael
Link to comment
Share on other sites
1 answer 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