Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering NI9263 card (Voltage Output) with NI9239 (Voltage Input) on cDAQ-9174

Solved!
Go to solution

Hello all,

I am at a bit of a loss using the "DAQmx Triggering.vi" to trigger voltage output with the NI9263 card by detecting a certain level of analog voltage on the NI9239.

So far, I have just used a case structure:example.png

However, I would like to use Analog Hardware Triggering like on this page (example below): https://www.ni.com/en/support/documentation/supplemental/21/ni-daqmx-data-acquisition-triggering-tec...

Analog_Start_Triggering_in_LabVIEWIn the example above, I believe it starts recording data once the threshold is reached, however, I would like to be recording the voltage the entire time and once the threshold is reached, stop the voltage acquisition and then generate voltage output. Thank you!

0 Kudos
Message 1 of 11
(4,716 Views)

Hi Gryffin

 

Try to check this document, more specific section 2: Star Trigger Synchronization. I will look for more info and let you know if I found something.

 

Regards, 

Astromaut

 

0 Kudos
Message 2 of 11
(4,671 Views)

I have looked at that page extensively to no avail. Is analog triggering even possible with the NI9263 (Voltage Output) C-series card?

I do not need to synchronize the acquisition and generation to start at the same time, rather, I need the acquisition to be occurring and then trigger the voltage output when the analog input signal reaches a certain threshold.

 

The task at hand is that I am using the NI9239 (Analog voltage input) card to monitor the voltage across a sample whose current is steadily rising. When the voltage across the sample is at a certain level, I would like the NI9263 (Analog Voltage Output) to be triggered and send out a voltage to shutdown the power supply.

 

I have successfully done this with software in labview, however, it takes about 40 milliseconds for the software to send the output voltage to shutdown the supply, I would like to minimize this time using hardware triggering if possible.

0 Kudos
Message 3 of 11
(4,664 Views)

I know what I'd do with a desktop board that supported analog triggering but I don't know the cDAQ product line well enough to know if the same can be done there.

 

I'd configure an AI task with appropriate analog triggering settings.  I'd then configure a 1-sample finite AO task to use the "...ai/StartTrigger" signal as its sample clock.   Start the AO task first, then start the AI task and when the triggering conditions occur, the "...ai/StartTrigger" signal will assert in hardware and the AO value will be generated immediately.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 4 of 11
(4,660 Views)

What do you mean "Configure an AI task with appropriate analog triggering settings"?

How do you specify in the Triggering.vi what is the analog source (it asks for a string)?

Can you provide an example or elaborate further?

0 Kudos
Message 5 of 11
(4,651 Views)

Hardware-based analog triggering is not possible with the NI 9239 as input.

 

Currently the only C Series analog input modules that support hardware triggering are the NI 9205, NI 9206, and NI 9775. (This information can be interrogated with the Triggering.Analog Triggering Supported device property node.)

 

You would have to either use a software-based approach, or add an external circuit that provides a digital edge into a parallel digital module (or a chassis PFI, but the cDAQ-9174 does not have any) to be used as a start trigger.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 6 of 11
(4,643 Views)

Thank you for your help! One last question, if I did acquire the NI-9775, would the NI-9263 be able to receive the hardware trigger or would another voltage output model be required?

0 Kudos
Message 7 of 11
(4,638 Views)
Solution
Accepted by topic author Gryffin

Yes. You have to configure the trigger on the AI task, and then import the trigger on the AO task. Here's a quick example. (Disclaimer: I've only tried this with a simulated NI 9775 and NI 9263, and not real hardware).

 

9775-as-trigger-for-9263.png

In this example, I configure a rising-edge analog trigger on the AI task, then query its Start.Term[1] property to be imported on the AO task. The AO task is loaded with the data to be written, with a configured start trigger so that it will wait on the AI task's StartTrigger. We start the AO task first (so that it's ready to receive the start trigger) and then the AI task (which will generate the start trigger), then just wait for everything to complete. In this example, we never read from the AI task, because we don't care about the data at all-- we just care that the hardware observes the trigger condition.

 

You'll probably have to play around with it (at least you'll probably want a AO waveform that's not 1000 samples of zeros!), but I think that's the general flow you'd be looking at.

 

[1] On cDAQ, this does require explicitly reserving or committing the task to retrieve that property because it has multiple timing engines, although I could have also explicitly chosen one with the SampTimingEngine timing property.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
Message 8 of 11
(4,605 Views)

So in this example you've provided, it seems that the AO task will just start when the AI task has started, however is it possible to have the AO task be triggered by a certain level of analog input? i.e. Can I use an analog trigger with the AO task?

 

I am trying to configure it so that the AO task runs once a certain level of analog input is detected

 

Basically:

1) Continually reading AI task input

2) Once AI task input reaches 1V, stop the AI task and trigger the AO task

 

How would I go about implementing that?

 

0 Kudos
Message 9 of 11
(4,588 Views)

If your question is "can I set an AI analog trigger directly on the AO task" the answer is no. The analog comparator from the AI module connects to the AI timing engine, so you can only get at it through the AI timing engine. That's what I've done in the above example-- I configure the AI task with the appropriate settings as a start trigger condition, and then I export the AI StartTrigger event[1] to the AO timing engine.

 

Unfortunately, the way in which I connect them in that example doesn't allow you to read and process the input data, and so if you need to also read and process the input data I don't see a way around that using hardware-based triggering.

 

You can only have one AI task per module, so that rules out having an AI task purely to function as a trigger and an AI task for reading the data.

 

The Analog Comparison Event[2] might be an option, but it's not possible to configure the analog comparator without also configuring an analog trigger, but configuring a Start or Reference trigger on your AI task will prevent you from reading data until the trigger condition has occurred. A pause trigger might work, but the NI 9775 does not support pause triggers[3]. (The NI 9205 and 9206 do, however. Other ) A pause trigger would also pause your AI acquisition while the condition is met, although you've expressed a desire to "stop the AI task" so perhaps that's not actually a detriment here.

 

There's also the possibility of moving to CompactRIO, where you can implement your own custom datapath triggering with LabVIEW FPGA (and any AI module, since you'd be building your own comparison circuit in the FPGA). That may be a rather large jump, though.

 

Looking back on your original, software-based approach: you might also be able to reduce the software overhead time by calling DAQmx Start on your AO task before entering your loop. In the DAQmx Task State model, when you create your on-demand AO task, it is in the "Unverified" state. Calling DAQmx Write on it causes the driver to advance the task (implicitly) into the running state, then unwinds it back. By calling DAQmx Start beforehand, you will have explicitly set the task into the "Running" state and so DAQmx will not automatically unwind it. You'll still have software processing latency between reading AI and writing AO, but it may be possible to shave down that "about 40 milliseconds" number slightly.

 

[1] with no other tasks running, the Start.Term property will return "/cDAQ2/ai/StartTrigger".

[2] among the "Advanced Terminals", this would show up as "/cDAQ2ModN/AnalogComparisonEvent".

[3] the NI 9205 and 9206 can support configuring their analog comparator as a pause trigger. Most other C Series modules, including the NI 9239, support pause triggering as well, but only with a digital source. The NI 9775 appears to be somewhat unique in not supporting pause triggers.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
Message 10 of 11
(4,564 Views)