LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cant assign com port to resource name

I'm setting  up a vi that will be used on a target pc, where the com port available on the target  (com5) is different from the ones available on my development pc. I'm trying to create a constant or control at the input of my hardware vi that identifies the com port, but it won't let me assign com5, apparently because my development pc doesn't have com5 available. If I give it a selectable control that I can select at run time on the target, it defaults to a com port not available to the target and when launched it hangs up. How can I hardwire (make default) the resource name to a com that is unavailable on my dev. pc?
0 Kudos
Message 1 of 10
(5,845 Views)
Have you tried wiring a simple string control to your VISA Resource Name Terminal?

It should work as long as the name you type the com port name exactly as it would be if using the standard I/O input control.

This method should allow you to use whatever com ports are available on your development and target PC's.
Mark
NI App Software R&D
0 Kudos
Message 2 of 10
(5,830 Views)
 Mark, please see attached screenshot of my vi. I tried what you suggested. The drop down constant that is wired to the CILXS vi is what pops up when I create control, so that is the text format I duplicated with the unwired string constant shown above it. Of course, when I tried to use it I deleted the drop down constant and wired in the string constant, and it didn't work. The error message says insufficient location information. Any other ideas?
0 Kudos
Message 3 of 10
(5,788 Views)

As a work around, maybe it would be worthwhile to go into Device Manager on your development PC and rename it com port to be Com5 instead of Com1.  When you are done with the project, then you can go back and make it com1 again.

Are you trying to actually run this VI on the development PC?  When are you receiving the error message?

0 Kudos
Message 4 of 10
(5,758 Views)
Try typing in the port name as ASRl1:INSTR without anything additional in your string constant including quotation marks.
Mark
NI App Software R&D
0 Kudos
Message 5 of 10
(5,756 Views)

Check port2.vi example at this forum... that's what you're looking for... also you can create an INI file where you save wich COM port is used by your application. First time your application runs at target PC it reads that INI file, it finds that no COM port has been selected and run port2.vi example, modify INI file and, that's it !! ... your application won't have to ask for a COM port next time it runs, because a valid COM port is already at the ini file.

 

0 Kudos
Message 6 of 10
(5,750 Views)
That works! Thank you. As usual, I like to exhaust all my NI documentation before going on this site. Can you direct me to NI Labview documentation that spells that out that I should have read?
0 Kudos
Message 7 of 10
(5,713 Views)
I did a search for port2.vi in the entire forum & only got a hit on your reference above. Can you send me that vi? It looks like something I can use in other projects. Thank you.
0 Kudos
Message 8 of 10
(5,711 Views)
Hi wb2nvy,

click the "reference above", then right-click the port2.vi & select "save as..."! No need to send this vi to you...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(5,708 Views)
Muchas gracias!
0 Kudos
Message 10 of 10
(5,703 Views)