LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Trigger DAQmx Trigger

Hi All

 

So I am relearning labview and I am trying to do something I am not sure I can do.

I have a NI USB 6210 and I have my triggers setup and they work fine.

What I want is to have a button on the front panel that allows me to trigger via the user interface, in addition to the hardware triggers.

 

I could define different run modes (one hardware and one via the front panel) and handle this programmatically, but I would think i could just set the trigger directly..

 

Is there some reason this cannot be done?

I cannot seem to find any relavent examples.

 

Thanks

0 Kudos
Message 1 of 6
(2,787 Views)

As a follow on question. How would one get pre-trigger data, if there wasn't an actual hardware trigger? (AKA pretrigger data when a front panel button is pressed.)

 

I found the attached example using queues but there just seems like there should be an easier way...

0 Kudos
Message 2 of 6
(2,779 Views)

What are you using each triggering case for?

0 Kudos
Message 3 of 6
(2,734 Views)

General data analysis of a signal.

In the real runtime it will be part of an automated process.

For testing I could see wanting to manually manipulate the transducer, and have a way to capture that.

There are other ways, like wiring up a button or something else.

But writing a totally different capture routine with queue'ing, seemed like alot just to have a way to kick of the trigger from the gui.

 

0 Kudos
Message 4 of 6
(2,732 Views)

There isn't a way to generate a software trigger unfortunately.  There are a few ways you could get the behavior you need though.

 

I think the easiest way would be to do something like this:

 

1.  Configure a spare counter for single pulse generation triggered by your external signal.

 

2.  Configure the AI task to use the counter's internal output as its trigger.

 

3.  Start the AI task then the counter task--at this point you would be able to trigger from the external signal like you are doing now.

 

4.   If and when you want to issue the software trigger, stop the counter task, set the trigger type to "none", then re-start it to generate the trigger yourself (the few ms of delay *shouldn't* be an issue for a software trigger such as this).

 

 

Alternatively, you could read the pre-trigger samples.  When you configure a reference trigger the data is streamed continuously to a buffer in memory which you can read from as long as the requested data hasn't been overwritten.  Your "software trigger" would consist of setting the DAQmx Read RealativeTo property to Most Recent Sample with the desired offset and number of samples.  Change it back to First Pretrigger Sample when you are done to go back to waiting for the hardware trigger.

 

I'm not sure where that example you posted came from but I don't understand the purpose of the queue when DAQmx already incorporates a circular buffer...

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 6
(2,716 Views)

Thanks for the response.

Just glad to know i wasn't missing something.

0 Kudos
Message 6 of 6
(2,696 Views)