01-11-2023 04:58 PM
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.
01-12-2023 01:29 AM
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:
01-12-2023 09:39 AM
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
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