Jump to content

daya

Members
  • Posts

    1
  • Joined

  • Last visited

daya's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Hi, I am a new user for MCCDAQ USB-1608FS PLUS. Currently i am in middle of project which using a sensor, adc(MCCDAQ USB-1608FS PLUS) and also raspberry pi 4. I have installed uldaq library for calling mccdaq into my coding. I want to use a_in_scan in order to collect real time data with 100ks sampling rate. Im having issue on this a_in_scan which give me result error displaying: ------------------------------------------------------------- Traceback (most recent call last): ai_device.a_in_scan(0, 0, AiInputMode.SINGLE_ENDED, Range.BIP10VOLTS, samples_per_channel, rate, ScanOption.DEFAULTIO, AInScanFlag.DEFAULT, buffer) File"", line 129, in a_in_scan raise ULException(err) uldaq.ul_exception.ULException: ULError.NO_CONNECTION_ESTABLISHED: No connection established -------------------------------------------------------------------- The mccdaq is connected well. Few coding without using a_in_scan can be run smoothly. But i need to use a_in_scan because i need the data to be collected within 100ks sampling rate. I attached my full coding. --------------------------------------------------------------------------------------------------------------------------------------- import datetime from uldaq import (get_daq_device_inventory, DaqDevice, InterfaceType, AiInputMode, Range, ScanOption, AInScanFlag, create_float_buffer) # Configure DAQ device ----------------------------------------------------- devices = get_daq_device_inventory(InterfaceType.USB) if len(devices) == 0: print('No USB-1608FS-Plus device found') exit(1) device = devices[0] daq_device = DaqDevice(device) ai_device = daq_device.get_ai_device() ai_info = ai_device.get_info() # Configure analog input channel ------------------------------------------ channel = 0 # Configure sampling ------------------------------------------------------- # scan_options = AInScanFlag.Default rate = 5000 # Sampling rate in samples per second num_channels=1 samples_per_channel = 100000 # Number of samples per channel to collect buffer=create_float_buffer(num_channels,samples_per_channel) # Start data acquisition --------------------------------------------------- ai_device.a_in_scan(0, 0, AiInputMode.SINGLE_ENDED, Range.BIP10VOLTS, samples_per_channel, rate, ScanOption.DEFAULTIO, AInScanFlag.DEFAULT, buffer) while True: current_time = datetime.datetime.now() # Read available data data = ai_device.a_in_scan_read(samples_per_channel) print('Time:', current_time, 'Voltage:', data) ---------------------------------------------------------------------------------------------------------------------------------------- Hope you can help. Thank you!
×
×
  • Create New...