Instrument Control (GPIB, Serial, VISA, IVI)

cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

VISA Find resource function regular expression

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! 🙂

Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Mensagem 1 de 11
7.535Exibições
How are you assigning the instrument name? MAX doesn't do it automatically. Typically, you would get a list of all serial ports and send a query to each one, look for s specific response, and determine which instrument is connected to which port.
0 Kudos
Mensagem 2 de 11
7.532Exibições

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?

Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Mensagem 3 de 11
7.521Exibições
You said you were looking for GNSS Receiver and now you say you did not assign this to anything in MAX. Where would you think this name comes from? MAX won't list anything except the com port.
0 Kudos
Mensagem 4 de 11
7.518Exibições
Meant to add that you either get the canonical name (ASRLx) or the alias. The alias Comx or an alias you change to.
0 Kudos
Mensagem 5 de 11
7.517Exibições

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":

COM3-GNSS.PNG

 

So I think the function should be capable of reading this, am I right? Maybe we are not understanding each other Smiley Gargalhando

Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Mensagem 6 de 11
7.512Exibições
Yes, I misunderstood. The device name must be coming from the Windows device driver. I've never had such a thing since I've always used generic USB-RS232 converters to connect to serial devices.

Try doing a search where name == GNSS Receiver. Since it seems you want to determine the com port alias, I don't understand why you are specifically just looking for com 3.
0 Kudos
Mensagem 7 de 11
7.508Exibições

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.

Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Mensagem 8 de 11
7.483Exibições

I have this already:

GNSS-in-what-COM.PNG

 

But it would be much cleaner and efficient just with the proper regular expression in the VISA Find... Língua do Smiley

Kindest regards,
Néstor

LabVIEW 2022 + DIAdem 2020 + Windows 11
0 Kudos
Mensagem 9 de 11
7.477Exibições
The regular expression is pretty new to me as well and I have no way to test it right now. How much time does your existing code take?
0 Kudos
Mensagem 10 de 11
7.470Exibições