LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Visa Ressource name

Hello,

 

I have a chemical system with several pH probes, connected via USB to my computer. I have already designed my program to display the pH, using VISA functions.

I would like to avoid repeating the program for each probe, so for each com port.

 

How can I write my program only once, so that it can be done for all COM ports?
Attached is my completed VI.

 

Thank you in advance.

0 Kudos
Message 1 of 3
(780 Views)

Hi nicos,

 


@nicos1712 wrote:

How can I write my program only once, so that it can be done for all COM ports?


Create a subVI and connect the VISA reference as input to the ConnPane…

 

Suggestions:

  • Don't initialize the COM port with each iteration!
  • Don't use BytesAtPort, there are most often better ways
  • Handle each device in its own loop - or use one loop to read all COM ports…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(754 Views)

On top of what GerdW said:

 

The first thing you need to do is watch this video: VIWeek 2020/Proper way to communicate over serial

 

Next let's think about your program architecture. One Big Loop is never a proper program architecture, I suggest a simple State Machine to start with.

  

Use a Cluster to hold your VISA sessions and open each Com port using a For Loop ONCE at the beginning of your program

Init1Capture.PNG

Then later in your program you can read all the instruments sequentially using a For Loop

 

Don't forget to close your VISA sessions at the end of your program  

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 3
(731 Views)