cancel
Showing results for 
Search instead for 
Did you mean: 

New to Labview

SOLVED
Cabaiste
Member
Solved!

New to Labview

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 

7 REPLIES 7
Gregory
Trusted Enthusiast

Re: New to Labview

Message contains an image

Hi Cabaiste, what have you tried so far?

Can this give you any ideas?

rand_number.png

Cabaiste
Member

Re: New to Labview

Message contains an image

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

 

Gregory
Trusted Enthusiast

Re: New to Labview

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?
Highlighted
Cabaiste
Member

Re: New to Labview

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?

Gregory
Trusted Enthusiast
Solution

Re: New to Labview

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.
Cabaiste
Member

Re: New to Labview

Message contains an image

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

 

jcarmody
Trusted Enthusiast

Re: New to Labview

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