LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital trigger on anolog edge

Hi All,

 

I'm working on a digital edge generation when a threshold is reached on an analog channel (in order to trig a camera).

I tried this : https://decibel.ni.com/content/docs/DOC-9280 with my NI USB-6351 but when the frequency of my periodic input signal changes on my analog acquisition, the digital trigger is delayed. Why ? Isn't it a hardware trigger ?

See JPEG picture attached where a delay appeared on the third pulse whereas the three others are right. (white curve : analog input, red curve : trigger generated)

FYI, the frequency of my input signal is about 100 to 300 Hz, and I want a 20-30 Hz pulse train.

Thanks !

Wilfried.
0 Kudos
Message 1 of 11
(3,394 Views)

Anybody from NI please ?

I will try next monday on a PXI-6281 card if the problem is the same.

Regards,

Wilfried.
0 Kudos
Message 2 of 11
(3,387 Views)

It's the same problem on PXI-6281.

Is it possible to talk with a NI hardware designer about that ? What is the hardware time loop of the analog trigger scan or latency ?

 

Thanks.

 

Wilfried.
0 Kudos
Message 3 of 11
(3,370 Views)

Hi,

 

Thanks for posting on NI Forum and sorry for the response time.

 

I had a discussion with my US colleagues and they said that :

 

The example sets the counter pulse in terms of pulse time. When the analog comparison event happens, the counters stays low for the "low time" and high for the "high time", so if you want a very small delay to when the counter goes high, set the "low time" to something very small (it has to be at least two ticks worth of the timebase clock though...so if you are using a X-series card with a 100MHz timebase, it has to be at least 2e-8 seconds). This is shown below:

counter idle state high.JPG

 

If this doesn't fix this issue, could you clarify some things:

What is the analog trigger level you set?

How much delay are you seeing?

Refer to the picture below for clarifications:

 

counter analog trig delay.jpg

 

Basically, the delay should always be what you set the "low time" to, and minimum delay will be 2 ticks worth of the timebase clock.

 

Best regards,

 

Nicolas M.
National Instruments France


Journées Techniques LabVIEW 2012 : du 27 septembre au 22 novembre
2 sessions en parallèle : Débuter avec LabVIEW - Développer avec LabVIEW

Message 4 of 11
(3,344 Views)

OK thanks for the reply, I will try it soon and keep you posted. Be aware that I would get a low frequency trigger output (less than 30 Hz) and my input signal is about 100 to 300 Hz.

To answer your question : You're right, your red line is the threshold and the delay seen is what you drawed, that is about several ms (3 to 8 ms).

Wilfried.
0 Kudos
Message 5 of 11
(3,324 Views)

Hi,

 

I tried and it doesn't work.

Please find in attached files two VI :

Generation current post. vi that generates a typical current signal on AO0

trigger gen post.vi : acquires ai0 and ai1

If you have a X series (or M series) with a analog trigger feature, you have just to connect AI0 on AO0 and ctr0 OUT (pin 89) on AI1. With this, you can check when the trigger is generated regarding the input signal (AI0).

Please let me know.

Thanks

 

Wilfried.
Download All
0 Kudos
Message 6 of 11
(3,319 Views)

Hello Wilfried_71,

 

In the Analog trigger section of the X series user manual, on page 228 (http://www.ni.com/pdf/manuals/370784c.pdf), there is an important section :

 

"The propagation delay from when a valid trigger condition is met to when the analog trigger circuitry emits the Analog Comparison Event may have an impact on your measurements if the trigger signal has a high slew rate. If you find these conditions have a noticeable impact on your measurements, you can perform software calibration on the analog trigger circuitry by configuring your task as normal and applying a known signal for your analog trigger. Comparing the observed results against the expected results, you can calculate the necessary offsets to apply in software to fine-tune the desired triggering behavior."

 

It implies that there is some delay expected. In this situation we would even expect some extra since it is being routed through the counter sub-systems. The paragraph implies that the best workaround is to accommodate for this in software by adding the time difference to one of the data sets. You should be able to show that the time offset is consistent and repeatable, then add or subtract that to correct the acquired data.

 

Otherwise, we ran your code and noticed that the high time was 0.03 seconds, but the waveform that you are simulating has a period of 0.009. When we changed the high time to about half the period we get much better results:

 

original.jpg

 

 

Is it the same for you if you run the code with the above settings (high time = 0.005, delay=0, low time = 2e-8) and do you still have errors?

 

Regards,

Jérémy C.
NI France

Message 7 of 11
(3,260 Views)

Thanks for the reply.

I had seen this chapter in the X series manual.

To answer your question, Yes it's working as showed in your picture with these parameters, but I need a pulse generation at 30 Hz maximum, what you showed is the same frequency as the input signal (~110 Hz).

 

Now, please put 0.0025 instead of 0.005 for High Time. Is this behaviour normal ? We can see that the pulse is directly generate if the signal (white) is above the threshold ...

 

 

Wilfried.
0 Kudos
Message 8 of 11
(3,253 Views)

Hello Wilfried,

 

When we put 0.0025 as the high time, we usually see two pulses for each high part of the test signal, which I'm assuming is what you also see. To answer to your question, yes it is expected behavior. As long as the trigger signal is above the threshold, the counter will continue to generate pulses with a high time of 0.0025 and a low time of 2e-8 seconds.

 

If you need the trigger to be no more than 30hz, then you can increase the high and low time of the pulse so that the period is 0.03 seconds; however, you just need to be aware that the period of the pulse is longer than the period of the test signal, so the pulse will miss all the triggers that happen during that 0.03 seconds.

 

Regards,

Jérémy C.
NI France

Message 9 of 11
(3,241 Views)

Yes, It's the behaviour I saw.

You're right, I increased the high time in order to get a frequency max of 30 Hz, but if the pulse generated is falling when my input signal is above the threshold, then the next pulse is generated directly after the low time, so it is not generated when I want (when the threshold is being reached). If there's no way to do with this configuration, is it possible to use a second counter, based on the frequency of this first counter (with a high time of 0.005 s) to generate this famous low frequency pulses ?

Wilfried.
0 Kudos
Message 10 of 11
(3,238 Views)