LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Sync Problems

Solved!
Go to solution

Hi

 

I am trying to setup a simple acquisition system (partly to learn and partly as a start point for a more complicated one).

 

I have a function generator producing a 1kHz sine wave (input ai3).  I have setup my acquisition system for finite samples (20 samples, rate 20 kHz).  The acquisition is triggered on PFI0, rising edge.  The output display is a waveform graph.

 

In a separate vi I have a counter (ctl0) set to 1kHz output on PFI3.  I hardwired PFI0 to PFI3.

 

The problem: the sine wave displayed on the waveform graph moves slowly to the left.  How do I make this stationary?  I would have expected a trigger of 1 kHz with 20 samples, each sample taken every 50 uS ( 1/rate) to occur at the sample point on the incoming sine wave (like the display on an oscilloscope).  What am I missing?

 

Thank you

 

Peter

 

(also the counter is an example from NI and the acquisition system an example from a book)

Download All
0 Kudos
Message 1 of 11
(4,047 Views)
Solution
Accepted by catinthehat

I may not be understanding your setup, but here are my thoughts.

 

  1. You have separate Function Generator that you are using to generate a sine wave.
  2. You set up a Counter Task on your DAQ card to act like a trigger.
  3. You digitize the sine wave on your DAQ card.

The sine wave is moving because the Master clock for the DAQ and function generator are different; they will drift. When you look on a scope, you may use the TTL output of the function generator and trigger on that. The TTL has the same clock as the sine output.

 

Try triggering your DAQ with the TTL output from the function generator; I bet it won't move.

 

Unless you have the same clock you will always have drift. Welcome to world of synchronization.

 

mcduff

Message 2 of 11
(4,011 Views)

Hi

 

Thank you for your reply.  The three points you made are correct.

 

I'm using the function generator to mimic a real world signal (but without any of the complexities, noise, harmonics).

 

If I use my scope to look at the sine wave, I trigger on it using the internal trigger of the scope and the display is stationary; is something like this not possible using LabView and DAQ?

 

The end for all this is to show\prove to myself that I can trigger and acquire data starting at the exact same spot on a periodic wave. (FYI the real world signal that I do have has a constant period but the information will be different in every cycle).

 

When I move from here to the next step, the real world signal needs a trigger to start.  At the same time I need to acquire data from it (64 uS later to be precise).

 

I'll try triggering from the generator as an interesting experiment to see what happens, but I won't be able to use the result for the next.

 

Thanks for your help

 

Peter

 

0 Kudos
Message 3 of 11
(3,987 Views)
Solution
Accepted by catinthehat

Most of NI's DAQ devices support the use of digital TTL trigger signals.  Only a significantly smaller subset support triggering on continuously-variable analog signals.

 

What DAQ device(s) do you have available for this app?  Have you checked to see whether any support analog hardware triggering?

 

If analog hardware triggering isn't available, there are workarounds to accomplish the *equivalent* of analog triggering using software post-processing of the acquired data.  This can usually be done in near-real-time with lag limited to the fraction-of-a-second range.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 11
(3,984 Views)
Solution
Accepted by catinthehat

@catinthehat wrote:

 

If I use my scope to look at the sine wave, I trigger on it using the internal trigger of the scope and the display is stationary; is something like this not possible using LabView and DAQ?

 

Peter

 


The internal (auto) trigger still has a level. You are always triggering at a threshold on your waveform. (Set the level to 0, see what happens.)

 

Here's another experiment, set the oscilloscope to line trigger, (here it triggers on the 50/60 Hz line input). See what happens to your sin wave.

 

As Kevin mentioned you would need a DAQ with analog triggering to trigger on the sine input.

 

mcduff

Message 5 of 11
(3,978 Views)

Hi

 

Very interesting results.

 

As suggested, I hooked up the TTL output from the function generator to the DAQ to act as the trigger and no more scrolling sine wave!

 

I put both the sine wave and the counter output from the DAQ up on the scope; the counter moves relative to the sine wave and so no wonder the acquisition does the same. (the two waves probably differ in frequency somewhere at the fourth or fifth decimal place)

 

So now the question what is the proper way to setup a LabView program to acquire data from an periodic analog signal at exactly the same starting point?

 

Thanks again for your help

 

Peter

 

0 Kudos
Message 6 of 11
(3,974 Views)

@catinthehat wrote:

Hi

 

Very interesting results.

 

As suggested, I hooked up the TTL output from the function generator to the DAQ to act as the trigger and no more scrolling sine wave!

 

I put both the sine wave and the counter output from the DAQ up on the scope; the counter moves relative to the sine wave and so no wonder the acquisition does the same. (the two waves probably differ in frequency somewhere at the fourth or fifth decimal place)

 

So now the question what is the proper way to setup a LabView program to acquire data from an periodic analog signal at exactly the same starting point?

 

Thanks again for your help

 

Peter

 


Kevin can probably help you here.

 

If you have an analog out on your DAQ you may be able to use that. In the past when I had to synchronize function generators together I would use the 10MHz output on one of them as the clock for the other function generator. Your function generator may have a 10MHz clock output; you might be able to use this as your sample clock for your DAQ if it has the right inputs.

 

Can you use the TTL from your function generator as a trigger? It seems to work.

 

mcduff

0 Kudos
Message 7 of 11
(3,970 Views)
Solution
Accepted by catinthehat

So now the question what is the proper way to setup a LabView program to acquire data from an periodic analog signal at exactly the same starting point?

As is often the case, the correct answer is, "it depends."  I bet it thrills you to hear that.

 

1. What are the capabilities of your DAQ device?  Does it support analog triggering in hardware?  (And what device do you plan to use?  And what alternative devices might you be able to consider?)

 

2. What's the nature of the real-life waveform(s) you'll be dealing with?  Is there one and only one place within the waveform(s) that'll satisfy the analog trigger conditions your device supports?

 

3. Can you accept an approach that uses software to post-process your data to find the desired trigger condition?   Can you unambiguously define a software-based trigger condition for your waveform, even if the criteria are more complicated than what the hardware can support?

 

This can be pretty easy and scope-like if you have a device that supports analog hardware triggering and can expect a signal waveform that's compatible.  Or it can get pretty dicey if you have a waveform that requires complicated post-processing to identify the right trigger point unambiguously.

 

It's kinda hard to give complete advice without even more detailed info.

 

 

-Kevin P

 

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 8 of 11
(3,955 Views)

 

Hi Kevin

 

So if I understand you; edge triggering is fair standard for DAQ while level triggering on an analog signal is only possible on a small set of DAQs.

 

Lucky I won't need to do any level triggering for the real world signal.  The 'box' that the signal originates from requires an outside trigger to start producing data.  I'll use the same trigger to start the DAQ data acquisition there by allowing me to have a single Master clock to the entire system.

 

Thanks!

 

Peter

 

0 Kudos
Message 9 of 11
(3,852 Views)

Hi mcduff

 

Oh I really didn't think that one though at all, should have known better.  Scope's are level triggered, not based on some frequency (there are some other triggering options but setting a frequency isn't really one).

 

Thanks to everyone for your help.

 

Peter

 

0 Kudos
Message 10 of 11
(3,849 Views)