LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with "VISA Find Resource "

Hi
I wanted to enumerate the serial ports on the computer so the user could select one of the avaiable seialports from a list .
Searching for the topic I found a vi named "Find_Serial_Ports" but running it an "undefind error code" is reported! It seems as if the "VISA Find Resource.vi " generates the eror but I couldn't find out why.
looking for your posts
Meanwhile is it possible to connect the 2 serial ports for test purposes (sending some bytes to one & watch the reaction of the program that cares about the other port).
Thanks for your attention in advance?
0 Kudos
Message 1 of 7
(6,694 Views)
Hi,
and this my code don't working too?
ASRL1::INSTR is COM 1
ASRL2::INSTR is COM 2

Experession in "VISA Find Resource.vi" for COM Ports must be "ASRL?*INSTR"

JCC
Download All
0 Kudos
Message 2 of 7
(6,694 Views)
If you create a control from the input labeled "VISA Resource Name" on any of the VISA VIs, a drop down control should appear on the front panel containing all of the available serial ports. If you would like to give them a name other than the defaults (COM 1), we can give these ports what is known as a VISA Alias. To do this, go into Measurement and Automation Explorer (MAX) and expand Devices and Interfaces, and then Ports (Serial & Parallel). From here, left-click on one of your ports, and then type in a name for your port in the VISA Alias text box on the right, and then click the Save button at the top. Now this new name should appear as one of the selections in the drop-down menu in LabVIEW.

For the test you are describing, there is a shipping example to
do exactly that. In the Example Finder, search for VISA and then select Basic 2 Port Serial Write and Read. Then use a null modem serial cable to connect your two ports, and run the VI. More detailed information on this VI can be found by going to File >> VI Properties >> Documentation. I hope this example will allow you to test your ports.

-JohnM
0 Kudos
Message 3 of 7
(6,694 Views)
Hi John
1)I couldn't find the example u mentioned(I use LV 7.0)
2)I did connect a control to the the input labeled "VISA Resource Name" but running the vi no list appeared.
3)I don't want to rename the ports but just find available serial ports.(distributing the application I can't probably use your method for other computers)

Best Regards,
A.E.
0 Kudos
Message 4 of 7
(6,694 Views)
Hi
Unfortunately I couldn't open your VI(I use LV7.0).
using "ASRL?*INSTR" didn't help me either.I've attached my vi.
It would be nice if you could provide me the vi in LV7.0 or an earlier version.

Thanks for your attention in advance,
A.E.
0 Kudos
Message 5 of 7
(6,694 Views)
Hi,
Attached you'll find an example I use with LabView 7.0.
It get's a list of all available serial interfaces with its VISA resource names and the interfaces names (like "COM1","LPT1" etc.).
Please note that the "VISA Find Resources.vi" with an expression like "ASRL[0-9]*::INSTR" not only lists the "COM" ports but also the "LPT" ports. For my application I solved the problem by filtering the ports via their VISA interface name property (see my VI). Unfortunatly this filtering only works with ports being currently not occupied by other applications...
Maybe it helps.
Regards

Arno

PS: The VI is being used on Windows platforms. I have no idea about its applicability on other platforms.
0 Kudos
Message 6 of 7
(6,694 Views)

A.E.,

Were you able to find any examples relating to VISA when searching? If not, you may not have the NI-VISA driver installed on your machine. You can download this from the National Instruments website.

VISA Download Page

To find the list of serial ports, the easiest way is to not just connect a control to the input, but to right click on the input and choose Create > Control. This control should then have the serial port names on the front panel, even before the VI is run.

If you do not wish to rename the ports, then it is definitely not necessary. They will just appear as COM1, etc.

-JohnM

0 Kudos
Message 7 of 7
(6,694 Views)