03-18-2014 07:20 AM
Hi guys,
I've been trying to get which Serial port is a GPS receiver connected to using the VISA Find Resource Function with no luck. The idea is to use a regular expression similar to
ASRL?*INSTR{VI_ATTR_ASRL_BAUD == 9600}
but instead of looking for baud rate, I want to search the value
ASRL3 (COM3 - GNSS Receiver)
as seen in MAX/VISA Test Panel. The attribute name is VI_ATTR_INTF_INST_NAME.
Something like ASRL?*INSTR{VI_ATTR_INTF_INST_NAME == ASRL? (COM? - GNSS Receiver)} should work, but it's not.
How should I write the expression?
Thanks! 🙂
03-18-2014 07:47 AM
03-18-2014 09:46 AM
Hi Dennis,
thanks for answering.
I haven't assigned the name, MAX did it. I just opened MAX and there it was, COM3 (In Devices and interfaces/ASRL3/settings/name). I suppose it gets directly the Windows serial port name, what name do you mean exactly?
Anyway, what I'm interested in getting is the Port description, that would tell me the connected device in that port. I could build a small loop and look for the interface description of each serial device, but I found the VISA Find Resourde function and it seems a more simple and direct way to get what I want.
If I can list all serial devices with 9600 baud rate as in the previous example, why not do the same with the instrument name? I clearly see it when I open the VISA Test Panel. I am maybe missing something?
03-18-2014 10:19 AM
03-18-2014 10:23 AM
03-18-2014 10:41 AM
No, I didn't assign it to anything in MAX, but it's there. I can communicate with the GPS, it's in the COM3 port. And in MAX I can see the GNSS Receiver description in "Port description":
So I think the function should be capable of reading this, am I right? Maybe we are not understanding each other
03-18-2014 11:16 AM
03-19-2014 03:26 AM
Sure, well, COM3 was an example, the idea is to get "COM?".
How would you do the search exactly? I'm kind of lost with the particularities of regular expressions.
03-19-2014 07:56 AM
I have this already:
But it would be much cleaner and efficient just with the proper regular expression in the VISA Find...
03-19-2014 09:33 AM