Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

two-signal edge separation measurement with PXI 6602

Hi
My application requires two-signal edge separation measurement, for counter of PXI 6602, one PWM signal (produced by DSP Hardware) is selected as GATE signal and one trigger signal (also produced by DSP Hardware) is selected as AUX-LINE signal. So the counter will measure the value from the rising edge of the trigger signal to the rising edge of the PWM signal. As there are three PWM signals, so I use three counters. And for three counters, the AUX-LINE signal is same, they use the same trigger signal.
 
As see the program in the attachment, the requirement for my applicaton is
1) for each iteration each counter only need measure once;
2) the loop is time constrained,the loop frequency is 3 kHz, that is the measurement should be finished as fast as possible.
 
As designed PWM signal and trigger signal.if the counter read simultaneously, the outputs of the counters should be sine waves and they are 120 degree shift between waves.
when I do not use DAQmx Timing (implicit) vi, the measurement is too very slow;
but when I use DAQmx Timing (implicit) vi, the output are sine waves, but the phase shift changes, for example for counter 2, and counter 3, the phase shift is about 100 degree and the phase shift keeps constant.  I am confused what cause this problem? do the counter not read simultaneously or the caused by the buffer, but I only set the sample per channel 1?
 
thanks very much!
 
Yong
0 Kudos
Message 1 of 4
(3,546 Views)
Hello Yong,
 
You have no wait time within your for loop.  This means that the loop will execute as fast as possible, but not at a constant rate.  To acheive a more constane rate, try inserting a Wait Time of 1 ms.  This will get you a loop with a 1 kHz rate.
 
How fast is your PWM Signal?  It may be that you are missing some two edge measurements while waiting for the loop to iterate.
 
I suggest merging your error clusters out of the DAQmx Read.vis.  Right now, you are just clearing out any errors.  Let me know if you start returning any errors once you have done this.

Regards,
Sean C.
0 Kudos
Message 2 of 4
(3,543 Views)
Hi,Sean:
thanks for your information!
Actually my program is designed for DSP. The speed of the program(loop rate) is determined by the DSP program,because the PWM signal is produced by DSP.So in the design, the Labview program try to match the speed of DSP. Now the DSP program is 3kHz, that causes the loop rate should be at least as fast as 3kHz.That is the reason I do not use the wait time in my program.
Also I can merge error clusters out of the DAQmx Read.vi. but that do not influence the results.
thanks!
 
Yong

0 Kudos
Message 3 of 4
(3,533 Views)

Hello Yong,

To aid us in trouble shooting this problem, it might be a good idea to simplify your code.  The first thing I would do would be to reduce this down to a single counter task only.  See if you can continuously measure two edge separation on one counter only.  Try running the Meas Two Edge Separation-Buffered-Continuous.vi shipping example found in the NI Example Finder under Hardware Input and Output >> DAQmx >> Counter Measurements >> Two-Signal Edge_Separation.  If you can do this correctly, slowly start adding parallel counter tasks to this example.

Let me know how this shipping example works for you.

Regards,
Sean C.

0 Kudos
Message 4 of 4
(3,526 Views)