LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuously perform calculations on data

Solved!
Go to solution

Hey guys, 

 

So I have this program that generates pulse signals using NI-SCOPE, and I had originally done it so that each time the user presses an OK button they will perform certain calculations to generate a value which is stored into an array. My mentor now wants me to make it so that it continuously generates the pulse signals (not just one signal) and adds the values to an array. I need to use the N Samples setting on NI SCOPE so the signal looks as it does in the code below, although if someone has a way to change that, that would be good too.

 

So basically, how do I perform continuous calculations on pulse signals generated automatically over time? The user should only have to run the program, and the computer does everything else. 

 

Thanks!

0 Kudos
Message 1 of 5
(2,419 Views)
Solution
Accepted by Punsach

You need to migrate to a Producer/Consumer structure. In the Producer loop acquire the data contimuously and pass it to the Consumer loop. In the consumer loop, analyze the data and store the data as needed.

 

A variation on the theme that I would recommend is that rather than using a queue to pass the data, use a user-defined event. The reason for this change is that your present code (which is essentially what will end up in the consumer loop) is event driven so passing the data to the loop via an event will allow it to fit in with the current UI structure.

 

Oh, yes, one more thing: Get Rid Of The Express VIs. It's time to take off the training wheels...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 5
(2,364 Views)

For those who want some more background...http://forums.ni.com/t5/LabVIEW/Store-calculated-values-in-an-array/td-p/2913226


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 5
(2,349 Views)

I attempted to adapt my code to the Producer/Consumer structure, and through it I began to develop a basic understanding of the structure and algorithm. However, I am still a bit weak on some parts and this is the best I could come up with. Could you provide any advice/tips on how to go about debugging this? 

0 Kudos
Message 4 of 5
(2,309 Views)

Hi Punsach,

 

Have you seen this document below? It is a good introduction for Producer/Consumer architecture.

 

http://www.ni.com/white-paper/3023/en/

 

Also, as far as debugging your code, please reference the below document.

 

Debugging tools in NI LabVIEW

http://www.ni.com/gettingstarted/labviewbasics/debug.htm

Kevin S
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(2,269 Views)