04-28-2013 03:23 PM
Hi All,
I'm putting together an fMRI experiment based on a published result. I am using the same hardware/software as the original experimenters but would like to write my own USB-6211 VI so that we can go beyond what was done before. I am familiar with writing drivers in many procedural languages for real time control.
My previous LabVIEW (LV) experience was several months of work with an evaluation copy I installed on my brand new Mac SE. After working for the past many weeks with v2012 on a Dell OPtiplex 9010 (i5 3475S) with Windows 7 Pro, I see the package has become a bit more complicated since my last foray. I have the Full Development System as well as Real Time Module and DAQMX that shipped with the card.
The experiment I am writing will have a defined periodic waveform for ao0, right now a square+sine wave (squine), which I want to turn on T1 seconds after a TTL synchronization trigger is received and play for T2 seconds, stop (go to zero volts) for T3 seconds, and repeat the ON-OFF, T2-T3 sequence N times, and finally go to zero volts for T4 seconds and then end the experiment at zero volts. The total experiment will last a few hundred seconds to several hundred seconds.
Cancel/abort/emergency stop should set the output to zero volts.
The repeating waveform will not necessarily have an integer number of cycles within the “ON” time so a medium term plan is to add a shortened version at the beginning or end of each T2 to smooth the transition to zero volts. This smoothing is not required for the initial testing of the system.
My goal for this experiment is to have the signals synchronized to better than 1 millisecond from the synchronization signal. We can receive and analyze/log subsequent synchronization signals every 2 seconds (once a TR, if you are familiar with fMRI). The synchronization signal is from the 25 MHz scanner clock and is accurate to 400 nanoseconds (lowered accuracy and precision due to external electronics). This less than 1 msec precision seems to mean no USB bus communication between trigger and sequence start.
I have read over several “getting started” tutorials as well as the other recommended online training – not anywhere near all that is available, but many hours of study. I have also combed the boards and appreciate the fact they are available for searching.
What I am looking for in this question is any recommendations for proceeding forward with training and/or examples of writing of a similar VI… and I guess I “project” as well eventually(?), and useful as well, to ward me off programming directions that will be fruitless.
What I have concluded now is that I need to learn more about using the functions in DAQmx. I have gone over the 10 Functions You Need to Know tutorial.
The two approaches I see right now are to store the squine waveform in the FIFO and try and program the 6211 to regenerate it or output zero volts based on onboard counters and timers, or to construct the whole waveform (zeros and squines repeating) in software, split it into chunks in a waveform array, and then dump the array into the buffer one element at a time and let DAQmx handle the transfer to FIFO. The timing in the latter scenario would then start at a PF0 trigger receive, an initial delay, and the card internal clock can play out the waveforms and zeros. I would just need to make sure the buffer is filled with the next chunk of data well before the FIFO empties. I was thinking of running at 500 Hz or 1 kHz sample rate.
I attach the state of my VI right now which has been limited to constructing the squine waveform from panel inputs and trying to play it out on the card using DAQ Express. I was able to construct the waveform, but the downloading to the card is trickier than I thought.
Again, any comments would be helpful and appreciated, especially if I am missing some example that does this (fairly easy?) experiment through an Express or existing example.
Cheers,
Rich
LabVIEW 2012 SP1
Real Time Module
USB-6211
04-29-2013 12:20 PM
Hi Rich,
My name is Basil and I work in Applications Engineering at National Instruments. You might try to use this VI to get you started (http://zone.ni.com/devzone/cda/epd/p/id/1719), it has a good functionality for creating a square wave and sine wave and outputting them on the FIFO buffer in hardware. You can easily modify it to create a sine and square and add them to create the squine wave. Concerning the triggering and synchronization, there are a lot of examples in help that can guide you in that, it is a matter of starting the slave task before the master task using a sequence structure and having the slave task waiting on the master task to start.
Regards,
Basil Beirouti
Applications Engineering
National Instruments