LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When I press Stop button, the Labview program hangs

I construct a vi to read values from GPIB devices real time, and store the Values in a file. I put the driver inside a for loop, ie. every iteration i will get values from GPIB device and store the value into a spreadsheet file. but when i try to stop the VI running half way by click the stop button on the tools bar, the Labview program hangs..i have to ctrl+Alt+del to close it. my GPIB control is written by VISA.(OPEN-WRITE-READ-CLOSE)...any can help me? Thanx.
0 Kudos
Message 1 of 7
(4,149 Views)
We have run into similar problems with LabVIEW hanging or dumping entirely (back to Windows desktop - LabVIEW not even in memory). The fix for this was to always close the GPIB (or in our other case Arcnet) session. I do this by running a parallel loop to the main loop that is looking for a press on an ABORT button. When the ABORT happens, close the sessions and then use the STOP.vi.

See if this helps. Sounds like the problem is the open GPIB session.

Rob
0 Kudos
Message 2 of 7
(4,149 Views)
Hi

While communicating with instruments, my experience has been that it is more
useful and elegant to stop the VI by using the "STOP" vi available on the
function palette within your loop along with a push button or so on the
front panel rather than using the Stop button on the top.
Your program will be smoother this way.

Ajay

"cpu" wrote in message
news:506500000008000000182B0000-999158726000@exchange.ni.com...
> I construct a vi to read values from GPIB devices real time, and store
> the Values in a file. I put the driver inside a for loop, ie. every
> iteration i will get values from GPIB device and store the value into
> a spreadsheet file. but when i try to stop the VI running half way by
> click the stop button on the tools bar, the Labv
iew program hangs..i
> have to ctrl+Alt+del to close it. my GPIB control is written by
> VISA.(OPEN-WRITE-READ-CLOSE)...any can help me? Thanx.
0 Kudos
Message 3 of 7
(4,149 Views)
then i just put the "STOP" within the same loop as the GPIB VISA (OPEN-WRITE-READ-CLOSE) stays. Is it true that when user presses the STOP button, the program will not stop until VISA session closes,since they are in the same loop?
0 Kudos
Message 6 of 7
(4,149 Views)
I see no reason to use the STOP function at all. There should be a visa open session outside the loop. Inside the loop should be just the visa write and read (and your logging). Use a while loop instead of a for loop. The front panel should have a stop button that terminates the while loop but not until the visa read has completed. After the while loop terminates, a visa close should be executed. If you terminate the VI before having done a visa read, you'll leave the instrument with information in its output buffer and if you terminate the vi without doing a visa close, you'll end up with with a lot of open visa sessions.
0 Kudos
Message 7 of 7
(4,149 Views)
As others have done, i'd recommend you to close the program with a stop button, but be sure you only open the session once, and so you do with the close option. Put them outside the loop, this way, you only open GPIB once, pass the reference into the loop, read/write as much as you want, and place the close session vi outside, so that it closes only when the loop is over.
Hope this helps
0 Kudos
Message 4 of 7
(4,149 Views)
The name of that button is abort, NOT stop !
So you have to wait until the gpib drivers notices this abort. Or better not use it for a running program.
greetings from the Netherlands
Message 5 of 7
(4,149 Views)