tailieunhanh - Microprocessor Interfacing Techniques Lab VIEW Tutorial Part 5

Microprocessor Interfacing Techniques Lab VIEW Tutorial Part 5 | PHY 406 - Microprocessor Interfacing Techniques PHY 406 - Microprocessor Interfacing Techniques LabVIEW Tutorial - Part V Loop Variables Thanks for the Memory One of the things that we often need to do is to refer to values in a previous loop iteration. Thus we might want to average the last four values of the random number generator. To do this we need a shift register. A shift register takes an input in one iteration and delivers it as an output into the next iternation. So why is it called a shift register Well because it is a little more elaborate than that. The shift register can be as long as you like and values are shifted down one element at a time. So there is one input and many outputs. Suppose we have a shift register with four elements which contain 75 99 63 27. A new value of 93 is pushed into the shift register and everything moves down one. The shift register now has 93 75 99 63. At the next iteration 45 is pushed in and the register now has 45 93 75 99 and so on. We can generate a shift register by popping-up on the right-hand side of the while loop and selecting add shift register. Two new icons pop-up on the right input and left output of the loop. Go to the left one and pop-up - select add element - do it again and you now have three elements which go in time order down the page newest on top. Re-arrange your VI to show the average of the last four values of the random number generator. The result should look something like this Run the VI and you should get the expected result. It isn t going to take a rocket scientist to realise that doing any significant arithmetic in LabVIEW is going to be tedious. Evaluating any complex expression will involve lots of elements and will rapdily get tedious. Fortunately there is a better way. Under structures there is an item called a formula node. This is designed to make things easy. Remove the multipliers and dividers for the averaging and stretch a formula node box into the space. The formula node box can

TỪ KHÓA LIÊN QUAN