From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

duty cycle measurement with a low frequency

Hi,
I'm new to LabView and am having trouble measuring the duty cycle of my signal, currently i'm using a cDAQ board with the NI 9205 analog input module to receieve the PWM signal. I've tried using the Pulse Measurement block from LabView 8.5 but it would appear that my period is too long so comes with the error "The waveform did not cross the mid reference level enough times to perform this measurement. Check the signal length, reference levels, and ref level units". Is there anyway around this or perhaps another way to calculate the duty cycle on a real time basis?
 
The frequency of my signal is around 0.8Hz so  the period is ~1.25s. I'm just using DAQ assistant which outputs the data in dynamic data format (thick striped blue line) and plugging it into the pulse measurement block which appears to accept brown lines so there is a coersion dot in the way, would that affect anything? The indicators appear as arrays.
 
I have tried changing the continuous sampling rate to as low as 10Hz but still comes with an error and displays dubious values before it does. The signal ranges between 0-5V and is quite well defined.   
0 Kudos
Message 1 of 12
(6,858 Views)
Hi Bill,

You receive this error because you need to have at least one complete cycle of the waveform.
I suggest you to increase the time of the acquisition to get two ore more period of your PWM signal.

For you information, the dark blue line is a dynamic data type and the brown is one waveform data type. The coersion dot means that LabVIEW do the converstion for you.

I just give a example with Express VI

Best regards,
Nick_CH
0 Kudos
Message 2 of 12
(6,847 Views)

Hi Nick,

I found that Timing and Transition block in Signal Express after I posted the message. It seems to work if I decrease the continuous sampling rate to around 500Hz and have a buffer(samples to read) that is twice that, so around 1k or more in the DAQ Assistant block. if I don't do that, it will give an error, is that because the buffer must have at least one full period?

Previously I had been trying to use a Pulse Measurement block. I think that it must timeout after a certain time period or number of readings if it hasn't detected an edge and since my signal has a high period it kept giving an error.

Thanks for the help and quick reply!

Bill

0 Kudos
Message 3 of 12
(6,844 Views)
Hi Bill,

You are right, the function "Timing and Transition Measurement" or the function "Pulse Measurement" have to get at least one full period.
That means, you have to acquire with the DAQ assistant one or more periode.

About the error from the "Pulse Measurement", could you please send me back the number and the description.

Best regards,
Nick_CH
0 Kudos
Message 4 of 12
(6,830 Views)

It says:

Error -20308 occurred at  (waveform index 0 of 1)

Possible reason(s):

Analysis:  The waveform did not cross the mid reference level enough times to perform this measurement. Check the signal length, reference levels, and ref level units.

0 Kudos
Message 5 of 12
(6,802 Views)
Hi Bill,

Just have a look at this forum:
Pulse Measurement problem
http://forums.ni.com/ni/board/message?board.id=170&message.id=81330&requireLogin=False

Best regards
Nick_CH
0 Kudos
Message 6 of 12
(6,791 Views)
Nick,
 
Could you please save the VI above for 8.2.1 labview version and send it across....
 
-Suneel.V


Message Edited by suneelkv on 08-13-2008 12:11 AM
0 Kudos
Message 7 of 12
(6,564 Views)

Hi Suneel,

 

Here is the block diagram along with the VI.

 

 

Regards,

Kent

Applications Engineer

Message Edited by tnek on 08-13-2008 05:15 PM
Download All
0 Kudos
Message 8 of 12
(6,536 Views)

Hi,

 

I am having a similar issue with PW Measurement, I need to read a Duty cycle in a percentage range from 0% to 100%.  The problem I have is the same: that it has not crossed the reference enough times to measure, or the histogram cannot be used.  This is obvious, yes, because there is no pulse, it is essentially all true or all false, but the pulse Measurement vi cannot handle this.  Is there another way I could measure duty cycle, so that I can see if there is a low (0%) or High (100%), and everything in-between?

 

Thanks,

-Corbin

0 Kudos
Message 9 of 12
(6,108 Views)

Corbin,

 

It is not possible to measure zero frequency.  You would need to wait an infinite time. Before you finished you would need to update to LV12.  Then your measurement would start over. 

 

You must define the longest time you are willing to wait for a result and declare that any signal which has not had the necessary transitions within that time to be functionally equivalent to zero frequency.

 

Once you have determined the acceptable limits, then you can look at how to implement this with your hardware.

 

Lynn 

0 Kudos
Message 10 of 12
(6,089 Views)