Continuous DAQ with NI USB 6008 and DAQmx
Does anyone have any experience with continuous data acquisition using a NI-DAQ using the ctypes module to access the NI-DAQ family of libraries for NI instruments? I'm trying to use the "cookbook article" from here from SciPy which translates a sample C program for analog signal acquisition into Python.
I changed it to sample two channels continuosly by setting Code:
Dev1/ai0" HTML Code:
Dev1/ai0:1" I also then changed the clock timing to continuous samples HTML Code:
DAQmx_Val_ContSamps I can obtain finite samples fine, however, if I change to "ContSamps", then my data values are read as zero. If I go back to "FiniteSamps", and then use a timer, I typically only get one or two repeated data arrays, and then nothing else happens. Typically nothing else will happen after the "after stark task" print statement. I will include all of my code in the hopes that others can benefit off of it because I think this would be a common task, and I have not found any similar complete code elsewhere. HTML Code:
import ctypes |
If I run a while loop (to obtain my DAQ data), the maximum number of times the loop will run is 4. After 4 times, "after start task" is displayed, but then nothing else. Therefore, it seems every time the loops gets stuck on the read function.
Any ideas? I continue to move around what's inside of the function obtain_value, as well as change # of samples and sampling frequency. Here is the code I'm referring to: Code:
def obtain_value(): |
I found I could obtain continuous sampling after I downloaded the newest NI MAX driver from NI. Furthermore, I discovered NI I/O (previously called NI Spy). This is an invaluable tool for obtaining real-time information of what your DAQ is doing.
|
All times are GMT -7. The time now is 05:34 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC