11-12-2010 08:41 AM
Hey guys,
I am trying to loop through my available COM ports to see which serial port my device is connected to. When I run my VI, it stays at COM1 and never goes to the next COM port. Am I at least on the right track?
Any help is appreciated.
Eric
Solved! Go to Solution.
11-12-2010 08:48 AM
You do not have any code that changes the port you set with the front control.
The shift reg does not automatically change to the next comport
Use the VISA Find resource and a FOR LOOP to go through the Array of com ports that it find.
Use the conditional terminal of the FOR LOOP to stop the for loop when your device is found.
Omar
11-12-2010 08:51 AM
You are passing in a single Com port VISA reference through a shift register and never changing it.
Try passing in an array of VISA references set for each possible comport and use autoindexing to try each one in turn. You could also programmatically build the reference as a string "Com1","Com2", etc.
Don't forget to close your VISA reference after each attempt so that LabVIEW doesn't open a valid com port that doesn't have your device and then leaves it open because it never bothered to close it.
11-12-2010 09:32 AM
OK, I've gotten the VISA Find Resource and created a indicator off of the 'find list' wire. I'm lost from here.
I've only used LabVIEW a handful of times and not used to this interface quite yet.
11-12-2010 09:38 AM - edited 11-12-2010 09:42 AM
Just auto-index a for-loop:
EDIT: Saw the requirement to stop once you got a connection. In that case, just use the conditional terminal.
11-12-2010 09:54 AM
I would check for a correct reply from your insturment instead of a error on the Visa Read if there are other devices on other com port.
The other devices that you are not looking for might still reply to your "P" if only to reply with an "Invalid command reply".
11-16-2010 10:51 AM
One more question...
In your For Loop, how did you get the small red corrision(sp) dot to appear? I've tried to duplicate it but I can't seem to figure this out.
Thanks.
11-16-2010 10:59 AM
I still have the little red dot going into the VISA Open on my code
But you type case the string to VISA ref to get red of the red dot if you like.
I would not worry about it.
04-20-2018 10:14 AM - edited 04-20-2018 10:15 AM
Having a similar problem. when I use the Code provided I get active comport but not their "windows description"
IE..
I run the code I can see
Com 1
Com 3
ect..
or I can change to ASRL and see
ASRL1::INSTR
ASRL3::INSTR
but when I look in "Ports and coms" (Device manager) I see a description like
USB-SERIAL CH340 (COM1)
this is the info I need to find the instrument I'm looking for.. any idea how to get labview to display that list?
Thanks
04-20-2018 10:22 AM
Drop a VISA Property Node on the block diagram and select the property Interface Information -> Interface Description.