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?
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.
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.
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.
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.
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?