LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I save intermediate results?

I am using FOR loops to count the rise time, fall time, higfh time and low time
of a square wave. Is there any convenient way to store the rise time when the
high time starts, store the high time when the fall time starts, etc. such
that the correct intermediate results are saved? So far the only data I can
get out of the loop is that which is present at the end of the count (shift
register w/auto index off) or the entire data set (auto index on). I need the
data in the middle of the count!

With ICs, one would use the rising edge of a clock to register the value of an
IC counter and the IC's propogation time would make sure that this desired
value did not change at the instant that the clock changes, while the IC
r
egistered the data at that instant.

Do I need a delay? Is this a function of the demo versioin of 6i?
0 Kudos
Message 1 of 4
(2,976 Views)
As long as i understand, you only want values when your data changes it's state, from ascending to high, and from descending to low, so you should put a case statement inside the loop, and use a shift register. In the case statement, just pass array data if state does not change, and if state changes use build array to add data to the shift register. To achieve this, you need a state change variable wired to the case statement.
Hope this helps
0 Kudos
Message 2 of 4
(2,976 Views)
Thanks for the idea, it's definitely worth a try. While we're on the subject,
I haven't had much luck with arrays, because of the requirements that all
elements be of the same data type. I have a few questions: How does Build
Array interact with the shift register? Does it act like a switch to stop data
from being added to an array? Does it create a single element array that is
transferred to the shift register each time it executes? Does each value get
overwritten with the subsequent one, or will I end up with an array of all
values? (In this case I would need to traverse the array to find my desired
values, and I don't have any reasonable way of predicting where they will be).


Neil

========================================
Please remove the "nt" for leg
itimate email. Thanks!
========================================
0 Kudos
Message 3 of 4
(2,976 Views)
If you put a shift register in a loop, data will be returned from right side to left in each iteration.

If you use build array, and choose array as the shift register input, and element for the data, everytime build array is called one element will be added to the array.
Hope this helps
0 Kudos
Message 4 of 4
(2,976 Views)