Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM Acquisition at same rate

Hello All,

 

I am currently trying to read continuously a PWM using the counter input of a NI USB-6361.

 

The PWM has a frequency of 1kHz, therefore I should read a sample every 1ms. Unfortunately, the loop take about 3-4ms to execute which means I lose about 75% of my data. I wonder what I should do to acquire my PWM once every 1ms.

 

A simple VI of how I acquire my data looks like this:DAQ PWM.PNG

 

I tried adding this DAQ function:DAQ CLK.PNGbut every time I do I get different errors like the clock is too fast or I try to acquire a sample before it is ready etc..

 

Any help would be greatly appreciated because I know the card is fast enough to aquire at 1kHz and I am just wasting its potential right now.

 

Sincerely,

Cynthia

0 Kudos
Message 1 of 2
(4,401 Views)

Hi cgagnon7843, 

 

Did you already tried using the examples that LabVIEW provide?

 

From the LabVIEW toolbar Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Counter Input>>Counter - Read Pulse Duty Cycle and Frequency (Continuous).vi

 

You can also look for examples in the community:

 

PWM (square-wave) Frequency and Duty Cycle Detection on Non-Counter DIO -

https://decibel.ni.com/content/docs/DOC-12911

 

PWM (square-wave) Frequency and Duty Cycle Detection on Counter DIO -

https://decibel.ni.com/content/docs/DOC-14147

0 Kudos
Message 2 of 2
(4,378 Views)