A Better Way to Access Variables in Complex Programs in LabVIEW

By Ralph - Last updated: Monday, September 28, 2009

In some LabVIEW programs, we need to access the value of a variable which is inside a loop from outside before the loop is over.

Most of us will use a local variable of a indicator to do this job. But this is not a good way to do this job. For example, if you use multiple locals in multiple places all linked to the same indicator, it’ll make it very easy to lose your control of the timing of the data. And in a worse condition, if you write the local variable in multiple places in your program, it will make a nightmare for sure. SO, it’s worthy to note that try not to use local variables unless absolutely necessary.

The best way to do this, I get so far, is passing data through a queue which will adds some kind of complexity, but you will have the full control of the data especially in a much complex program which has a lot of loops and much demands of data timing.

Filed in LabVIEW, VI Software • Tags: , , ,

A Note about DAQ Assistant and 200279 Error in LabVIEW

By Ralph - Last updated: Friday, July 17, 2009

Just a few days ago, I created a simple LabVIEW program which read about 32 channels at 2KHz and display the data and write the data into file. The program is quite simple, so I used DAQ Assistant and Measurement File Express VI to read and write the data in one loop as the following graph  shows:

Read the rest of this entry »

Filed in DAQ, LabVIEW, VI Software • Tags: , , , ,

Change Windows XP Environmental Variables in LabVIEW

By Ralph - Last updated: Friday, July 17, 2009

The Windows XP’s environmental variables can be changed in Windows’ control panel. And if you want to change these variables in LabVIEW, you can use the System Exec function and the command “path=dir1; dir2; dir3” together to realize it.

Using “cmd/c path=dir1;dir2;dir3” as the input parameter to System Exec function in your LabVIEW program will change the Windows XP environmental variables. In fact, you can execute all commands of Windows in System Exec function in LabVIEW.

Filed in LabVIEW, VI Software • Tags: , , ,

Make Artificial Data Dependency in LabVIEW

By Ralph - Last updated: Wednesday, March 25, 2009

Sometime, we need the data flow in LabVIEW not to be naturally. In this case we can use sequences structure or artificial data dependency to realize it.

But, usually a single frame sequence with an error wire or other data wire is sufficient. A multiple case sequence structure is not needed. If you use artificial data dependency in LabVIEW, my advice is to add a note to the diagram to explain why the unused signal is there. Otherwise someone may remove it in the future because it appeared to be unnecessary and so the data dependency will be missing. And it’s a good idea to create a subVI for the portion of the code which has not a natural data dependency and add error clusters in the subVI. Then the subVI allows the data dependency and may have the bonus of reducing the space on the diagram.

Filed in LabVIEW, VI Software • Tags: , ,

How to Change Axis Name of Graph Control in LabWindows/CVI

By Ralph - Last updated: Tuesday, March 24, 2009

We can use the SetCtrlAttribute function to change an Axis name programmatically in LabWindows/CVI. Just set the ATTR_XNAME or ATTR_YNAME attribute to any name you’d like to use in this function.

For example, change the top X-Axis name of a graph, we can use the following code.

// Make the top x-axis the active one
SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_ACTIVE_XAXIS, VAL_TOP_XAXIS);    
// Set the name
SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_XNAME, "Axis Changed");
Filed in LabWindows/CVI, VI Software • Tags: , ,

A Few Documents about Communication between Real-time and Host PC

By Ralph - Last updated: Tuesday, March 24, 2009

I have to admit that NI’s support is very helpful. Because I need to make real-time machine to communicate with Windows based desktop PC in my recent project, I try to find a few tips in NI’s website, and I get everything I need about this problem.

The following are the documents about RT communication. Maybe I’ll need them later.

Real-Time VI to Host VI Communication Methods

Real-Time FIFO for Deterministic Data Transfer Between VIs

Real-Time FIFO Example

Filed in LabVIEW, Network, VI Software • Tags: ,
Pages: Prev 1 2 3 4 Next