LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a better way to do this function?

Style tips: 

For(imstuck) explains it well. LabVIEW works with the same (and sometimes fixed) numeric representations, it is good in automatic conversion, but that leaves the small red triangle on the connection to a function. Divide e.g. assumes a Single or Double and will always generate a conversion dot if fed an integer. Most of the time it doesn't affect the function of the program, but it's good style to minimize it.

 

Also try to not cross wires more than necessary and try not to wire backwards, both reduce the readability of the code.

 

You're on the right path, the style tips will help you if others (or you in 2 months) need to look at the code again. 😉

 

Program feedback:

Your loop has a 250ms wait, yet you check if it's passed 250ms since the first loop to decide if you should stop. This comparison will always be true. If it only runs once, do you need a loop at all? If you want to update twice, e.g. before and after the 250ms you can change it to a 2-run for-loop.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 11 of 17
(1,279 Views)

hi,

           is your problem solved...? the best way of reading from pulse input and show as a Speed as RPM, then you can measure as frequency. if possible then you can change your read digital input as a Frequency instead of counter then you can display as its....

 

 

 suppose, your counts gives 60 pulse/ rotation, if you read by frequency then its should be your RPM. if the encoder greater or lesser than 6o counts you can manipulate.

 

i think it must be a right way...... 

Regards,
Balaji DP
0 Kudos
Message 12 of 17
(1,267 Views)

@yamaeda. Thank you for your tips. Regarding the looping, it has to keep counting pulses in intervals of 250ms as long as the test is running. I am monitoring speed constantly. The wait ticks for 250ms and I use stop loop if 250ms reaches to stop counting pulses on the DAQ counter read. Does that make sense?

 

@balaji... Can DAQ USB 6008 actually read pulses as frequency? I have not done that before.. Would it be the same as counting faling edge pulses?

 

VeeJay 😉

I may not be perfect, but I'm all I got!
0 Kudos
Message 13 of 17
(1,248 Views)

hello Veejay,

                      

                        please find the attachments of screen shots. USB 6008 has a 5MHz  with 1 counter inputs, i think for the Speed measurement is enough for this

Regards,
Balaji DP
0 Kudos
Message 14 of 17
(1,216 Views)

@ balaji

 

 I know that there is an option for frequency. I was just wondering how it would interpret my input pulses. My encoder has 6 PPR and right now I am counting falling edges and doing a conversion to calculate speed. If I choose frequency, what will be my output?

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 15 of 17
(1,181 Views)

Hi Veejay,

 

The following article will have some good information on how frequency measurements are made.  If you're talking about a low frequency measurement, the pulse train is compared to the onboard counter timebase.  And the number of timebase ticks between each pulse train tick is counted, which gives us the period and hence the frequency. 

 

http://zone.ni.com/devzone/cda/tut/p/id/7111 

 

I hope this helps!

 

Tejinder Gill
National Instruments
Applications Engineer
Visit ni.com/gettingstarted for step-by-step help in setting up your system.
0 Kudos
Message 16 of 17
(1,146 Views)

Thanks Tejander! That was helpful. But, I dont think direct frequency measurement is possible on a simple USB 6008. It has no hardware timing.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 17 of 17
(1,117 Views)