Showing results for 
Search instead for 
Did you mean: 

Optimization Labview VI

Go to solution



I would like to optimize this code ( HMI Pop Up Alpha KB ).

This is a sample VI but it's not very optimized.


This VI simulates an alphanumeric keyboard intended to be used on a touchscreen PC. The input control can be set for standard or password display.


PS:I do not think of what I do more to optimize it.


Thank you

0 Kudos
Message 1 of 3

Looks pretty simple and works really well.


The only optimization I tihnk you could but is to get rid of the timeout thats happening every single time even though the code only runs on first call.


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'

0 Kudos
Message 2 of 3
Accepted by eecharlesbr

Remove the Timeout.  Place the code that needs to run before the Data Entry Loop (are you ready for this? ...) before (meaning outside and to the left of) the Data Entry Loop.  Use the Error Line to connect them in serial order, and bring the Error Line into the Data Entry Loop.  


The Error Line is your Friend -- use it!  Every sub-VI should have Error In and Error Out terminals wired to the Lower Left and Lower Right connectors.  Error Lines should run through your code, and it should be utilized.


In HMI Pop Up Alpha KB, you have Current VI Path wired to Open VI Reference.  The VI Server Reference "This VI" does, I think, the same thing.


Don't use Local Variables.  In HMI Pop Up Alpha, replace the Tunnel carrying Text in the While Loop with a Shift Register, and have the Text indicator wired to it.  It will then auto-update, removing the need for (bad) Local Variables.  Note you'll need to wire the Text wire through the Event structure as well so you can update it from the KB Driver when needed.


Bob Schor

0 Kudos
Message 3 of 3