LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My VI is hanging up and suspending execution when Visa Error occurs - need help to find a solution

Hello,

 

I am running a VI and intermittenly the execution of the VI is being suspended. I cant even stop the application using the abort button. I operated the NI I/O trace program and setup the scan options to provide a dialog box when there was an error with the VISA API functions. When a VISA error occurred, the program VI execution suspended and the program "froze" up. I have attached a copy of the NI I/O Trace when the program freeze occurred. The error that occurred was the following:

 

> 1000.  viWaitOnEvent (COM27 (0x0D7FCDD8), IO_COMPLETION, 0, 0, 0x00000000)
> Process ID: 0x000001F8         Thread ID: 0x0000166C
> Start Time: 09:34:08.690       Call Duration 00:00:00.000
> Status: 0xBFFF0015 (VI_ERROR_TMO)

 

I have a VISA device connected to this COM port.   Seems like the Visa VI is timing out. Is there a way i can circumvent the application freezup if an error occurs.

 

Can i please have some advice on how to fix this error  with the timeout?

thanks in advance.

0 Kudos
Message 1 of 10
(3,689 Views)

Can you post your code or at least a screenshot of how you're doing your VISA calls?

I think that would help more than the IO Trace report.

0 Kudos
Message 2 of 10
(3,665 Views)

Hello, thanks for your prompt feedback. i appreciate it. the screen shot where i do the VISA call is attached.

0 Kudos
Message 3 of 10
(3,661 Views)

Your setup looks ok. What about your VISA Read and VISA Write Calls?

0 Kudos
Message 4 of 10
(3,649 Views)

Thanks so much for your prompt feedback. attafhed is the visa read and write calls that i am using.

Download All
0 Kudos
Message 5 of 10
(3,638 Views)

OK. So it looks like there could be a failure on your VISA Write.

How are you doing your error handling? Right now you're packing it into a shift register. It's not clear where this error is getting handled. If it is not handled properly, it may lead to unresponsive behavior.

 

Are you running in the development environment? Have you been able to trace back into the block diagram to see where you are getting stuck?

 

Also, it's not clear from the IO trace but it looks like you're swapping COM ports. Are you doing this in your program?

0 Kudos
Message 6 of 10
(3,613 Views)

hello, thanks again for your prompt feedback. We are not swapping com ports in the application. As for error handling and updating the write function what would you suggest i do to modify the software code ?

0 Kudos
Message 7 of 10
(3,600 Views)

in addition, we are using the labview debug environment.

0 Kudos
Message 8 of 10
(3,599 Views)

OK. If you're running in the development environment, you should be able to switch to the block diagram when the program hangs and do a highlight execution to see where the program is going.

 

I expect that the error is causing it to bounce between states and create the appearance of a hang.

 

You may also want to put in a specific error handler for the case when the VISA Write times out. I have no idea why the VISA Write would be failing. The failure should be handled more gracefully by your error handler though.

 

Did you write this code? The string-based state machine looks fairly sophisticated so I would be surprised if it didn't already have a built-in error handler.

0 Kudos
Message 9 of 10
(3,593 Views)

@MaizeBlue wrote:

hello, thanks again for your prompt feedback. We are not swapping com ports in the application. As for error handling and updating the write function what would you suggest i do to modify the software code ?


If you're not, then why does your NI trace show come 11, 27 and 29 all being used?

0 Kudos
Message 10 of 10
(3,580 Views)