Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Error -20308 occurred at "NI_MAPro.lvlib:Pulse Measurements 1" when called from "NI_MAPro.lvlib:Pulse Measurements N" (waveform index 0 of 1)

Working with labview 2009 on vista machine.

Made a vi to measure rpm. When no pulses are received the next error shows up:

Error -20308 occurred at  "NI_MAPro.lvlib:Pulse Measurements 1" when called from "NI_MAPro.lvlib:Pulse Measurements N"  (waveform index 0 of 1).

The result I expect is zero.


I use a IR sensor/receiver to measure the rpm. Signal 10V with pulses going back to 0V

I use a mDAQ frame with a NI9239 module to get an analog signal.

See attached vi.



Two questions:

1: How to avoid this error. Or actualy what did I do wrong?

2: How to plot this in a graph



Message 1 of 12



I have been looking into your issue, and found the reason for your problem:

You want to measure pulses in your analog signal, and use the Pulse This VI requires (see help file) that the "mid ref level" is crossed at least a certain times per second.


I have been testing this rule and found with me (simulated signal) that the function works properly when I used a frequency of  at least 17Hz.


Then I tested this with your application, where I connected a niosy 3V DC signal to my DAQ board. I set the "mid ref level" to 3V and found that with this setting, the application works perfectly.


So in your case I would search for the exact mid ref level in your signal.


I hope this will help you design your application!



Peter S

0 Kudos
Message 2 of 12

Hello Peter,


The ref level is not the problem. It is a clear signal between 0 and 10V comming from a tacho sensor. 

I also simulated a signal and the error shows up also.

It seems that there is a timing issue with this function. When I simulate a signal  the error shows up at 19Hz.

What is the minimum frequency this function can or should handle?


I would like to measure the rpm at 0 Hz (rpm) as well? What to do? Alternatives?


0 Kudos
Message 3 of 12



You say it is a clear signal between 0 and 10V coming from the tacho sensor, but it has 0Hz (talking about the pulses).


When you want to use the Pulse  you have to keep in mind that the data you input on this function MUST pass the mid reference level a couple of times per second.


In cases with a low frequency, you can use the noise floor as the signal to pass the mid ref level.


If you look at the tachometer signal, if it is connected, the signal will allways have a noise floor. To make use of this noise floor, you must set the "ref units" constant/control to absolute and than set the "mid ref level" constant/control to this noise floor.


Please let me know if this will help you running the program.



Peter S

0 Kudos
Message 4 of 12

Hello Peter,


It does influence the min frequency if I set the mid reference level. Tried it with the actual signal and a simulated signal.

However it also influence the rpm reading in my example. The period time is probably determined from the mid reference.

How can I solve this?


Seperate of this I found the following setup problem.

To set the reference level for my tacho signal I probably need a more stable power supply. 

The noise is around 2 mV but the PS I use for this test setup seem to drift more then this. (Can be solved in the final setup).

The ref level window needs constant adjustment because of this.

There is not much room to play with.





0 Kudos
Message 5 of 12



How to measure pulse width below between 0Hz and 700 Hz if pulse measurement vi doesn't go below 17Hz?

Using the noise to trigger the mid level results in wrong pulse width mesurement.

0 Kudos
Message 6 of 12



Another option to "ignore" the errors is to erase the specific -20308 error.


You can do this quite easy as you can see in the enclosed example (filed it for LV 2009, 8.6 and 8.5 because I do not know what version you use).


Next to this problem, there is a problem with the calculation of the RPM value. Somehow with me, the result is always 60... I'll take a closer look at that as well!


Hope this will give you the requested results.




Peter S


Message Edited by Peter S on 10-06-2009 11:17 AM
0 Kudos
Message 7 of 12

I have analyzed your formula for calculating the RPM, and think something is missing there.


Enclosed you will find a converted VI (Express VI's converted to DAQmx code) where the RPM is calculated by "'standard LabVIEW functions".


In this case I assumed every pulse was a revolution of the motor.


In addition (to make things more clear) I would like to ask you to tell us something about the application you're building. What are you doing, and why are you doing it the way you do it right now.


Thanks in advance for your response!



Peter S

0 Kudos
Message 8 of 12

Hello Peter,


Thxs your input helped. Low rpm is no issue anymore. Rpm of zero still gives the famous "devided by zero issue" but that can be solved.


The system I use is a vista  PC with usb cDAQ unit.

Mod1 DI 9422

Mod2 AO voltage 9263

Mod3 AI current 9203

Mod4 AI voltage 9239

Mod5 Relay 9481

Mod6 Relay 9481

Mod7 Thermc 9213


The application is a test system with several sensor inputs like thermocouples, pressure sensors, accelerometer, valves and frequency controled motors.

As a start to learn LV a little, I build some VI's to measure the inputs and create the outputs I need. The tachometer is one of them.

All the peaces work more or less.


But now I entering the tough part. Choosing the right structure for the program.

I did some reading and tried to make some examples. But I realize that some more reading is needed to avoid structural redo's

The  CompactRIO Developers Guide  was usefull to understand more about structure building. However the synchronized while loops, that seems to be a good solution for reading inputs, analysing and sending output seem to be not supported by the configuration I have.


Basiclly I would like to read the sensors input values, plot them and file them.

Read front panel controls and send new output to relay, AOV modules based on front panel changes.

Analyse vibration data (without toolkit)

Automate test sequences in future if above works.


The first two work seperatly but I need a basic structure to make them work together and open the possibility to add the last two.

Figure 3.26 on page 45 of the CompactRIO Developers Guide seem to be a good architecture for my application. But it looks like it is not supported by the usb unit.

The synchronized option can not be choosen. Probably because I do not have a controler module.


 Do you have some suggestions for a good architecture that works whit the configuration I have. Some good readings would also help?




0 Kudos
Message 9 of 12



When I looked at your code after you initiated this forum thread, the first thing I thought of was: why is he using express VIs (like the DAQ Assistant) to do these kind of measurements?


Personally I would advice you to change to the non-express functions in LabVIEW (DAQ Assistants can be converted into NI-DAQmx code). That will improve your execution speed and also makes it easier to combine several "jobs" in one application.


To combine several measurement and control tasks, you have to keep in mind that themeasurement / control tasks define the loop speed: using 2 different tasks (with each another measurement speed) in 1 loop will cause problems. 


Have you followed the LabVIEW Basics I course? In this course, the 1st chapter informs you about the way you need to setup a new application. The reason I'm saying this is, that it would be good to know what your Flow Chart would look like. If you know this, you can choose the right Programming Structure / Design Pattern.


These Design Patterns can be found in LabVIEW itself: if you select "File >>  New..."'and then browse to "'VI >> From Template >> Design Patterns", you will find the most common ones.


But in order to select the correct pattern, you should create a Flow Chart or State Transition Diagram first.


Let me know how the diagram / chart will look like, than we can see what the best pattern would be for your application.



Peter S

0 Kudos
Message 10 of 12