Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing Serial Visa doesn't work

I've got a vi in LV 8 that won't seem to close the serial ports after using them. I am using the VISA close at the end of my VI rather than at the end of each serial port access and I am wondering if that could be the cause of the problem.
 If I end the VI completely, the ports get released and other applications can use them, but I need to be able to close them from within the VI and not have to exit out to gain access again.
 I'm using "COM1" and "COM2" as the inputs to the VISA close and I know those port names are valid since that's what I use to open the ports.
0 Kudos
Message 1 of 3
(3,197 Views)
Hello,

You have to close each session separately. Please refer to the Basic 2 Port Serial Write and Read.vi located under LabVIEW Help » Find Examples » Hardware Input and Output » Serial. Run the example program and if you are still experiencing problems, reply back with a NI Spy Capture. The following KnowledgeBase article shows how to perform a good NI Spy Capture.

Performing a Good NI Spy Capture for Debugging/Troubleshooting

Thank you,
Simran K
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,170 Views)

Hi,

 Closing the port after the receive is not an option since the incoming message data is asynchronous to the LV program and the length of the receive string varies, depending on the response message.

 I was able to solve the problem by closing the port only after the send sequence, but leaving it open following the receive.

Thanks again.

 

0 Kudos
Message 3 of 3
(3,141 Views)