ALR723 Posted June 7, 2023 Share Posted June 7, 2023 InstaCal communicates successfully but not via python driver code. e.g. daq.debug_led() returns error incapable of blinking led. Appreciate any insight in troubleshooting the issue. Thank you. Link to comment Share on other sites More sharing options...
0 DAQman Posted June 7, 2023 Share Posted June 7, 2023 Hello, The USB-1616HS series device does not have a flash led function. Best regards, John ALR723 1 Link to comment Share on other sites More sharing options...
0 ALR723 Posted June 8, 2023 Author Share Posted June 8, 2023 Thank you John for your prompt reply. To explain the issue we are facing further, the device randomly reports incorrect state such as that it is incapable of any analog-in gain ranges. A power cycle doesn't seem to reset the error either. Here is an example code that shows what is the expected (normal operation) output and output when board is in a bad state. if __name__ == "__main__": serial_number = "Board USB-1616HS-4 SERIAL NUMBER" for i, descriptor in enumerate(ul.get_daq_device_inventory(InterfaceType.USB)): if serial_number == descriptor.unique_id: # Check that the board has been created board_num = i # Update the descriptor board_descriptor = descriptor board_info = DaqDeviceInfo(board_num) ai_info = board_info.get_ai_info() ao_info = board_info.get_ao_info() print(f"{board_info.supports_analog_input=}") print(f"{ai_info.supported_ranges=}") print(f"{ai_info.supported_scan_options=}") #Normal operation output: #board_info.supports_analog_input=True #ai_info.supported_ranges=[<ULRange.BIP10VOLTS: 1>, <ULRange.BIP5VOLTS: 0>, <ULRange.BIP2VOLTS: 14>, <ULRange.BIP1VOLTS: 4>, <ULRange.BIPPT5VOLTS: 6>, <ULRange.BIPPT2VOLTS: 13>, <ULRange.BIPPT1VOLTS: 7>] #ai_info.supported_scan_options=<ScanOptions.RES_BLOCK_IO|HIGHRESRATE|EXTTRIGGER|DMAIO|CONVERTDATA|EXTCLOCK|CONTINUOUS|BACKGROUND: 1075855439> #Bad state output: #board_info.supports_analog_input=True #ai_info.supported_ranges=[] #ai_info.supported_scan_options=<ScanOptions.RES_BLOCK_IO|HIGHRESRATE|EXTTRIGGER|DMAIO|CONVERTDATA|EXTCLOCK|CONTINUOUS|BACKGROUND: 1075855439> Link to comment Share on other sites More sharing options...
0 DAQman Posted June 8, 2023 Share Posted June 8, 2023 Hello, Your serial number looks suspicious. It should be a six-digit number, like 324534. I've run the following (mcculw) script many times and haven't seen it misfire. Please give it a try - see attachment. Best regards, John from __future__ import absolute_import, division, print_function import time from builtins import * # @UnusedWildImport from time import sleep from ctypes import cast, POINTER, c_double, c_ushort, c_ulong from mcculw import ul from mcculw.enums import ScanOptions, FunctionType, Status from mcculw.ul import ULError, a_input_mode from mcculw.enums import InterfaceType from mcculw.device_info import DaqDeviceInfo from mcculw.enums import ULRange from mcculw.enums import AnalogInputMode use_device_detection = True def run_example(): board_num = 0 board_index = 0 find_device = "USB-1616HS" if use_device_detection: board_num = -1 ul.ignore_instacal() dev_list = ul.get_daq_device_inventory(InterfaceType.USB) if len(dev_list) > 0: for device in dev_list: if device.unique_id == "324534": # serial number # if find_device in str(device): print(f"Found {find_device} board number = {board_index}") print(f"Serial number: {device.unique_id}") print(f"Product type: {hex(device.product_id)}") board_num = board_index ul.create_daq_device(board_num, device) device_info = DaqDeviceInfo(board_index) a_info = device_info.get_ai_info() print(f"Supports AIN {device_info.supports_analog_input}") print(f"Supports AOUT {device_info.supports_analog_output}") print(f"Supports DIO {device_info.supports_digital_io}") print(f"Supports COUNTERS {device_info.supports_counters}") print(f"Supports Temperature {device_info.supports_temp_input}") print(f"Supported Ranges {a_info.supported_ranges=}") print(f"Supported ScanOptions {a_info.supported_scan_options=}") board_index = board_index + 1 if board_num == -1: print(f"Device {find_device} not found") return else: print("No devices detected") return # **********End of Discovery************ rate = 1000 points_per_channel = 1000 low_chan = 0 high_chan = 3 num_chans = 4 total_count = points_per_channel * num_chans half_count = int(total_count / 2) scan_options = ScanOptions.CONTINUOUS | ScanOptions.BACKGROUND memhandle = ul.win_buf_alloc(total_count) buf_data = cast(memhandle, POINTER(c_ushort)) # Check if the buffer was successfully allocated if not memhandle: print("Failed to allocate memory.") return try: # Start the scan ul.a_in_scan( board_num, low_chan, high_chan, total_count, rate, ULRange.BIP10VOLTS, memhandle, scan_options) # Create a format string that aligns the data in columns # plus two for curr_index and curr_count row_format = "{:8}" * (num_chans + 2) # Print the channel name headers labels = [] for ch_num in range(low_chan, high_chan + 1): labels.append("CH" + str(ch_num) + "\t") labels.append("index\t") labels.append("count") print(row_format.format(*labels)) # boolean flag used to toggle reading upper and lower buffer read_lower = True # Start updating the displayed values status, curr_count, curr_index = ul.get_status( board_num, FunctionType.AIFUNCTION) while status != Status.IDLE and curr_count < 50000: # Make sure a data point is available for display. if curr_count > 0: # curr_index points to the start of the last completed # channel scan that was transferred between the board and # the data buffer. Display the latest value for each # channel. # display_data = [] if (curr_index > half_count) and (read_lower == True): ul.win_buf_to_array(memhandle, buf_data, 0, int(half_count)) # print one line to show it is running print( '{:d}\t {:d}\t {:d}\t {:d}\t {:d}\t {:d}'.format(buf_data[0], buf_data[1], buf_data[2], buf_data[3], curr_index, curr_count)) last = curr_count read_lower = False elif (curr_index < half_count) and (read_lower == False): ul.win_buf_to_array(memhandle, buf_data, int(half_count), int(half_count)) # print one line to show it is running print( '{:d}\t {:d}\t {:d}\t {:d}\t {:d}\t {:d}'.format(buf_data[0], buf_data[1], buf_data[2], buf_data[3], curr_index, curr_count)) read_lower = True sleep(0.1) status, curr_count, curr_index = ul.get_status( board_num, FunctionType.AIFUNCTION) # Stop the background operation (this is required even if the # scan completes successfully) ul.stop_background(board_num, FunctionType.AIFUNCTION) print("Scan completed successfully.") except ULError as e: util.print_ul_error(e) finally: # Free the buffer in a finally block to prevent errors from causing # a memory leak. ul.win_buf_free(memhandle) if use_device_detection: ul.release_daq_device(board_num) if __name__ == '__main__': run_example() a_in_scan_USB_1616HS.txt Link to comment Share on other sites More sharing options...
Question
ALR723
InstaCal communicates successfully but not via python driver code.
e.g. daq.debug_led() returns error incapable of blinking led.
Appreciate any insight in troubleshooting the issue. Thank you.
Link to comment
Share on other sites
3 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