07-14-2014 12:45 PM
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?
07-14-2014 12:56 PM
Is the best solution to break my program into a set of subVIs and go from there?
07-14-2014 01:10 PM
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.
07-14-2014 01:12 PM
@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.
07-14-2014 01:12 PM
@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?
07-14-2014 01:24 PM
Is this an ideal program?
07-14-2014 01:50 PM
@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.