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:
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.
# 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)
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)
Question
daya
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!
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