LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the data acquisition rate in a while loop

Solved!
Go to solution

I am trying to use a digital trigger to collect data on both its rising edge and falling edge. The design is shown as below. Right now, I save the voltage reading 1&2 through local variable within the while loop. Hoever, the while loop runs at a higer frequency compared with the triggered case structure. So I have got a lot of repetitive data.  If I save the data directly from case structure, it will be saved as data-0-date-0 because of the false case unwired. 

 

I am wondering how to revise it to save the voltage reading 1&2 at the same frequency of rising/falling edge triggered? Thank you! I have also attached my current version of Labview program, which runs Labview 2013 realtime. 

question.JPG

0 Kudos
Message 1 of 5
(3,328 Views)

@Mcdullna wrote:

Right now, I save the voltage reading 1&2 through local variable within the while loop.


I recommend using shift registers instead.  They avoid interesting raceconditions.

 


Mcdullna wrote:

I am wondering how to revise it to save the voltage reading 1&2 at the same frequency of rising/falling edge triggered? Thank you! I have also attached my current version of Labview program, which runs Labview 2013 realtime.


Use another case structure so that you save when the trigger edge is rising OR falling (simple boolean logic there).


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 2 of 5
(3,319 Views)

Thanks a lot for the reply. Could you be more specific about the shift register use? I have only learned that it can pass data to the next loop, but not sure how to use that to save data from each loop. Thank you.

 

0 Kudos
Message 3 of 5
(3,302 Views)
Solution
Accepted by topic author Mcdullna

@Mcdullna wrote:

Thanks a lot for the reply. Could you be more specific about the shift register use?


The False case just passes the value through.  With this setup, you are allowing the data to stay in the wires, avoiding race conditions.  It is also more efficient than using local variables.


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 4 of 5
(3,287 Views)

I see. That will make it. Thank you so much!!

0 Kudos
Message 5 of 5
(3,264 Views)