Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Retriggerable Analog Input using Analog Trigger on M Series

Hi,

 

I'm trying to set up a Labview program to sample an analog channel at a specified time using an analog trigger using a USB-6251 M-series device.

 

The signal comes from an MCT detector (IR-range) that detects a pulsed-laser operating at 1kHz and the signal, on an oscilloscope, has a pulse length of about 400ns.  The trigger comes from the laser itself and it's a 1kHz pulse with a 1.5us width.  So compared to the 1kHz repitition rate, both pulse widths are essentially negligable.  All the voltages are below 5V.  So creating/ending/recreating tasks doesn't work in this situation. 

 

What I want to do is sample the MCT signal voltage whenever the trigger pulse is detected. Also, I only need to sample the peak voltage so it'd just be 1 sample per trigger will be very low (probably 1-2) at a sample frequency of at least 250kHz.  So it's pretty much "Read signal voltage every time the trigger rises above some value."  The actual trigger has an adjustable delay so you can align the trigger and signal so any offsets caused by the DAQ or elsewhere can be fixed easily.

 

I've seen that you cannot directly set up an analog retrigger but you can set up a digital trigger based on an analog input. I can understand as far as setting up the digital trigger clock and using that to trigger the analog input sampling.  However, I don't see how to set up the digital trigger using the analog trigger described above.  So every time the analog trigger pulse comes, it creates a digital trigger pulse that tells the analog input to sample.  Also, it needs to be able to run until a command is given to stop but that seems easy to do.

 

I've also attached an example I found in the support database that I've been going off of.  However, it doesn't contain comments and I don't see anywhere for an analog trigger input (AFPI0 on the DAQ board?).

 

-Dave

0 Kudos
Message 1 of 17
(4,075 Views)

After lots of reading, I discovered the trigger pulse can be read as a digital TTL pulse.  Hoping this will make it much easier.

0 Kudos
Message 2 of 17
(4,057 Views)

Hello Chur7222

 

I just want to clarify what I think you are trying to do: Read the voltage (from the MCT detector) every time the trigger voltage reaches a certain threshold (where does this trigger voltage come from? You say the trigger is comes from the laser, but what exactly is sent into the card? Is the laser connected to some other measuring system? What exactly is your setup here?) How I understand it is that you have a MCT detector that outputs a voltage based on a laser (which you measured with an oscilloscope to have a pulse width of 400ns), but I'm confused on where your trigger is coming from, do you have two analog inputs? One is the trigger and the other is the output from your MCT detector?

 

If you have two analog inputs, then the VI you attached should work fine. Right now it is setup to trigger off the same input that it is reading. Note that for the Analog Start Trigger, the Channel Being Read is sent to the trigger source. To get a new trigger source, just remove this wire and create a new control for that source. This VI already has the functionality of stopping the acquisition with a stop button on the front panel. Is this what you meant by "Also, it needs to be able to run until a command is given to stop"? 

 

Please clarify your setup and purpose a bit further and I will be happy to help you

 

-Nathan H

 

 

Software Developer
National Instruments
0 Kudos
Message 3 of 17
(4,044 Views)

Nathan,

 

Sorry for being unclear about the trigger.  Every time the laser fires, it sends a TTL pulse out of a channel on the instrument.  At least I'm assuming it's TTL.  The DAQ reads it fine as a digital trigger, at least.  The TTL pulse pretty much tells you when the laser fired. It also has an adjustable delay so you can, for example, align the TTL pulse and the laser pulse hitting an MCT. 

 

With that, my plan's to use the sampling clock, generated by the trigger, to create a 1kHz analog output.  Then I can adjust the trigger's delay so the sampling clock and the MCT's signal line up (in time) on the oscilloscope.  Does that sound like an efficient way to go about getting the timing right?  I'm still kind of new to data acquisition and all the information available here can get overwhelming. 

 

-Dave

 

0 Kudos
Message 4 of 17
(4,042 Views)

If it helps, here's what I have so far.  The Sample Clock Gen sub-vi is taken from an example that makes a clock based on a retriggerable digital trigger. 

 

I don't think the pulse train is generating properly.  It sometimes samples the MCT at the laser pulse and sometimes not--there's a peak that sometimes shows up that is definitely the MCT getting the laser pulse.

 

 

 

 

Download All
0 Kudos
Message 5 of 17
(4,030 Views)

