Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering of NIDAQ board

Hi All

Is there any possiblity in Labview for acquiring data with NIDAQ card such that  the program is running continuously and at one trigger the board start taking the data and at another trigger it stops and this keeps going until i stop the program. Kindly give me your suggestions.

Regards
Chauhan
0 Kudos
Message 1 of 8
(4,131 Views)
I don't think that DAQmx supports a Stop Trigger as such.  The closest I can find is an example that pauses the acquisition with a digital level.  See the example named


Cont Acq&Chart Samples-Int Clk-Pause Trigger.vi


You can start with this and add a Start Trigger to it.
Randall Pursley
0 Kudos
Message 2 of 8
(4,127 Views)

Chauhan,

I had to do exactly what you want to do several years ago, and could not find any NI DAQ board that could handle such.  I ended up building a very small circuit that consisted of a J-K flip flop (M74HC73) that would set/clear the output when either pulses trigger.  I then used this output to gate the A/D sampling clock, and it worked just as I wanted Smiley Happy  BTW, don't forget to "debounce" your trigger inputs.

0 Kudos
Message 3 of 8
(4,115 Views)

Hello Chauhan,

 

There are a couple of different options to implement this type of acquisition depending on what hardware you have.

 

If you have a card with analog triggering you can use an analog window trigger to do this, but you'd need to modify your triggering signal.  The way an analog window trigger works is that the task will only acquire when the voltage input on your analog trigger line is within a range that you set.  For instance if you can have a trigger pulse that is 3 volts when you want to acquire and 0 volts otherwise then this would be a good option.  This type of trigger does not use rising edges though, so if you need to trigger with rising edges you'll need to use a different option.

 

If you have a M-Series card or a card that supports stop and reference triggers then you can follow the instructions in this KnowlegeBase article:  How Do I Use a Digital Trigger in LabVIEW to Start and Stop Acquiring Data?  There is an example program that you can look at as well.

 

These would be the easiest two methods, but if neither of these are an option for you it'd be helpful to know what hardware you're using so we can see if there's another option.

 

Have a great weekend!

Brooks
0 Kudos
Message 4 of 8
(4,095 Views)
HI Brooks

I tried the option suggested by you. But the problem that is happening is, with the analog window option in triger, it starts taking data when voltage crosses either of the two boundries put in the analog window top and bottom value. But it does not stop when votage again crosses either of these boundries. What i am doing is , i am putting the data acquisition VI in a while loop and then run the program.  The triger is set for analog window with upper top as 5 Volts and Lower bottom as 0 volts. When the loop runs I checked for three cases.
1.  When  intial  voltage is negative, it does not take data. Then i increase the voltage and when it becomes more than zero it starts taking the data. If i decrease it again and brings it below zero again, it does not stop taking the data.
2. When initial voltage is more than 5 volts it does not take the data. then i reduce it  to bring it less than 5 volts and it starts taking the data. If i increase it again to make it more than 5 or reduce it to make it less than 0, it does not stop taking the data.
3. When the intial voltage is between 0 and 5 volts. It does not start taking the data when the loop starts even when voltage is between 0 and 5 Volt which is probably because it trigers only when entring the window.

What i want is, i want to place data acquisition Vi in a while loop which runs continiously. then i change the triger voltage or reference voltage. If it is between 0 and 5 Volts it should take the data and if not then it shouldn't. Can you suggest me something for this. I am using BNC 2110 and PCI 6112.

Reagards
Chauhan
0 Kudos
Message 5 of 8
(4,014 Views)

Hello Chauhan,

 

I apologize for my previous advice.  I had the wrong impression about the analog window trigger.  I've tested it out and I believe that the behavior you're seeing is correct--the analog window trigger is only a start trigger.  However, I have done some research and I have a better solution for you (that I've tested out).

 

I wasn't able to find the PCI-6112, but assuming you meant either the PCI-6221 or PCI-6112 the following solution should work.  To implement this solution you need a board with counters and both of these cards have them.

 

Here are the steps I took:

1.  Configure a counter output pulse generation task with a digital pause trigger.  This task will output a digital pulse train of a given frequency and whenever the pause trigger goes high/low (TTL high == 5 volts, TTL low == 0 volts) this output will stop/stop.  You can select high or low for the pause value.

2.  Configure the analog input to use the above pulse generation as a sample clock.

 

This will allow the analog input task to acquire continuously, but you'll only generate your sample clock when the trigger is high/low thus you can acquire samples at a given rate only when your trigger has a given value.

 

To set this up I would start with the "Gen Dig Pulse Train-Continuous-Pause Trigger.vi" example located in the Hardware Input and Output>> DAQmx>> Generating Digital Pulses folder in the example finder.  (To open the example finder open LabVIEW and go to Help>> Find Examples.)  This example will generate the pulses I mentioned then you just need to add in the analog input task and use the counter X internal output of the device as your sample clock.

 

I’ve tested this out and it works on my PCI-6251 so you should be okay if you have either of the cards I mentioned above.

 

I hope this helps!

Brooks
0 Kudos
Message 6 of 8
(3,994 Views)

Hi Brooks,

Isn't it true that this technique requires that one uses the SAME trigger to start/stop?  According to his original post, he wants to use two different triggers: one to start and the other to stop.

0 Kudos
Message 7 of 8
(3,989 Views)

Hello nantek,

 

This method uses a digital pause trigger so when the pause trigger is at the specified level (either TTL high or low) it will generate the sample clock, so yes, there is only a single line used for the pause trigger.  I may have misunderstood what he wanted, but the way I interpreted his last post this is what he was looking for.

 

Chauhan, if this isn't what you meant, let me know.

Brooks
0 Kudos
Message 8 of 8
(3,954 Views)