LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA resource name control: want to refresh list of COM ports programatically

Solved!
Go to solution

When the app is running, and you first click this control, it takes 2-5 seconds to respond and populate the list for the first time.

Therefore, I want to auto populate the first time the application is loaded. Can I do this?

 

Message 1 of 10
(14,876 Views)
Solution
Accepted by _Faust

Before allowing user to click & select the VISA resource name, first use the "VISA find resource" in your programm to do the same & then allow or prompt user to select resource.

Since when EXE loads, it will execute the FIND VI first & will inform Labview about available resources.

Message 2 of 10
(14,865 Views)

Kudos are welcomed.:-)

Message 3 of 10
(14,865 Views)

I have found that VI, but it outputs an array of strings; how do I update the control with that? Or is this not needed

 

EDIT: Well I found I dont need to do anything with the output, it works fine 🙂 Thank you!!

0 Kudos
Message 4 of 10
(14,858 Views)

Well I have to come back to the original question: the find VISA sub vi works only when not building an executable.

 

Running the exe gives the same 2-10sec freeze when clicked for the first time

 

0 Kudos
Message 5 of 10
(14,842 Views)

Hey _Faust,

 

I was just curious to know if you found a solution for this problem.

I also wanted to revive this thread to see if anyone else can help.

I've had the same problem on many applications (EXE) and haven't found a fix.

 

Regards,

 

James

LabVIEW 5.0 seems so long ago...
0 Kudos
Message 6 of 10
(14,594 Views)

The best way to handle this is to use a regular dropdown control, such as a combobox, rather than the VISA resource control. You then populate the dropdown at the beginning of your program with the output of Find Resource.

Message 7 of 10
(14,590 Views)

I will try this, thanks for the input

0 Kudos
Message 8 of 10
(14,571 Views)

_Faust,

 

I haven't found any method to accelerate LV finding the resources. 

IMHO, I think this long delay is a LV bug that needs addressing.

 

However, I'm using smercurio_fc's suggestion of populating a Combo box. I use a parallel loop to allow for other program function and interaction while the VISA Find resource.vi takes its sweet time updating the list of available ports.  Just thought I'd share how I update the control to prevent user delays and confusion.

 

Regards,

 

James

LabVIEW 5.0 seems so long ago...
Download All
Message 9 of 10
(14,533 Views)

Hi,

 

I'm joining in here since the thread addresses delay problems when using VISA resources.

 

I would like to share my experience when using VISA on real-time targets.

The hardware I use is a cRIO NI-9074 with two NI-9870 (4 x RS232 each) and one NI-9871 (4 x RS485). These modules are used in scan mode to avoid excessive port programming in FPGA.

My first problem was that the twelve COM ports of the NI-9870/9871 modules did not show up in the list of available VISA resources when placing a VISA resource control on the front panel or a VISA resource constant on the block diagram. However, the workaround using "VISA Find Resources" seemed to work fine. When starting the real-time program from the development machine, the list was populated and by indexing the list I was able to use the port.

 

BUT: When building an RT executable from this VI, deploying it to the RT target and setting it as startup, nothing happened. It took me some time to find out, that there has to be a significant delay (in my case about 10 s) before calling the VISA Find Resources function. Otherwise it will not give the correct output. By some reasons, the ports do not seem to be available when the RT startup application begins to run. I tried to play with the delay and found out that the resource list would be empty when calling the VISA Find Resources function almost immediately on startup, after a few seconds it would return the ports of the first NI-9870, after seven seconds the ports of two modules, and after about ten seconds all ports would be available.

 

I would appreciate if somebody could tell me what happens since it was quite a pain in the ass to solve this issue.

 

Best regards,

Karsten

Message 10 of 10
(13,117 Views)