Hello chur7222

 

This seems like a fine approach for what you are doing. How I understand it, is that you are you using the TTL signal from the laser as the trigger for the Generate Clock.vi to run, is this correct? as soon as this starts running, if you use the output of this clock as your timebase, then it should work fine. However, you need to make sure that the clock source (you named it counter output) for your Sampling Program.vi is set to the right channel. For this card, if you are using counter 0 to send the pulse, then this pulse will be on PFI 12 (the output of counter 0). You need to either internally, or externally wire that output to the clock source that you are using for your timebase (counter output in your program).

 

For example: if you use counter 0 to generate your pulses, they will come out on PFI 12, or pin 89. You can wire this output to the gate of counter 1 (PFI 4 or pin 77), and then set PFI 4 as your time source in Sampling Program.

 

The VIs you sent me do not have any of your setting saved in them, can you tell me what all of your settings are? (mainly just what pins and sources you are using for your clocks and trigger).

 

To wire inputs and outputs of clocks internally, use the "DAQmx Connect Terminals.vi".

 

-Nathan H  

Software Developer
National Instruments
0 Kudos
Message 6 of 17
(4,014 Views)

Nathan,

 

Seems to have worked.  The counter uses ctr0 and the clock input on the AI task is PFI12.  I connected a cable from PFI12 to the oscilloscope and I can see the TTL pulse from that fine.  By changing the trigger delay (on the laser instrument), I can move the clock output to line up with the laser pulse fine.  Only problem is it the DAQ consistantly reads about 80% of the voltage that the oscilloscope reads.  Any idea as to why?  Also still kind of confused why the sample clock on the AI has a frequency input.  Does that just set up the time axis for the waveform?

 

To actually test that I have everything set up right, I'm going to see if I can pick up the interferrence caused by over-lapping two laser pulses.  Each pulse is about 30 microns in length so if I see that (that interferrence is actually what makes the experiment work) then I think I'm good. 

 

Thanks,

 

Dave

0 Kudos
Message 7 of 17
(4,006 Views)

It seems to be out of sync.  I attached a screen cap of the waveform graph it gave me.  I'm purposefully on the side of the pulse because it samples the baseline as well as part of the pulse so the repeating change is easier to see.  I set up the read vi to collect n samples of waveform data and wired 2000 into the number of samples terminal. 

 

Probably note-worthy that I changed the duty cycle to 0.9 so the rise slope of the sample clock could actually match the laser's trigger pulse.  However, the TTL pulse width of the clock is still much much less than the time between each trigger pulse.

 

-Dave

0 Kudos
Message 8 of 17
(4,002 Views)

Hello chur7222,

 

You may want to look at this example for doing retriggerable AI: https://decibel.ni.com/content/docs/DOC-6801 

 

This example seems to be what you are trying to do.

 

To answer some previous questions:

 

The sample clock on the AI has a frequency input that just specifies the max frequency it is expecting. It is fine to just set this really high, but most people just set it to the same rate at the external sample clock they are using (this is the case in the linked example).

 

I'm not sure why you are only getting 80% voltage reading in LabVIEW as compared to the oscilloscope...how are you inputting the signal into your DAQ card? You may be attenuating the signal accidentally? What is the circuit look like that you are using to connect this voltage to your input?

 

I would keep the sample clock at 0.5 duty cycle. The only important thing is the rise time, it shouldn't matter if it stays high for 50% of the cycle, but your trigger may miss it if it only stays high for %10 percent of the cycle. It probably wont affect it at all, but I don't see a real need for the 90% duty cycle.

 

Hopefully the linked example will get you going in the right direction.

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 9 of 17
(3,973 Views)

Nathan,

 

The example is pretty much what I have.  As far as all the connections, they're just cables connected from the MCT to a splitter and one goes into the oscilloscope and the other goes into their respective DAQ slots.  There's also a cable going from the PFI 12 line (Counter 0 output) into the oscilloscope to view that as well. 

 

I think I found the error, though.  The first pulse train aligns nicely with the trigger and gives a voltage reading comparable to the oscilloscope.  Then I think the rest of them fall out of sync.  It looks like it's falling out of sync, retriggering, and repeating.  That explains the stair-step pattern.  Would there be any reason why the pulse trains would drop out of sync from the trigger?

 

Thanks,

 

-Dave

0 Kudos
Message 10 of 17
(3,969 Views)