From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

make program run for multiple channels

Hey guys,

 

So I have this program that does a set of calculations on a pulse signal which is gathered from one channel of code. Now I need this program to do the same thing, only on up to 4 channels simultaneously. I am not sure of how to do this efficiently because I would imagine just copying and pasting the code 4 times would not be the most efficient way. 

 

Each channel has its own set of means, averages, values, etc. And all of the points will be averaged for each graph as included in the code. Any advice on how to go about this efficiently? 

0 Kudos
Message 1 of 7
(2,507 Views)

Is the best solution to break my program into a set of subVIs and go from there?

0 Kudos
Message 2 of 7
(2,500 Views)

You really should be using subVIs anyways.  They help a lot in breaking up your code into modules that are a lot easier to write and debug.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(2,494 Views)

@Punsach wrote:

Is the best solution to break my program into a set of subVIs and go from there?


Certainly not.

 

I'd favor going with the NI Scope API over the express vi and pulling Stats directly from the scope but, you can add multiple channels to the express vi as well.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(2,492 Views)

@crossrulz wrote:

You really should be using subVIs anyways.  They help a lot in breaking up your code into modules that are a lot easier to write and debug.


My program uses the produce/consumer structure. Would the consumer loop become a subVI and the producer loop would remain as is?

0 Kudos
Message 5 of 7
(2,491 Views)

Is this an ideal program?

0 Kudos
Message 6 of 7
(2,481 Views)

@Punsach wrote:

@crossrulz wrote:

You really should be using subVIs anyways.  They help a lot in breaking up your code into modules that are a lot easier to write and debug.


My program uses the produce/consumer structure. Would the consumer loop become a subVI and the producer loop would remain as is?


Not necessarily.  I would start by looking at your consumer loop and breaking it up into actual functions.  The consumer loop itself is just fine being on the top level VI.

 

And as Jeff said, you should get away from the Express VI.  They tend to have a lot of extra overhead associated with them.  Go into the LabVIEW Example Finder (Help->Find Examples) and search for an example with NI Scope.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(2,469 Views)