LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tone measurement doesn't give 0 for output

Solved!
Go to solution

hello everyone, i'm using the tone measurment.vi to measure the frequency of a square wave from 0-15Hz. when i start my program, the frequency of my square wave is zero, but the output

of the tone measurment is 1.268, while the program is running i can get the value to zero. but it is very important that the value in the beginning is zero. i hope someone can help me with this.

 

Knipsel.JPG 

 

thanks in advance

 

kapoew 

0 Kudos
Message 1 of 14
(4,507 Views)

Hello,

 

I don't really see a problem in the jpeg.

Can you put the specific VI online?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 14
(4,470 Views)

hello, here is my VI, just so you know it's a program for a PMSM motor. the problem occurs when you move the slide bar from the "hall sensor speed". i've also noticed that the value only becomes zero when you move the slide bar really fast to zero otherwise i still get a value.

 

thanks in advance 

 

0 Kudos
Message 3 of 14
(4,458 Views)
The tone measurement Express VI is a Fourier Transform based measurement that requires about ten cycles for good accuracy.  At one or two hertz, you are only giving it one or two cycles.  Try using the Pulse Measurements VI.  It is zero-crossing based (detects edges), so should do what you want.  It will throw a specific error (-20308) when it detects no zero crossings, indicating a period longer than your sample size (which is effectively zero for you case).
0 Kudos
Message 4 of 14
(4,428 Views)

hey DFgray, i tried what you suggested but i doesn't work... i get the error 20309: the amplitude of the waveform is zero, so the histogram method cannot be used... i tried to play a little bit with the reference levels and stuff but i keep getting the same work. still thanks to try.
hope you or someone else has an other idea of solving this.
 
thanks again
 
kapoew 
0 Kudos
Message 5 of 14
(4,420 Views)

kapoew,

 

How do you define zero frequency ... from a finite measurement perspective?

 

A frequency is defined as the number of cycles of the waveform during a specified time period.  If less than one cycle occurs during that time period, the frequency will be considered to be zero.  From the error you got, it sounds as though the signal may have been sitting at zero volts throughout the measurement period.  If this happens, any measurement scheme will be unable to determine whether the frequency is low, the connection to sensor is broken, or whether the sensor is just putting out zero volts.

 

You have to detect these conditions in your own code to supplement the results from the Pulse Measurements VI or Tone Measurements.   If you are confident that broken connections will not be an issue, then look for the -20308 or the -20309 errors.  When they occur, clear the error and define the frequency as zero.  If the sensor output stays high throughout one measurement cycle, does the Pulse Measurements VI produce a different error?  You may need to detect more than just those two error codes.

 

Lynn 

0 Kudos
Message 6 of 14
(4,413 Views)

hi, i don't really know what i did, but the 20309 error is gone, but now i get the 20308 error. but there are no broken connections because for the moment i'm simulating the sensor (later on this will be replaced by a real sensor). how do i clear the error and define the frequency as zero?

also i'm measuring the period i'd rather have the frequency. because the period would give me another problem (because frequency = 1/period, and if period=0 well that's infinite)

 

i've played with the reference levels, changing the polarity. but nothing works.  it can't be this difficult to measure a zero frequency...

 

thanks for the reply

 

kapoew 

0 Kudos
Message 7 of 14
(4,403 Views)

To handle the error you can wire the error out from the VI to a case structure.  In the "error" case unbundle the error code and compare it to -20309 (sign is important).  If you get that error, set the frequency to zero and set the error cluster to the default no error condition.  Just wire everything straight through the "no error" case.

 

If you have trouble with this, please post your VI.  It is much easier to trouble shoot a real VI than to guess from a written description.

 

Lynn 

Message 8 of 14
(4,401 Views)

hello, i did what you do. and it's almost solved. i get a zero frequency output like i wanted. but i still have a small problem. the frequency above zero only gets stable from about 1.5Hz. any solution to this? i posted my VI so maybe you can check it out. it's a program for a PMSM motor.

 

thanks a lot 

 

kapoew 

0 Kudos
Message 9 of 14
(4,394 Views)

ow yeah, and off-topic: what are kudos? ^^

 

thanks 

0 Kudos
Message 10 of 14
(4,393 Views)