LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to acquire the MR triggering pulse

I write a vi that required to acquire an MR triggering pulse to start (sync with the MR scanner). The general triggering pulse from the MR is 50 microseconds; and can be extended up to 500 microseconds. I am using USB-6221 digital port to acquire this pulse. However, it doesn't seem to catch this pulse. Would it be the hardware problem? I attached my vi; maybe I did something wrong in the vi.

0 Kudos
Message 1 of 9
(3,067 Views)

forget to mention that I am using LabVIEW 2009

0 Kudos
Message 2 of 9
(3,055 Views)

Where are you acquiring this pulse?  I only see one digital read subVI in the initial frame of your program (the subVI's are missing...)  After that, I only see digital write VI's.

 

 

Please make sure you show the labels for all of the terminals on your block diagram as a matter of good programming practice.

(Also, you don't need the case structure that only has a True constant in the True case and a False in the False case.  That is a Rube Goldberg.  Just wire from the >0 comparison to the stop button and indicator.

0 Kudos
Message 3 of 9
(3,049 Views)

I am acquiring this pulse in the digital read subVI. I just need one pulse and start the rest of the vi. I redid the vi and also attached the read and write vi too.

Download All
0 Kudos
Message 4 of 9
(3,043 Views)

Then what is actually generating the pulse you are trying to read?

 

Don't create and kill a DAQ task over and over again in the subVI's.  That will take time.  If your pulse is too short and your loop iteration is too long (which might be because of constantly creating and killing the task), then it's possible you just completely miss it unless you get lucky and the pulse is going on at the instant the code gets to the DAQ read 1 sample

 

Tasks should be created before of a loop, read in the loop, and killed after the loop.  You may even want to do continuous acquisition, or at least N samples so that you get more than one instant of data for which you can then search for the pulse.

0 Kudos
Message 5 of 9
(3,036 Views)

The actual pulse is generated by the MR scanner. When it starts to scan, it will generate a trigger pulse (50 to 500 microseconds pulse width and 5 volts in amplitude). I think the program is continue acquiring  and not only reading 1 sample.

 

How do I create the task before a loop, read in the loop, and killed after the loop? All I need is to read this trigger pulse once to start the rest of the vi. I don't really know what I should do to make it works.I appreciate your help.

0 Kudos
Message 6 of 9
(3,029 Views)

No, it isn't continually acquiring.  It is acquiring just one sample at a time.  Look inside your Read SubVI.  It happens to be doing this repetitively in a loop.

 

What you need to do is get of the subVI's.  Do the actions that are in the subVI, but broken up befoe, in, and after the loop.  Loop in the example finder for DAQmx examples for continuous acquisition.

0 Kudos
Message 7 of 9
(3,026 Views)

Hi Raven Fan

 

I did modify the vi. How short should I set the delay in the while loop? Since the triggering pulse width is very short, I don't know if 10ms is still too long. Thanks for the help.

0 Kudos
Message 8 of 9
(2,973 Views)

Simple math: You must read a sample often enough to get a sample when the shortest trigger pulse (50 us) is high.  That means you must sample with a delay of less than 50 us.  Since the shortest delay you can set in software is 1 ms = 1000 us > 20 times your short pulses, you will rarely succeed to capture a trigger with software timed acquisition.  This is why Ravens Fan has been encouraging you to do hardware timed continuous acquisition.

 

Lynn

Message 9 of 9
(2,961 Views)