Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift Registers to an array Seems to be lagging by one value?

I have two while loops side by side both with shift registers is that a problem?? I'm trying to take an average reading of 10 samples over time from the first while loop, use that value to add into an array in the second while loop which is also using shift registers to store all of the previous average readings? Every time I trigger it to take another average reading and add to its array it seems to be lagging behind e.g.. "click button" values 1 array says 0, "Click button" value 2, array says 1 and so on. Any advice would be welcome.
0 Kudos
Message 1 of 7
(3,428 Views)
It is probably a timing issue.
Attach your vi, so one can have a look at it
0 Kudos
Message 2 of 7
(3,426 Views)
Thankyou! Please find attached "Image2.jpg" as vi to large.
0 Kudos
Message 3 of 7
(3,423 Views)
In assume when the ok button 2 is pressed it is triggering the other loop to get the value of MaxValue, and is appending the value to the array.
When youb do this, the array is appened once (the current value (old value)) stops executing, till the other loop finishes execution and updates the new average ).

You have to restructure the loops setup
0 Kudos
Message 4 of 7
(3,417 Views)
Sorry for the lack of explanation. With ref to you first reply "Timming" I put the acquiring average and putting into the array separately, within a single loop. As you can see from "Image2.jpg" on the left side of the picture is the right side of the loop that produces the "X Max" values which produces the values for the average value. Once the average is completed I can then press "OK Button 2" this will then place the average value into the "Array" no problem.

The above proves to work, but with two buttons.

Tried to trigger "OK Button 2" using the completion of the average, still remaining in the same loop but it doesn't seem to trigger "OK Button 2"? Any Ideas? Thankyou!
0 Kudos
Message 5 of 7
(3,411 Views)
Hello,

what you can do is to create a local variable of OK button 2. place it so that it will be set automatically to true at the end of of OK button loop run. It will. then trigger the OK button 2 case structure and appends theb array. The case structure has to set the OK button 2 back to False. You will have to change the mechanical action of OK button 2 to "switch when pressed" to be able to use local variables.
0 Kudos
Message 6 of 7
(3,394 Views)
Thankyou very much for the advice, done something similar, but will implement your idea as it could make program easer to follow.

I placed the "triggering loop" of two arrays "Array and Array 2" Into the loop where "X Max" was been obtained. Then triggerd the average making loop to trigger the two arrays which stored the two value's.

It sounds messy but it seems works. As you said "timming".


Thanks agian for your help.
0 Kudos
Message 7 of 7
(3,388 Views)