Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

single pulse width measurement

Solved!
Go to solution

Hello,

 

I am trying to measure the time of a single pulse using ctr0 on a PXIe-6361.

 

The input signal seen in attachment Capture7.jpg, is going to PFI 9, the gate of ctr0.

The problem is that the counter see' s the rising edge and stops. The pulse width is not given as can be seen in the output (Capture8.jpg).

 

I get the same results using Meas_Pulse_Width.vi example.

Is something wrong with my PXIe-6361?

Download All
0 Kudos
Message 1 of 12
(6,476 Views)

Hi,

 

I did pretty much the same and ran the example as well and they do work. You can try to explicitly specify the PFI line using a DAQmx Channel Property Node with a Counter Input Pulse Time Terminal property to verify if the problem is only with PFI 9 (if you use the property, you can use any PFI line even if is not the default gate for the specified counter), and even try with the other counters.

 

The VI is on the 2014 version, so I included a screenshot in case you have a previous one. If you need the VI in a specific version let me know and I'll downconvert it for you.

Camilo V.
National Instruments
Download All
0 Kudos
Message 2 of 12
(6,458 Views)

Your screenshot shows the counter is reporting a 50 ns pulse width.  It appears like the signal is crossing the threshold for TTL high and then dropping below it shortly afterwards during the transition.  This can happen if the signal has even a small amount of noise on it as there is no hysteresis on the inputs.

 

Configuring a PFI filter should resolve the issue (use the following DAQmx Channel Property node before you start the task):

 

 

PFIFilter.png

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 12
(6,440 Views)

Cavaral,

I tried your VI and recievied the same results as mine (Attached capture10).

I then added the filter and the VI timed out (attached capture9).

The x-series user manual says that:

 

"the counter counts the number of edges on the Source input while the Gate input remains active. When the Gate input goes inactive, the counter stores
the count in the FIFO and ignores other edges on the Gate and Source inputs. Software then reads the stored count."

 

Do I need to change the internal souce to a faster clock?

Download All
0 Kudos
Message 4 of 12
(6,429 Views)

That's odd...

 

Either the signal is much noisier than it looks on the Scope (I would increase the time/div to the max to see if anything jumps out) or the input is not connected to the right PFI channel (I would verify the connection by running an edge count task using PFI 9 to make sure the DAQ card is seeing the pulse).

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 12
(6,410 Views)

Did you try using the property node?

 

What heppens if you specify a PFI other than 9?

 

What happens if you use a different counter other than 0? (with both default and other lines)

Camilo V.
National Instruments
0 Kudos
Message 6 of 12
(6,403 Views)

Ok, I re-reviewed your screenshots and noticed you did try other counters, but still using PFI9 on counters 2 and 3only. Can you try the counters with some of the 15 remaining PFI lines from your card?

Camilo V.
National Instruments
0 Kudos
Message 7 of 12
(6,375 Views)

I have tried other imputs PFI_7, PFI_11, PFI_14, with the same results.

I also rechecked the signal and the signal is a clean pulse.

I also changed the create channel  to pulse width since the input is only a single pulse not a stream of pulses. I had it wrong on my VI.

0 Kudos
Message 8 of 12
(6,366 Views)

To test out the card, a push button switch was wired to PFI_4 to provide a +5VDC signal so that I could make a pulse as long as I wanted.

The attached image shows that the code does work, just not with the signal that I want it to measure (capture 11).

I have the option to modifiy my signal input so I could do a "Single Two-Signal Edge-Separation Measurement".

My input signal is from two optical gates, combined into a single pulse.

Download All
0 Kudos
Message 9 of 12
(6,364 Views)
Solution
Accepted by topic author acadia604

Oh I think I know what it is.

 

 

Change the task to "Pulse Width" (measures a single pulse) insted of "Pulse" (measures the high and low time of a repeating pulse).  Modify the DAQmx Read to use Ctr>>Single Sample>>DBL (instead of Pulse Time).  Modify the digital filter property node to use the corresponding "Pulse Width" properties (the filter is still necessary):

 

Untitled 2 Block Diagram _2015-04-27_14-41-42.png

 

The Pulse task was not timing out initially since you were getting a repeating series of noise pulses (and thus it was measuring a very low duration).  With the filter it was timing out since the noise is now eliminated and the single pulse will not complete the Pulse measurement (which requires a high and a low time):

 

370784f.png

 

 

For the record, I agree it is confusing that there is both a "Pulse" measurement and a "Pulse Width" measurement and they do different things.

 

 

Best Regards,

John Passiak
0 Kudos
Message 10 of 12
(6,345 Views)