LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB program hangs

I'm using LV to develop a small data acquisition program.  This program will go out into the field with our sales force, and record data from one analog in channel on a USB-6008.  
 
I'm having problems getting the software to run reliably.  I'm using mainly Express VI's.   Basically the user interface works something like a program installation "wizard": there are three steps and only the needed controls are shown at each step.    It first collects some data from the subject person into text boxes, and then walks them through collecting the data and reviewing the data.   During the last step of the user interface, the program frequently hangs when the buttons are pressed.  Sometimes it will come back, but often it will error out with a buffer overrun from the DAQ device.   I've been unable to figure out what/where  it is executing when it hangs.
 
I've also tried putting together the same routines from DAQ primitives instead of express VI's, but I get pretty much the same results.  I'm using LV 8.0, on both W2000 and XP machines. 
 
Is it better to handle GUI button presses as events?  I'm fairly new to Labview, so I may be doing something very basic that's wrong... any advice is appreciated...
0 Kudos
Message 1 of 4
(2,515 Views)
Hello EESniguy,
       When I look at your VI, I see a couple of things that you should change:

1.) Add timing to your while loop.  This will make the loop "go to sleep" and allow other code time to execute.  I recommend a "Wait" function
2.) Serialize your application and use dataflow programming to enforce execution
3.) Take care of all of your initialization outside of the while loop
4.) Confirm that you want to do continuous acquisition with your DAQ device.  The fact that you have the DAQ Assistant set for continuous acquisition and are then going to other portions of your code, is probably the reason that it is giving you a buffer overflow error, that and the fact that your while loop is running as fast as possible

This would be a good use case for an event structure or possibly a state machine.  I recommend that you run the program in highlight execution to see where it is hanging.  I would also recommend that you use great caution when using property nodes to control the tab control.

Cheers,

NathanT


0 Kudos
Message 2 of 4
(2,494 Views)

Thanks for the advice, I've made some changes as you suggested.  It's working well.  The software can now execute the GUI and still keep pace with the hardware.  Execution was indeed hanging in the data collection express VI.  The highlight execution was not very useful, but once I added a timing loop it stopped having the hanging issue. 

I went back to the DAQ primitives to take the data.   I'm impressed that LV can do some very sophisticated analysis and graphing with very little programming.  I'm coming from a VBasic/C++ background.  It does take some practice to get the "threading" of program execution in LV down pat. 

Thanks,

Brian

0 Kudos
Message 3 of 4
(2,461 Views)
Brian,
      I am glad to hear that your application is working well now.  Developing applications in LabVIEW has a pretty quick learning curve and I think it is a very enjoyable tool to use.

Have a great weekend,

NathanT
0 Kudos
Message 4 of 4
(2,449 Views)