01-12-2012 12:00 PM
I would like to use VISA Find Resource to identify which USB port on my PC (Win7) has a live connection with my instrument. I then want to search the identified USB ports for the signature data feed of my instrument. I have already accomplished this on my Mac (OSX Snow Leopard) and my compiled VI runs well as an .app and is used by our field crews.
In an attempt at platform expansion, I want to duplicate our .app into an .exe but I ran into a problem with the Find VISA Resource subVI. It seems the PC handles things differently? Is this true? It seems the output from Find VISA Resource is not compatible with the input of VISA Configure Serial Port on the PC version. Hopefully I am missing something minor and this is not a major bother to you helpful people. Ideally this "search and identify" task happens at the VI startup and is invisible to the user.
Attached is a portion of the MacOSX VI (it might be clunky code) that I am attempting to convert to the PC platform. Any ideas would be helpful. I searched the forums already and couldn't find this exact problem.
Thanks.
01-12-2012 02:01 PM
I'm not so sure about VISA Resource finding USB ports, but if your instrument is binded to VISA or perhaps is a virtual com port, it should find it.
The problem with your VI is how you are indexing into the while loop. If you want to find the VISA resources then choose one, you might do something like I have attached.
01-17-2012 02:03 PM
Quite an elegant piece of code you provided, thank you for that alternative solution. It has helped me isolate my particular problem and leads me to this direct inquiry of the forums. I can't figure out why this happens:
1. Create a CONFIGURE SERIAL PORT vi
2. Create an EMPTY STRING CONSTANT vi
3. Connect EMPTY STRING CONSTANT (string) to CONFIGURE SERIAL PORT (Visa Resource Name - file I/O))
At this point, the VISA Resource Name on Configure Serial Port happily turns from a file input to a string input.
4. Change EMPTY STRING CONSTANT vi to FIND VISA RESOURCE vi
5. Connect FIND VISA RESOURCE output (string) to CONFIGURE VISA RESOURCE input (file I/O)
On a Mac this is acceptable and I can proceed with coding. On the PC this is disallowed and I cannot proceed.
A. Will someone please tell me why this is so?
B. Is there a way I can simply change the FIND VISA RESOURCE output to something the CONFIGURE VISA RESOURCE vi will accept as a file input?
This is the solution for which I am searching. I truly appreciate the effort and time put into the fantastically workable vi offered above. The only problem with me using it in my particular case is that I cannot use it to write a vi that is compatible for both Mac and PC (case structure defining platform at beginning of vi) as the PC version will not accept my "Mac" case described above as a viably wired diagram (bonks on the string to file I/O).
Thanks!
01-24-2012 11:45 AM - edited 01-24-2012 11:45 AM
Still hoping someone can tell me how to wire VISA Find Resource to VISA Configure Serial Port on a PC running Win7. Thanks!
01-24-2012 11:59 AM
Are you just trying to convert a string to a VISA Resource name?
If yes, just do this:
01-24-2012 12:14 PM
The question makes no sense. The output of the VISA Find Resource is a string array and since it is auto-indexed through the while loop, the wiring is just fine. There is no need to convert a string to an actual VISA Resource data type.
01-24-2012 12:17 PM
Yes, I hope that is all that is necessary. What is the name of the VI in your image please?
Thanks!
01-24-2012 12:20 PM
@CodeMunkee wrote:
Yes, I hope that is all that is necessary. What is the name of the VI in your image please?
Thanks!
Why do you even care? As I said, there is no problem wiring a string to the VISA Configure Serial Port. Your original VI seems just fine.
01-24-2012 12:20 PM
The question makes sense.
If you are referring to my example .vi in my first post, that code is from OSX and works perfectly. When the same VIs are applied in LV on a Win7 platform, the wiring will not connect as the same data type. My question is simply, why is this so? And more importantly, how do I get around it?
01-24-2012 12:24 PM
There is nothing to get around. The input to the VISA Configure Serial Port will accept a string. Everything should still work assuming it worked on the mac. If you get an error when the VI runs, you need to provide the error number that you are getting.