Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous data aquisition and picture display trouble

I'm a researcher at Northwestern University. I've set-up a system for use
with functional MRI. It's a behavioral test of memory. I've run into a snag
that I'm unsure how to remedy. The situation is this.

The basic task should proceed as follows. 1 trial consists of the presentation
of a fixed number of targets (3 for this example), then a memory period of
5 seconds, then the presentation of another sequence of targets (the same
or different targets, but equal in number), and finally a period of 2-3 seconds
where the subject pushes a "Yes" button to indicate that the two sequences
were identical, or a "No" button to indicate that the sequences were different
in some way. The trials are then arranged into blocks each containing 4 trials.
Blocks are seperated from each other by a down time (rest) of about 30 seconds.
In the fMRI scanner, I would like to have a series of blocks (trials....rest....trials....rest....trials....rest....etc)
Button presses are simple voltage signals within the TTL range of my DAQ
1200 card, thus I have them coming in through two digital ports. I can detect
these signals no problem.
I have made a picture drawing VI (GridVI) that uses 17 drawoval subVI's
to draw sixteen circular targets (a 4x4 grid) plus one fixation point in
the center of the grid. The input to the GridVI is a 1 dimensional numerical
array that contains a 1 or a 0 for each target. The 1 or 0 is translated
into a boolean variable that is then wired to the input to the "fill oval"
option for the drawoval VI. The drawoval subVI's are all contained with a
"For Loop" with an N or 1, such that it executes only once for each array
that is passed to it. In this fashion, by feeding a series of arrays to the
GridVI, I can selectively fill or unfill (flash) targets on the screen. In
addition, I have a "Wait until next ms multiple" timer within the For Loop
that controls the length of time of the flash (or so I thought, these timers
are part of the problem).
The reason I use numbers within the array instead of simply using a boolean
array is that I have an 18th row in the array which I use to control the
timing of portions of the task that aren't display portions (memory period,
response period, rest period). In a seperate VI that uses the GridVI as a
subVI, I have created a large, 2 dimensional array that contains the series
of 1 dimensional arrays that I feed to the GridVI. Within a While loop, I
have wired this large array such that it's columns are indexed by the iterations
of the While Loop, and feeds succesive 1 dimensional arrays to a Case Structure
contained within the While Loop. The Case Structure uses the 18th element
in each 1 dimensional array (a column of the large array) to select 1 of
5 possible cases:

0 = uses the GridVI to display one portion of a sequence (target on or target
off, depending upon the values of the other elements in that column)

1 = all targets are off, and the case contains a Wait (ms) timer that controls
the length of the memory wait

2 = changes the fixation point from blue to green, this indicates to the
subject that a button response is required

3 = same as 1, but controls length of rest time,

4 = same as 1, but controls length of response time.

thus a typical sequence of the 18th row in the array might look like this
if I had a sequence of three targets and I was doing only 1 block + 1 rest


0 0 0 0 0 0 1 0 0 0 0 0 0 2 4 0 0 0 0 0 0 1 0 0 0 0 0 0 2 4 0 0 0 0 0 0 1
0 0 0 0 0 0 2 4 3

My problem is that the timers in LabView don't allow me to check the button
press while they are executing. Thus, I can't aquire a button press during
the response period because the program is waiting for the timer to expire.
How do I control timing in a task like this while constantly monitoring the
button press. I need to know if either button is pressed at any time during
the task.

Any help would be great.
Thanks,
Dave Fraser
0 Kudos
Message 1 of 4
(3,222 Views)
Hi Dave,

Have you concidered putting the reading of the button states is a seperate loop that has its own timing? This seperate loop could set a LV2 style global to indicate the button has been pushed.

Ben
0 Kudos
Message 2 of 4
(3,222 Views)
Consider this:
Rather than connect your button to a digital I/O line, connect it to a counter source pin. In your program, set up the counter for simple event counting. Whenever you wish to check the state of the button, read the counter and compare it to the previous value. If the number has increased, the button has been pressed. In fact, if you read it and reset it after each read, you won't have to store the previous counter value (and you can measure the frustration level of the subject if they start pressing the button a lot!). If you want to read the present state of the button as well, connect it to both a counter and a DIO pin.
0 Kudos
Message 3 of 4
(3,222 Views)
Ben gave you the answer!
You can also make the two tasks running on separated vis and exchange data (button pressed) through the Vi-Server.
0 Kudos
Message 4 of 4
(3,222 Views)