LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How TTL trigger analogue input using PFI0/TRIG1?

Hello,
 
I know there is probably a very simple answer to this question. I have seen example code using the output VI, "AO Trigger and Gate Config.vi", to cause analogue output to wait for a trigger signal on PFI0/TRIG1.
 
I am using a BNC-2110 connector block, and a PXI 6052E IO board to do real-time single scans and single updates.
 
Prior to initiating an input/output trial, I would like to wait for an externally generated TTL rising edge on the PFI0/TRIG1 BNC connector of my BNC-2110. The output clock is driven by the "AI Scan Start" signal, so I do not want to impose further conditions onto the output side of things. Therefore the examples using "AO Trigger and Gate Config.vi" are not helpful. To my surprise the "AI Trigger Config.vi" is quite a bit more complicated!
 
Could someone tell me how I can make analogue input wait (once) for a TTL signal before starting?
 
Thanks in advance,
Frenk
 
 
 
 
0 Kudos
Message 1 of 7
(6,362 Views)

Hi Frenk,

It sounds like you are using the Traditional NI-DAQ (Legacy) driver. However, you have all of the necessary hardware to use the DAQmx driver. This driver is newer, more powerful, and easier to use than Traditional NI-DAQ (Legacy). Here are some links with more information about DAQmx:

Advantages of NI-DAQmx

Learn 10 Functions in NI-DAQmx and Solve 80% of Data Acquisition Applications

As for your triggering question: I recommend that you use a reference trigger. You must acquire at least 2 pre-trigger samples with a reference trigger. I understand that you only want one pretrigger sample and you can get rid of the unwanted data in post processing. There is a great example for using a reference trigger in DAQmx in the LabVIEW Example Finder. Go to Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage >> Acquire & Graph Voltage - Internal Clock - Digital Reference. I hope that you find this information helpful.

Regards,

Hal L.

0 Kudos
Message 2 of 7
(6,353 Views)

Hello,

Thank you for the suggestions.

I wrote this program 2.5 years ago when DAQmx wasn't available for real-time. I'd prefer to not rewrite it with DAQmx at this time, because I suspect a minor tweak to the traditional DAQ functions would do what I need.

Can anyone suggest how to approach it with traditional DAQ?

Thank you again,

Frenk

0 Kudos
Message 3 of 7
(6,343 Views)

Hi Frenk,

I'm not 100% clear on what you mean when you want to wait once before starting the application. Do you want to ignore a trigger pulse once before accepting it or do you want to ignore the immediate data before acquiring your signal? With your hardware, you are not going to be able to ignore the trigger signal, but you can acquire pre and post trigger data for an analog input application. There is an example in the LabVIEW Example Finder that demonstrates this. Go to Help >> Find Examples >> Hardware Input and Output >> Traditional DAQ >> Analog Input >> General >> Acquire and Process N Scans - Trig.VI.

Also, if you want more information about triggering in Traditional NI-DAQ (Legacy), I recommend looking at the Traditional NI-DAQ Reference Help. This is located in Start >> All Programs >> National Instruments >> NI-DAQ. If you go to the search tab and enter "trigger," the first few options will have more information for you.

Regards,
Hal L.

0 Kudos
Message 4 of 7
(6,328 Views)

Hello,

(Aside: thanks for the links to the examples).

To clarify, I don't want to ignore any digital triggers. I would like to set up the real-time analogue data aquisition, but then have it wait until the digital trigger before the first analogue points are input/output. Thereafter, the analogue I/O continues for N points in a FOR loop. I would like minimum time between getting the digital trigger and the first analogue input/output operations.

Thanks for your help,

Frenk

0 Kudos
Message 5 of 7
(6,316 Views)

Hi Frenk,

I'm glad that you liked the examples. So if you just want to acquire data after the trigger, then all you need is a start trigger. Once the trigger is received, the driver immediately sends the signal to start acquiring data. The driver optimizes the timing for you.

One thing that I noticed is that you mentioned using a for loop. I recommend using a while loop for your program. Since you are performing a finite acquisition, the while loop will stop executing once the samples have been acquired. The example that I mentioned in my previous post will work for your application. You can also take a look at the Acquire N Scans Dig Trigger example which is in the same location.

Finally, since your acquisition is finite, the data will be acquired and then sent to LabVIEW once the acquisition is complete. If you want to display parts of the acquisition as the data is acquired, then you can set the number of scans to read at a time to be lower than the total number of scans to acquire. This way, the scans read at a time will be displayed as they are acquired. The Acquire and Process N Scans - Trig example is a good example to see this feature.

Regards,

Hal L.

0 Kudos
Message 6 of 7
(6,302 Views)

Hi Hal L,

Sorry to bother you. Now I have 2 trigger sources and I want to use BNC-2110 to convert them to digital signal before they are inputed to the LabVIEW. The thing is now I can't use 2 analogue in channels to sample them by using DAQ assistant since when I did this, LabVIEW just told me some resources are reserved. Do you know how can I do this?  

Thanks very much!

 

Regards,

Henry

0 Kudos
Message 7 of 7
(5,037 Views)