11-29-2011 10:15 AM
Hello LV fans,
I am faced with (what I thought would be) a trivial task:
I am acquiring some analog signals on an NI-USB 6351 using DAQmx. And I want to simultaneously trigger an external device. So when my AI task starts, I want a digital output pin to go HIGH. And when it stops, I want the pin to go LOW.
I actually thought that NI provided a "built-in" signal for this ... something I could easily route to one of the PFI pins. Like an "AI Busy" signal. But it doesn't appear this exists.
So instead, I thought I could do a "Simultaneous AI and DO" task. This works well, except that the pin stays HIGH when the tasks end.
Any ideas on how I can solve this?
Solved! Go to Solution.
11-29-2011 11:32 AM
Not really my area of expertise, but the manual for that device suggests that you can route the AI Sample Clock to an output pin. I think that's the signal you need. Alternatively you could set up some other source (even a DO pin on the same device) as your AI Trigger, and also feed that signal to the other device.
11-29-2011 12:23 PM
Hmmm. I don't think the sample clock will work because it is a pulse train. It goes HIGH/LOW for every datapoint acquired. I actually want the signal to remain high during the entire acquisition.
I think you are right about using a DO pin. But I am confused how to implement it in LabVIEW.
11-29-2011 12:29 PM
@josborne wrote:
Hmmm. I don't think the sample clock will work because it is a pulse train. It goes HIGH/LOW for every datapoint acquired. I actually want the signal to remain high during the entire acquisition.
I think you are right about using a DO pin. But I am confused how to implement it in LabVIEW.
I think I've misunderstood what you mean by an acquisition, then. I thought you just meant a single point. Are you saying you're going to acquire a fixed number of samples and you need the trigger to remain high until it finishes the entire series of points?
As I mentioned, I'm not an expert in signal routing, so there's probably a more efficient way to do this, but at the most simple you could take a signal from a digital output pin and split it with one end going to the external device and the other end going to the AI Trigger input (this can probably be done in software, but I don't know if you can split the signal in that case). Configure separate DO and AI tasks, no need to synchronize them. When you start the DO, the AI will trigger. Then you just need some way to turn off the DO when the AI completes - but is that part also time-critical? If you don't need precise synchronization on that end then just wait until the AI completes, then turn off the DO.
11-29-2011 12:36 PM - edited 11-29-2011 12:42 PM
Thaks for the tips.
To clarify: I actually want to do continuous AI acquisition (stop when I press a button on my front panel). And have a digital pin HIGH while the AI task is acquiring data.
>>you could take a signal from a digital output pin and split it with one end going to the external device and the other end going to the AI Trigger input
>>(this can probably be done in software, but I don't know if you can split the signal in that case).
Hmmm. Yeah, that'd probably work. But I really don't want to physically wire a DO pin to one of the PFI pins (for the AI trigger). Long story. But it is because this system will be used in multiple modes, and I'd prefer not have to leave that hardwired.
11-29-2011 12:43 PM
@josborne wrote:
OK, after thinking about it, I realize I could probably use a DO pin (such as P0.0) as my START and REFERENCE trigger for an AI task. But that would require physically connecting P0.0 to one of the PFI pins, which I don't want to do. Right?
That's what I was thinking, but I don't see anything in the DAQmx configuration that prevents you from using a DO as the Start Trigger Source - try it out and see if you get an error.
11-29-2011 12:48 PM
Sorry. Editted my post while you were replying. But I think we're on the same page.
I will try this out. I can't seem to wire a DO as an input to "DAQmx Trigger.vi", but I'll work on it. I think your suggestion is the way to go.
11-29-2011 01:32 PM
Got it!
I was able to do just like you suggested. The challenge was that I couldn't seem to wire a physical channel (e.g. a digital output like P0.0) as an input to the "DAQmx Trigger.vi". but I guess you don't really need to. Apparently PFI0 and P1.0 are the same thing. So I can output my digital signal to P1.0 and have my AI task trigger from PFI0. It appears to wkr great!