JPrevost Posted February 13, 2006 Report Share Posted February 13, 2006 Maybe I'm missing something easy but how does one go about displaying only found and avail serial ports to the user in a nice "user friendly" name like COM1 instead of ASRL1::INSTR. Thanks in advance. I did user the; [ALIASES] Alias0 = "'LPT1','ASRL10::INSTR'" Alias1 = "'COM1','ASRL1::INSTR'" Alias2 = "'COM2','ASRL2::INSTR'" Alias3 = "'COM3','ASRL3::INSTR'" Alias4 = "'COM4','ASRL4::INSTR'" Alias5 = "'COM5','ASRL5::INSTR'" Alias6 = "'COM6','ASRL6::INSTR'" Alias7 = "'COM7','ASRL7::INSTR'" Alias8 = "'COM8','ASRL8::INSTR'" NumAliases = 9 to get those friendly names but now they're ALL listed to the user when only a couple are really there. My other alternative is to do a polling of the serial ports to see which one is most likely the port with the hardware connected... totally removing the user from the picture Quote Link to comment
orko Posted February 14, 2006 Report Share Posted February 14, 2006 Maybe I'm missing something easy but how does one go about displaying only found and avail serial ports to the user in a nice "user friendly" name like COM1 instead of ASRL1::INSTR.Thanks in advance. I did user the; [ALIASES] Alias0 = "'LPT1','ASRL10::INSTR'" Alias1 = "'COM1','ASRL1::INSTR'" Alias2 = "'COM2','ASRL2::INSTR'" Alias3 = "'COM3','ASRL3::INSTR'" Alias4 = "'COM4','ASRL4::INSTR'" Alias5 = "'COM5','ASRL5::INSTR'" Alias6 = "'COM6','ASRL6::INSTR'" Alias7 = "'COM7','ASRL7::INSTR'" Alias8 = "'COM8','ASRL8::INSTR'" NumAliases = 9 to get those friendly names but now they're ALL listed to the user when only a couple are really there. My other alternative is to do a polling of the serial ports to see which one is most likely the port with the hardware connected... totally removing the user from the picture The VISA resource name (taken off of the reference output of an Visa Open primative) can be wired to a Instrument property node that gives you all kinds of information about the devices. One of these properties is the Interface Information:Interface Description property which will spit out things like "ASRL1 (COM1 - Communications Port)" or "ASRL10 (LPT1 - ECP Printer Port)" which can be parsed easily for COM1 or LPT1. If you wire a "VISA Find Resource" with a search query like "ASRL?*INSTR" and wire the output array to a FOR loop, you can iterate through them getting those human read-able names. Of course, that may not be the easiest way, but it seems to be the least dependant on machine specific things such as aliases. YMMV, Joe (orko) Quote Link to comment
JPrevost Posted February 20, 2006 Author Report Share Posted February 20, 2006 The VISA resource name (taken off of the reference output of an Visa Open primative) can be wired to a Instrument property node that gives you all kinds of information about the devices. One of these properties is the Interface Information:Interface Description property which will spit out things like "ASRL1 (COM1 - Communications Port)" or "ASRL10 (LPT1 - ECP Printer Port)" which can be parsed easily for COM1 or LPT1.If you wire a "VISA Find Resource" with a search query like "ASRL?*INSTR" and wire the output array to a FOR loop, you can iterate through them getting those human read-able names. Of course, that may not be the easiest way, but it seems to be the least dependant on machine specific things such as aliases. YMMV, Joe (orko) Okay, I understand how to do that but I'm still left with trying to display to the user the friendly names as a control for the config serial. Sure I can get the names but how to list them and open the serial port is where I'm stuck. Quote Link to comment
orko Posted February 21, 2006 Report Share Posted February 21, 2006 Attached is one way to do it with the method I described. It should get you on the right track, but let me know if I missed the mark here. Download File:post-3266-1140498851.vi Cheers! Joe (orko) Quote Link to comment
WMassey Posted February 21, 2006 Report Share Posted February 21, 2006 Can't you use the Measurement & Automation Explorer to set these? Quote Link to comment
JPrevost Posted February 21, 2006 Author Report Share Posted February 21, 2006 Attached is one way to do it with the method I described. It should get you on the right track, but let me know if I missed the mark here.Download File:post-3266-1140498851.vi Cheers! Joe (orko) . I didn't know you could wire a string to the resource name terminal of the serial open subvi. :worship: Can't you use the Measurement & Automation Explorer to set these? That's the set up MY system, not the system the compiled program is running on! I have no trouble with the alias names... it's the end users that get confused. Quote Link to comment
Rolf Kalbermatter Posted February 21, 2006 Report Share Posted February 21, 2006 . I didn't know you could wire a string to the resource name terminal of the serial open subvi. :worship: That's the set up MY system, not the system the compiled program is running on! I have no trouble with the alias names... it's the end users that get confused. What I did once in an application was using the enclosed VI. Use the alias array to initialize the strings of a Ring Control. Then use the selection of the Ring Control to index into the adress string array and pass this to the VISA Open. Rolf Kalbermatter Download File:post-349-1140556159.vi Quote Link to comment
orko Posted February 21, 2006 Report Share Posted February 21, 2006 What I did once in an application was using the enclosed VI. Use the alias array to initialize the strings of a Ring Control. Then use the selection of the Ring Control to index into the adress string array and pass this to the VISA Open.Rolf Kalbermatter Thanks Rolf! I didn't think to use both the canonical and the alias names in the indexed array. Nicely simplified example! Joe (orko) Quote Link to comment
JPrevost Posted February 22, 2006 Author Report Share Posted February 22, 2006 rolfk, v7.0 over here Quote Link to comment
Rolf Kalbermatter Posted February 23, 2006 Report Share Posted February 23, 2006 rolfk, v7.0 over here Here it is, no guarantee that it works the same in LabVIEW 7.0 though. Rolf Kalbermatter Download File:post-349-1140707964.vi Quote Link to comment
WMassey Posted February 23, 2006 Report Share Posted February 23, 2006 Here it is, no guarantee that it works the same in LabVIEW 7.0 though.Rolf Kalbermatter It worked just fine on my system under v7.0 when I tried it showing COM1 & COM2. It show address ASRL1::INSTR for COM1 and a blank for COM2 but that's because my COM2 is tied to a status port on a UPS and was unavailable to respond to the port query. Quote Link to comment
jpdrolet Posted May 25, 2006 Report Share Posted May 25, 2006 I think that the attached VI is still a better implementation, getting the name as the port is known in the OS using the Interface Description property. The property node reports strings like "ASRL19 (COM17 - EdgePort [i40300200-0] Serial Port - 1)" (from a USB serial device) where one can scan for the real port name COM17 instead of COM19. It also lists the ports shared by other computers using VISA Server. Edit: I disconnected typedefs and included Convert to VISA Rsrc.vi Download File:post-447-1148580610.vi Download File:post-447-1148580635.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.