Archive for July, 2011

Pause and continue the time with Elapsed time.vi in LabVIEW

Sunday, July 31st, 2011

Elapsed Time.vi is a very useful Express vi which returns the elapsed time and can be reseted. Unfortunately there is no pause function in Elapsed Time.vi ( LabVIEW 8.5 to 2009). I had been looking for the examples of pausing and continuing the time in LabVIEW, but there seems not be a simple one.
So I created this myself. It is not efficient in term of excecution time, but it is simple to be made from scratch and memorized.

Basically the shift registers are used to store the previous elapsed time. When it is in the false (run) case, the elapsed time is added to the ‘total elapsed time’. When the vi in the true (pause) case, the total elapsed time is transferred to the start time and the Elapsed Time.vi is reseted (stopped). Hope this will be helpful. 🙂

 

———————–In response to Mark’s question——————————–

So I added the reset function for this SubVI:

When you reset the clock, you simply ‘reset’ it and send ‘0’ to elapsed time. Hope it helps.

Advertisements

Scrolling the mouse wheel to change values in LabVIEW

Sunday, July 3rd, 2011

This is a simple demo using the mouse wheel to control the numeric indicator in LabVIEW. The value of the ‘mouse wheel position’ increases or decreases when we scroll the mouse wheel forwards or backwards.
The reason of posting this is when I tried to using the mouse wheel to control a camera (to zoom in/out) in LabVIEW, it took me a lot of time finding the right example. If this post happends to be the top 3 of your google results, it should save you some time.
This VI was modified from the example ‘Basic Input Demo.vi’ in LabVIEW. Since the windows’s dll only returns the moved (or related) position of the mouse wheel, a shift register was employed to display the ‘absolute’ position.

Sorry that I cannot upload the .vi file for the limitation of wordpress.com. But it is easy enough to re-create this vi yourself from the snippet.
Note that:1. There is no ‘mouse wheel’ triggering event in the event structure (at least before LabVIEW 2009);
2. The .dll file in ‘Acquire input data.vi’ returns only the moved position of the mouse wheel comparing to the position when the dll was called last time;
3. The returned mouse wheel postion was divided by 120 in this demo, which may change according to different mouse setups.
4. The polling event (nodes in the while loop) could be put into the timeout case if you want to use event structure together with it (and the timeout shouldn’t be -1).