Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Start and Stop trigger

Hi folks,
I'm trying to make a triggered acquisition using a NI-MIO-16-X-E-10.
I want to provide a start and a stop trigger (digital PFI0 and PFI1 lines), and my acquisition should begin on the start trigger and end on the stop trigger and retrieve a buffered array of data (using the board memory).
I tried the Acquire-N-multi digital trigger.vi that is shipped with LabVIEW 6.1, but it does not work - the number of scans is constant and it should vary depending on the time between the triggers.

Thanks for the help
0 Kudos
Message 1 of 17
(6,334 Views)
Check out the example program linked below. It configures analog input acquisition to start on a digital trigger and stop on a digital trigger. The program is setup for the start and stop trigger to both come from PFI0, but you can simply change the trigger source string constant in the block diagram if you will be connecting your trigger signals to other PFI lines. I hope this helps.

Continuously Acquiring Analog Signals Using a Digital Start and Stop Trigger
http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CBB00111EE034080020E74861&p_node=DZ52308&p_submitted=N&p_rank=&p_answer=&p_source=Internal

Regards,

Todd D.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 17
(6,333 Views)
Hi Todd,

Thanks for you answer.
Unfortunatelly I could not follow the link you posted there. Can you send me the vi attached instead.

Regards
Paulo Martins
0 Kudos
Message 3 of 17
(6,333 Views)
Paulo,

Here is the VI as an attachment.

Regards,
Todd
0 Kudos
Message 4 of 17
(6,334 Views)
Todd, do you have this VI in a DAQmx version, or have a link that I can follow?  This is exactly what I need.
0 Kudos
Message 5 of 17
(6,041 Views)
mschmit,
 
In DAQmx the reference trigger can be used as a stop trigger.  The reference trigger establishes the reference point in a set of input samples. It allows you to acquire samples both before and after the trigger is received. The number of pretrigger samples to be acquired is set using the Pretrigger Samples input. The number of posttrigger samples to be acquired is automatically determined by subtracting the number of Pretrigger Samples specified from the number of Samples to Read specified.
 
You can  configure a reference trigger using the DAQmx Trigger VI. From the Polymorphic VI Selector, select Reference and the type. Wire the appropriate connectors to the terminals on the VI. They will change depending on the type of trigger you select.
 
A good example of this is Acq&Graph Voltage-Int Clk-Dig Start&Ref.vi, which you can find using the NI Example Finder.  Hope that helps.
 
Regards,
Raajit L
National Instruments
Message 6 of 17
(6,020 Views)
Hello, may I jump in?
 
just yesterday, I was asking me how to stop programatically an acquisition!
 
thanks for the responses already given (ans thanks for the question too Smiley Wink).
 
Now I know how to stop an acquisition with a digital trigger, but my problem is not yet solved:
 
With the mentionned example ("Acq&Graph Voltage-Int Clk-Dig Start&Ref.vi"), the number of points of the acquisition is always predefined (it is the "Samples per Channel").
I would like to have a variable length of acquisition: to start with a trigger, and to stop with an other trigger (or the same falling), and receive just the points between these two triggers. The number of points could be as well 2 points or 12345 points, just depending on the trigger timing! (OK, I understand that I must have a timeout or a buffer limit).
 
I hope you understand my question,
 
Many thanks for any suggestion!
 
Pierre-Alain
0 Kudos
Message 7 of 17
(6,018 Views)
This is exactly what I'm trying to do as well.  Start and stop trigger on the same digitial line.  First trigger starts, the second trigger stops...  However, I have an added twist.  I'd like to continuously record the data, i.e. every reference trigger will both start and stop acquisition. 

It would look like this:

trig       trig                   trig    trig                                        trig
|----ADQ---|----------ADQ---------|--ADQ--|---------------------ADQ-------------------|---


Obviously, the length of data acquired differs from one trigger to the next.  The trigger just defines the "block" of data in one sample.  I really have no idea how to implement such a re-triggerable acquisition like this.

Thoughts?

P.S. I'll be using this trigger scheme on two different pieces of hardware simultaneously. One M-series card, and the other an S-series card.  So I have to worry about synchronisation as well.


Message Edited by mschmit on 05-15-2007 05:15 AM

0 Kudos
Message 8 of 17
(6,014 Views)
I don't know which accuracy you must have with your start - stop.
 
Perhaps consider to do an continuous acquisition in a circular buffer; (Example "Cont Acq&Graph Voltage-Int Clk.vi"; I could send you a circular buffer if you want it).
 
Then you will "only" have to pick up the datas at the right place in your circular buffer.
 
Disadvantage of a such way is that you have to read the acquisition every... (10ms or 50ms), and store it in your circular buffer. It takes some CPU time, and in my application, I can not do it.
In addition, if you need the first 5ms of the next block of 50ms, you will have to wait for the 45ms rest (until the whole block is acquired). You may also loose a bit time here.
 
Hope this helps!
 
good luck,
 
Pierre-Alain
0 Kudos
Message 9 of 17
(5,998 Views)
Pierre and mschmit,

I will address your issues seperately.

Pierre :  Because you said that it would be okay for you to use the falling edge of your trigger signal to stop the acquisition you could use a pause trigger to accomplish this. With a pause trigger all that happens is only when the trigger line is high OR low, that is when your data will be acquired.  There is an example that you can use for this, called Cont Acq&Chart Samples- Int Clk-Pause Trigger.vi

With sample clock timing or burst handshake timing, the Pause Trigger pauses an ongoing acquisition or generation. Deasserting this trigger resumes an acquisition or generation. Depending on your device, there are some additional issues you need to remember.  There are discussed in more details in the NI-DAQmx Help under NI-DAQmx Device Considerations.

You could also use the reference trigger for this if you want this trigger to occur only once.  This is along the lines of my previous post.  Here is an example to accomplish that.

mschmit :
It seems like what you need is a random trigger that occurs and you want the reference at that point.  More like "markers" along the acquisiton of the data.  If this is not the case and you just want data to stop and start the pause trigger would be an option for you as well.  However, I was playing around with some other options and created an example program for you to implement "marker" triggers.

What I am using to implement this is a counter.  I am connecting the AI Sample Clock to the source and the Trigger to the Sample clock of the counter.  Below is a rough diagram to represent this better.



I have also attached my code that I got to work using this method.  One thing to note would be that a timeout error occurs when I stop the code because there is no rising edge on the  sample clock of the counter (also the trigger for the analog acquisiton) to latch the last values.

The code that I have attached gets an array of all the timestamps at which the trigger occurred.  You can now use this to sort through your acquired data.  You can use the attached code and modify it to your needs.

Hope all of this helps.

Regards,

Message Edited by Raajit L on 05-16-2007 04:36 PM

Raajit L
National Instruments
Download All
Message 10 of 17
(5,988 Views)