Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to refresh visa resource list

Hi,

 

I have a device connected on COM4 of the system. Initially LabVIEW finds it. Then I send a RESET command (VISA write) to this device connected on COM4. As a result of the RESETcommand, the COM4 momentarily closes and reopens. But when it reopens, LabVIEW is not able to find COM4, as shown in the first picture below. The second picture below is my block diagram where I am trying to find COM4, so that when COM4 re-appears, I can proceed with sending other commands to this device. The third picture shows, that when COM4 does reappear (after closing first), the OS is able to find it but LabVIEW does not (in the first picture).

 

The question is, How can I have LabVIEW refresh and find COM4 in the VISA resources list?

Thanks

Jeet

0 Kudos
Message 1 of 8
(6,850 Views)

Hi jeet,

 

Based on the code snippet you attached, the VISA resource list is programatically created. If you call the VISA reset function, this list won't update until you run the block of code again, since the list is a static array of strings. 

0 Kudos
Message 2 of 8
(6,812 Views)

Hi Kevin,

I am sure I have fully understood what you are trying to say. I think you are saying that the I put the block of code (that searches for COM4) in a separate VI and then use open VI reference for that VI, call the VI and then close the reference. However, I am not exactly sure how to do it. I've attached my VI that I am currently working with.

Thanks,

Jeet

0 Kudos
Message 3 of 8
(6,800 Views)
I don't quite understand the suggestion either. I think you'll have better luck using the System Configuration functions, though.

I'm also curious how resetting a device can cause a reset of the com port. I've reset a countless number of serial devices without any glitch of the port itself.
0 Kudos
Message 4 of 8
(6,781 Views)

Jeet,

 

Sorry, I didn't understand how that snippet of code worked into your overall program. I thought you ran that code, let it finish and then called the reset function, though I can see that it is not the case in the vi.

0 Kudos
Message 5 of 8
(6,763 Views)

Hi

COM4 disappears is because it not a physical port. The device connected is actually a USB device and it has an internal FTDI chip (USB to RS232) which appears as COM4. As the microcontroller inside the device resets, it also makes the COM4 (Virtual COM port) go away and reappear. But when it reappears, LabVIEW does not see it but device mangar does. That is the problem.

Thanks

Jeet

0 Kudos
Message 6 of 8
(6,752 Views)

Alright, I understand what you mean now. Do you know if it appears in MAX correctly?

0 Kudos
Message 7 of 8
(6,718 Views)

I am having the same issue.  The USB device I am communicating with goes into a sleep/power down state and NI-VISA and NI-MAX doesn't appear recognize the device once it wakes up. 

 

Windows Device manager is able to successfully recognize and re-enumerate the device.

 

Is there a way to programmatically refresh the list of serial devices NI-VISA or NI-MAX? 

0 Kudos
Message 8 of 8
(1,623 Views)