Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a COM port identifier?

Hello,

 

I have a problem I thought would be easily solved. But finally I can't find the solution myself.

 

Under Windows (XP), if I go into the Device Manager, I can see the list of my hardware, including the COM ports. I can see there an "identifier" of the port. For example, if I plug an USB to RS-232 converter (FTDI), I can see its name.

 

How can I have access to this identifier under LabVIEW?

 

Thank you in advance for your answer.

0 Kudos
Message 1 of 15
(9,392 Views)

I have exact same problem !!

 

For FTDI, My device manager can show not only COM port, but also the identifier etc.

But neither can my LabVIEW, nor can my NIVISA ?

 

Please, please help !

 

 

 

0 Kudos
Message 2 of 15
(9,390 Views)

I don't quite understand what information you are trying to get, or why it would matter. As far as LabVIEW (or any application for that matter) is concerned, all it sees is a COM port - it doesn't care where it came from or how the OS manages it. I suppose if you really wanted that information you could just use the devcon command line utility by calling it from System Exec and parsing the output.

0 Kudos
Message 3 of 15
(9,377 Views)

Let me explain if u care....

 

We distribute "instruments+software" to customers.

 

Instrument use USB to virtual com port (and FTDI driver).

Means device manager not only shows COM port, but also shows unique instrument's string.example

COM10: AMCAR:13456

 

My first problem is NO National instrument software can give me this string.

I get it via windows "seacher.Get()" call.

 

Is there any way I can get it via National Instruments software ?? This is my basic problem.

 

Problem 2:

Now, I try to get around with this frustating problem. I do the following:

What I do is I get this string at least from "Searcher.Get()" call. i.e. COM10: AMCAR:13456

Then I cut it down to COM10. So now I can use this to communicate via VISA (I still want to use VISA, at least to communicate via VISA).

 

But VISA likes ASRL methodology. So I convert this COM10 to ASRL10:INSTR.

 

But guess what, VISA is still not cooperating? ...

VISA looks at the same COM10, as ASRL5 !...Yes that's right...

COM10 is mapped to ASRL5:INSTR. And it's not consistent.

 

How am I supposed to know COM5 (to device manager) is same as ASRL5:INSTR ?

Remember, we are distributing this and autmation.

 

See picture. Can someone help ?

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 4 of 15
(9,365 Views)

 


@Sandeepvd wrote:

Let me explain if u care....


 

You know, you don't have to be so sarcastic about it. I'm wondering now why I even bothered to try to help you.

0 Kudos
Message 5 of 15
(9,360 Views)

smercurio_fc, I am Sorry.

Not because i am afraid you may not reply, but indeed it was my mistake ( out of my frustation...was nothing to do with your reply). Sorry. and Thanks for being generous to point it out.

 

Coming back, wouldn't you expect that COM10 is mapped to ASRL5 ?

Or even before that, wouldn't you expect VISA can give you with some attrributes the same info, that microsoft gives ?

 

 

 

 

 

0 Kudos
Message 6 of 15
(9,356 Views)

The COM1, COM10 that you see in MAX are VISA aliases. They don't need to map to the same ASRL numbers at all. The alias can say anything you want - instead of "COM1" it could say "Serial1" or "Beetlejuice". As far as actual code is concerned, VISA will accept either the "ASRL" designation or an alias. As long as the alias exists in MAX you can use it with VISA - it won't make a difference. You have to keep in mind that the COM numbers are assigned by the operating system. They have no meaning to VISA. VISA knows aliases (which can be anything you want) and ASRL numbers. A similar question had been asked a while ago.

0 Kudos
Message 7 of 15
(9,338 Views)

I have the impression I am not good in VISA and COM ports because I have not understood half of what you said. Indeed, it is the first time I am looking for something specific in this way. Let me explain...

 

Like Sandeepvd, we are distributing instrument with software. The instrument is FTDI driven through USB. The software must be plug & play (it must find the right COM port by itself). Of course, on each computer, my USB COM port emulated device is every time set on a different COM number. So I cannot use a fixed COM port number.

 

When I open the Device Manager (under Windows, see DeviceManager.jpg), I can see all my COM ports. I can find my device (in fact, this not my device but any USB-RS-232 converter, but this doesn't matter) in COM8. It is called "Serial On USB Port". I expected to be able to search for this string under LabVIEW.

 

I used the "VISA Find Resource" VI with "?*" as input to find all my present devices. The list it gave me back is found in VISAfindResource.JPG. I see there ASRL numbered instead of COM ports and they are all called INSTR. Despite the fact that I don't really understand that, how can I find my "Serial On USB Port" string ???

 

Sorry if I explain my troubles with too simple words, but I wanted to explain it as clearly as possible.

 

Thank you very much.

Download All
0 Kudos
Message 8 of 15
(9,308 Views)

smercurio_fc, Thank you for reply.

smercurio_fc said: “The COM1, COM10 that you see in MAX are VISA aliases. They don't need to map to the same ASRL numbers at all."

I see. It’s fine if they are not mapped same (like COM1:ASRL1:INSTR) as long as programmer has a way which COM (assigned by Windows) is mapped to which ASRL (assigned by VISA)

 

#1 Device Search problem:

smercurio_fc said: “The alias can say anything you want - instead of "COM1" it could say "Serial1" or "Beetlejuice".”

In this case, it’s software program accesses serial ID (either COM or ASRL) at run time on the customer’s computer. Programmer or user can not have manual intervention.

 

Currently my software program

- if does it searcher.get (Windows native) way, I get the following string: COM10:ModelASDF:SR12345; where ModelASDF is isntrument’s model number and SR12345 is unique serial number. This info is retrieved by searcher.get from FTDI (USB to serial) virtual COM port driver.

- On the other hand if software program does it VISA way, it only gets ASRL5:INSTR

 

#2  Device Communication Problem: Now, in the above case, even after accepting that VISA is not giving the program the same string, I still want to use VISA.

So what I do is from the string I have received i.e. from COM10:ModelASDF:SR12345, I shave this string to COM10.

Now VISA still does not like it, hence I make it “ASRL10:INSTR”

But following is problem2:

Even if I map it COM10 --> ASRL10:INSTR, VISA itself (that I see in NIMAX) looks at it as ASRL5:INSTR.

So when I provide the string ASRL10:INSTR to VISA open etc. calls, it’s not going to work since VISA looks at it as number 5.

 

How do I identify that system has mapped COM10 to ASRL5 ? This needs to happen auomatically.

 

Thanks

0 Kudos
Message 9 of 15
(9,306 Views)

Hi,

 

I use FTDI device in testsetup's. I don't know in advance what COM port the FTDI device will have on another computer.

I program the FTDI device (with FTDI Mprog) with a unique identification. Using the FTD2xx.ddl you can retrieve the COM port number for that device and use that to access the port.

 

Works all the time.

0 Kudos
Message 10 of 15
(9,302 Views)