Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9361 Counter Input Duty Cycle Spikes

Hello all,

Currently I am facing an issue when measuring the PWM Duty Cycle of my signal input to my NI 9361 module.

The issue can be seen in the attached image Spikes in PWM Duty Cycle.


PWM Frequency (ctr6) and Duty Cycle (ctr7) are measured in the same task with virtual channels "PWM_Frequency" and "PWM_DC" respectively.

 

I was getting more or less the same spikes on PWM Frequency, but it was resolved when I applied the Min Pulse Width digital filter for PWM Frequency measurement. It can be seen in the below Spikes in PWM Duty Cycle image that I don't get any spikes in the PWM Freq waveform.

When I try to apply the Duty Cycle digital filter for the "PWM_DC" channel as shown in the image PWM Duty Cycle Digital Filter (Disabled) then I get error from DAQmx that this filter is not applicable for the channel "PWM_Frequency".

Is it possible to apply both Frequency digital filter and Duty Cycle digital filter in the same DAQmx task?
Why do I get error even when I apply digital filter for both virtual channels separately?

 

Any lead would be really helpful.

Thanks!
Rahul

 

 

 

0 Kudos
Message 1 of 4
(1,621 Views)

I've never used a 9361 but am aware that it "plays by different rules" than the vast majority of NI's DAQ counters on desktop MIO boards and suchlike over the last couple decades.  The latter is where my experience lies.

 

So with that caveat, I'd advise trying to perform these measurements with a single task rather than 2 separate tasks that you may or may not have properly sync'ed, and whose support for digital filtering seems troublesome.

 

Does your device support the counter measurement mode "pulse->frequency"?  This mode *inherently* returns both freq & duty cycle info.

 

If not, you can resort to the old-school classic "semi-period measurement" mode.  There, you get an array where alternate values represent low time and high time.  (Properties are available to query or specify the initial active edge so you can know whether the 1st value is a low time or a high time.)  A function like "Decimate 1D Array" will separate your low times and high times into separate arrays, making it pretty straightforward to auto-index over them and compute output arrays for freq and duty cycle.

 

The main point is that by getting *all* the necessary data from a single task, you're *necessarily* sync'ed and you can (hopefully) still do any needed digital filter config.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 2 of 4
(1,594 Views)

Hi Kevin P,

 

Thanks for your response.


No, NI 9361 doesn't support Pulse measurement like you suggested on cDAQ.
from the datasheet: The NI 9361 supports pulse measurements only for CompactRIO systems.
This is the reason I am measuring PWM Frequency and PWM Duty Cycle separately using separate counters.

 

Yes, both the PWM Frequency and PWM Duty Cycle are measured in one single DAQmx Task using two separate virtual channels.
But it seems I can apply only one digital filter: Frequency OR Duty Cycle but not both. This is what I would like to confirm here, and would really appreciate if someone can point me to any workaround to get rid of these unwanted glitches in my PWM Duty Cycle waveform.

Cheers,
Rahul

0 Kudos
Message 3 of 4
(1,567 Views)

Personally, I'd be leery of using 2 separate counters for those 2 measurements if their start time is synced only by being in the same task.

 

The 9361 may do this perfectly, but I would need to be convinced before expecting it.  Outside of cDAQ, counter measurement tasks don't typically allow multiple channels in a single task.  I have some vague memory of prior threads around here involving multi-counter *output* tasks where the individual counter output channels weren't perfectly sync'ed merely by being part of the same task. 

 

With that as context, and while waiting for someone with more authoritative knowledge about the 9361 to respond, see where you get with a *semiperiod* measurement using a single counter channel.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 4 of 4
(1,560 Views)