Hi could you help me please, after defining the channel how you can read and save the data for each inputs?
I need to read and save the inputs separately ,for example ai8 ,ai9 inputs in the SQL DB
Hy i try to use a USB 6008 with 8 channel but it doesn't work i used your model but it works for only one channel. when i change the Group BY Channel with Group by Scan Number it returns me 0 . And when i want to save the data i can save only from one channel. Can you help me?
My code is :
from PyDAQmx import *
from time import *
from xlwt import Workbook
# Declaration of variable passed by reference
taskHandle = TaskHandle()
read = int32()
data = numpy.zeros((2000,), dtype=numpy.float64)
sampleRate = float64(100.0)
samplesPerChan = uInt64(100)
#specifiy the channels
chan = "Dev1/ai0:1"
clockSource = "OnboardClock"
# DAQmx Configure Code
# DAQmx Start Code
# DAQmx Read Code
print "Acquired %d points"%read.value
except DAQError as err:
print "DAQmx Error: %s"%err
# DAQmx Stop Code
ofile=open('eggs.csv', 'wb') # as csvfile:
spamwriter = csv.writer(ofile, delimiter=',',quotechar='"', quoting=csv.QUOTE_MINIMAL)
for x in data:
I wrote this about 8 years ago so please forgive me as I'm working from memory 🙂
for 8 channels you need (on Device 1)
leave the Groupby as is
I would also check that you are really sending data on all channels.
Hope it helps