LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New to Labview

Solved!
Go to solution

I have been trying to work this exercise out for the last week and I just can't seem to grasp it so any help would be much appreciated. Its a simple one, I need to use a number generator that displays a current value and also display the last 4 values to then get the average of those readings. Need to use shift registers to achieve this 

0 Kudos
Message 1 of 8
(1,714 Views)

Hi Cabaiste, what have you tried so far?

Can this give you any ideas?

rand_number.png

Message 2 of 8
(1,699 Views)

This is where I am at with it, I think it's probably a mess and I think the array is just generating random numbers rather than saving the last 4 numbers of the current value if that makes sense.

 

Cabaiste_0-1668120491351.png

 

0 Kudos
Message 3 of 8
(1,673 Views)
Why do you run the for loop 16 times? That will give you an array of 16 numbers. Your requirement was that you need to use shift registers, but you are not using any.
Did my snippet give you any ideas?
0 Kudos
Message 4 of 8
(1,649 Views)

I tried starting with a while loop because i just wanted it to run continuously but I just couldn't wire it, kept getting errors so I just ended up with that monstrosity. Yours has given me ideas, I assume that the shift register will register a value every time it loops and if i have 4 elements it should record 4 values?

0 Kudos
Message 5 of 8
(1,642 Views)
Solution
Accepted by topic author Cabaiste
Yes, the shift register on the left will give you the previous value (i-1). If you drag it down to make it longer, you get access to i-2, i-3, etc.
0 Kudos
Message 6 of 8
(1,630 Views)

Thank you so much, its working! Currently where I am at with it and the values actually move from R1.. R2.. R3..R4. Still a little bit more to do but you've been a massive help! 

Cabaiste_0-1668123696831.png

 

Message 7 of 8
(1,618 Views)

Your code should be able to handle a change in requirements.  What if the assignment changed from four numbers to four hundred?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 8
(1,538 Views)