A Note about the Current VI’s Path Constant in LabVIEW

By Ralph - Last updated: Wednesday, April 9, 2008

The current VI’s path constant in LabVIEW is often used to make the path of files which are in the same or relative folder of the VI application in our developments. If we use this constant in the development environment, everything is fine, and it works. But, if we build the VI into an executable, it will not find out the associated files because the path made is not correct.

Why this happens?

Because the path of a VI changes when we build it into an executable.

For example. If the VI is called myapp.vi, and it exists in the C:\MyApp directory. And assume that we have built an executable named myapp.exe, which also exists in the C:\MyApp directory. This is what the Current VI’s Path function will return:
In the LabVIEW development environment: C:\MyApp\myapp.vi
Running the executable (myapp.exe):C:\MyApp\myapp.exe\myapp.vi

So, when we have an executable, we actually need to strip the path twice to get to the correct directory.

Filed in LabVIEW • Tags: , , , , , , , ,

A Better Way to Program Controls of the Same Kind in LabWindows/CVI

By Ralph - Last updated: Sunday, April 6, 2008

Usually, there are only one or two controls of the same kind in a normal VI(Virtual Instruments, computer based measurements and automation systems) application. And, we can write the callback functions of these controls one by one in LabWindows/CVI. But, if there are more than four in number of the same kind of control, it’ll be a hard work to write the callback functions one by one for them.

If the controls have similar functions, it’s a better idea to make them use the same callback function. It save a lot of time and make the program short and simple. Every control on the UI(User Interface) has a unique reference ID, we could build an array of reference IDs to store the ID information of every control on UI. And, in the callback function, the parameter “control” can be used to identify which control is functioning. And a loop in the callback function can be used to find out the right execution code and run it.

Code can be like this:
Read the rest of this entry »

Filed in LabWindows/CVI • Tags: , , , ,

Three Principles to Follow when Design LabVIEW Applications

By Ralph - Last updated: Thursday, April 3, 2008

When using LabVIEW to develop huge and complex applications, we would encounter many problems not only the same as we use text based programming languages but also some problems which are unique for LabVIEW. LabVIEW is a graphic based programming language, it free us from the worry of syntax error and memory problems, but on the other hand, in my option, it also have some disadvantages like not very good at large project management like other text-based programming languages. Since the version 8.0, LabVIEW has added some features to make itself a better programming tool at project managements. I think it will be better and better.

To make LabVIEW a good tool in huge and complex applications development, we should follow three principles: scalable, readable, and maintainable.

Scalable: The VI designed should be easily to be modified, and it allow us to add functionality to it. We should use good design practices to create VI which is scalable, think about the design early in the design process to make sure it is scalable for future modification rather than a fixed non-scalable VI for current application only. When designing any application, we should consider the purpose of the application and how to manage changes when the scale of the application goes beyond the original specification.

Readable: When working with LabVIEW, we should make the diagram code structured, easy to read and easy to understand. And the easy to read and understands leads to easy to maintain.

Maintainable: When we develop VIs, we should make it easy to add new features without completely redesigning the VIs. We should use forethought to design and create VIs to make sure they are more maintainable.

Filed in LabVIEW • Tags: , , , , , , ,

Create a Tri-State LED Indicator in LabVIEW

By Ralph - Last updated: Wednesday, April 2, 2008

Under some conditions, the traditional boolean LED indicator is not enough to indicate the test result. For example, before the test finish, the status of current UUT(Unit Under Test) is unknown, which value should be displayed, the green TRUE with the meaning of success or red FALSE with the meaning of fail? Both are unacceptable, it’s better to use black color to indicate an unknown status.

But the default LED indicator in LabVIEW has only two state: FALSE and TRUE, it’s not possible to use it to display three status. So, some programming is needed to create this tri-state LED.

Here is what I have done to make this happen:
The front panel, one enum control and one LED indicator:

The property of the enum control: Read the rest of this entry »

Filed in LabVIEW • Tags: , , ,

Create a Custom Control in LabVIEW

By Ralph - Last updated: Wednesday, March 19, 2008

Sometimes, the built-in controls or indicators are not enough for our applications. Then we must use custom controls and indicators to extend the built-in set of front panel objects of LabVIEW. We also can save the custom control or indicator you created in a directory or LLB and use the custom control or indicator to other applications. And we also can create an icon for the custom control or indicator and add it to the controls palette.

Here, I’ll show how to create a custom Boolean indicator. The built-in Boolean indicator in LabVIEW is an LED lamp, but in some condition, it is not appropriate. Under conditions like to display the results of hardware, it is not a good idea to use the built-in LED lamp with the red lamp to indicate fail and green one to indicate success. If we use the symbols below to display the results, it’ll be much better.

custom-icon.PNG

Here, I’ll show how to create such a Boolean indicator in LabVIEW.

First, put a Boolean indicator on the front panel, then use mouse right click it, in the pop-up menu, select Advanced, Customize… like below:

first-step.PNG

Then, we are in the Control Editor Window. The Control Editor window toolbar indicates whether you are in edit mode  or in customize mode. The Control Editor window opens in edit mode. Click the Edit Mode button to change to customize mode. Click the Customize Mode button to return to edit mode. Here we switch to Customize Mode, like below:

 

second-step.PNG

 After that, we must place a copy of the graphic in the clipboard. You may put the custom graphic in some kind of graphic editor, select it and use mouse right click it and select Copy to Clipboard. Then right click the LED lamp and select Import Picture from Clipboard, like below.

 

step-three.PNG

Do the same again with another status. It’s quite simple. After all above done, we get the custom indicator, then use menu File–Save to save it. If we put it on the front panel, it’ll like the picture below:

 final.PNG

 We can use it on other panels as well too.

It’s a very simple control. Some complicated controls can also be created in LabVIEW, for more information, you can click this link to study more on the NI website.

Filed in LabVIEW • Tags: , , , ,

VI Geek – My New Tech Blog Start Now

By Ralph - Last updated: Monday, March 17, 2008

I have been in the industry of Virtual Instruments for over 10 years, and dedicated in the development of Virtual Instruments systems for over 7 years. The first time I touched the concept of PC based test system is at the year of 1998. At that year, I established a PC based optical fiber light power dynamic acquisition system,  which use a notebook with a PCMCIA DAQ card to acquire the light power when the optical fiber is in a dynamic  movement status. The PCMCIA DAQ card was from IOTech, which is now a part of the NI. At that time, the  concept of Virtual Instruments was not very popular.

Since then, I was very interested in this area. And, luckily at the year of 2001, I began to work for one NI Alliance company as a software engineer, and after that company, I worked for another NI Alliance & Reseller.  At the beginning, I used the LabWindows/CVI version 5.5 to build custom VI systems (PC based test and control systems) for customers, and later I began to use LabVIEW  to build custom VI systems for customers.

Today I establish this blog site to share my experience and knowledge with everyone who is also interested. Hope I can learn a lot more here.

Good luck!

Filed in Misc
Pages: Prev 1 2 3 4