07-23-2010 09:32 AM
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.
07-23-2010 10:12 AM
forget to mention that I am using LabVIEW 2009
07-23-2010 10:25 AM
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.
07-23-2010 10:49 AM
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.
07-23-2010 11:52 AM
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.
07-23-2010 01:50 PM
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.
07-23-2010 02:07 PM
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.
07-27-2010 01:56 PM
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.
07-27-2010 02:08 PM
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