Showing results for 
Search instead for 
Did you mean: 

labview counter sampling problem


Hi, I'am new to labview and have some trouble about my code.

My purpose is to use the counter to count the number of digital pulses in a specified time period (here I use the target time), each pulse represent a particle and  with the flow volume during this target time I can calculate the particle number concentration. Since I need to start the counting for each specified time period form zero, I use the case structure to restart the counting task once the target time elapsed. Also, I need to use the analog input channel to test the pressure (here it is represented as voltage) and synchronize the concentration and pressure sampling and show them in one chart.

My problems are as follows:

1. For the target time, if I set it as 1 second, the counter sampling works well and the concentration got from labview is close to the real concentration. However, if I decrease the target time into 0.1 seconds(which means I increase the number concentration sampling frequency), the concentration got from labview is far from the real value. I just can not understand why this difference exists?

2. As my code show, I use the select structure for the concentration calculation, for the true case, when the target time elapsed, I will get the maximum value for the counter signal array(which is the total number of pulse during the specified time) and divide it by the volume(can be calculated easily) to get the concentration. However, for the false case I just want to let it returns void (which means the result will not show in the graph), but I failed and now I use the constant zero... is there any way I can ignore the false case and just get and show the true case result in the graph?

3. Finally, if I want to save the data and let the data file show pressure and concentration at each particular time, what should I do, I tried the "Write to measurement", but it seems not work as I described.

Attached is my work, thank you!

0 Kudos
Message 1 of 3

Well I would like to address you first question first. Have you tried to save your data into an array? Then it would be possible to manually look and see the difference between the values your sensor is providing in the case of 0.1 vs. 1 second. That might give hint as to why you are not satisfied with your collected data over the shorter period.

Casey G.
0 Kudos
Message 2 of 3

Hi Casey,

Sorry for replying you late and thank you for your advice.

Actually I had tried the advice you suggested before. I saved the raw pulse count data into an array for both the case 0.1 and 1 second and it is expected that the raw pulse count for the 0.1 second case should be 1/10 times of the 1 second case. However, I just found the reality was not what to be expected and the 0.1 second raw count is smaller than 1/10 of the raw count for the 1 second case. It seems some pulses are not counted for the 0.1 second and I don't know why..

Since these problems do stop my process, nowadays, I just change my mind and try to use the VISA.VI to send a command and read the data out with a RS232 to USB cable which connect the instrument and my laptop and it is totally a different method. It seems I can get the data I want for the 0.1 seconds case and now I decide to use this method. Also with this method, the other two problems don't exist any more

Thank you for your advice again.


0 Kudos
Message 3 of 3