Buffered Digital Input to a FIFO
Dan Feldman
I'm trying to performed buffered digital input to a FIFO in Igor 5, using a NI PCI-6259 card
and NIDAQmx. This is on a PC running Windows XP.
Using the DAQmx_DIO_Config command, I can successfully configure a digital port for
input, and read to a wave. However, when I try the identical DIO_Config command, but
set to read to a FIFO, rather than a wave, I get the error "Cannot Use a FIFO as the data
source for an output operation". So Igor seems to think I'm trying to output to the DIO
port, even though I have it set for input using /DIR=0. (I get no such error when reading
to a wave.)
Anyone have any advice, or example code that works?
--Dan Feldman
My code is:
string/g devicename = "dev2"
variable/g DIOTaskNum
Function TestFIFO()
NVAR DIOTaskNum = DIOTaskNum
SVAR devicename = devicename
string clocksource
clocksource = "/"+devicename+"/ctr0internaloutput"
NewFIFO DigInFIFO
NewFIFOChan/D DigInFIFO, chan9, 0, 1, -5, 5, "v"
CtrlFIFO DigInFIFO, deltaT=0.01 // 10 ms
CtrlFIFO DigInFIFO, size = 1000 // 1000 samples = 10 sec
CtrlFIFO DigInFIFO, start
DAQmx_DIO_Config/DEV=devicename/CLK={clocksource,1}/DIR=0/LGRP=0/FIFO=DigInFIFO/RPTC=0 "dev2/port0/line9"
DIOTaskNum = V_DAQmx_DIO_TaskNumber
Start_Clock(0.01, 1000) // start acquisition at 10 ms sample interval, 1000 samples.
End
Function Start_Clock(the_isi, numpulses) // This procedure starts Counter 0 at the specified ISI, for the specified # of pulses.
variable the_isi // in seconds
variable numpulses
SVAR devicename = devicename
DAQmx_CTR_OutputPulse/DEV=devicename/TICK={10,((the_isi*100000)-10)}/TBAS=("/"+devicename+"/100KhzTimebase")/IDLE=0/NPLS=(numpulses)/STRT=1 0
End
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 10, 2008 at 03:38 pm - Permalink