Table of shift register

I need to create a program that takes an array of six elements and the use of shift registers if he pulled out a table that maintains the first element of the same thing, and then adds the second and third elements together, and then adds the second to the 6 ° element.  So if the input array is 2, 12, 10, 5, 20 and 25, the output array is 2, 22 and 72.  I think that using shift registers and a loop would work, but I can't make it work.

Thanks for any help

Ok.  Given that it is for a class, I will do more than any code.

Comments.

1. a shift register is a local memory form. So, ask yourself what this problem needs to be recalled?

2. entry and exit tables are different sizes. No sense to wire the table via the shift register because the shift register will 'remember' how the input array is large.

3. Reflection on comment 1, how you will get the information in the table to put it in the register shift?

4. what happens if apply you the same rules but allowed the input array having a size greater than or equal to 6?  That's what is meant by an evolutionary approach to a problem. The code I posted works for length 6.  For any other length program must be changed. A scalable program work without modification for any input of size.

It is often very useful to begin with a series of conditions, which you said we now clear. Then plan how you would the problem with pencil and paper. Then implement this plan in the software.

Lynn

Tags: NI Software

Similar Questions

  • Replace the subset of table w/Shift Register too slow for my Application

    This is similar to other posts, but I have not found one that addresses the limitations of an approach of shift register.

    I have a part of an application that I'm turning to 500-1, 000Hz.  The process extracts a block of data from the ADC, and I need to store this data, then collects more of the ADC.

    I've set up what seems to be the bottleneck of the present in the attached .zip file.  When I run the attached code with profiling (see. PNG file), it tells me that it takes on average 3.8ms for the Subvi to run.  At this rate, I can only run around 260 Hz.  I have a Subvi similar to this in my code and the code can run at 1000 Hz without this Subvi, but slows down to about 160 Hz when it is activated.

    Is it possible that I may collect data about 1.7 KB tables and run at the speed I need?  Any input would be appreciated.

    For purposes of reference. Debugging should be disabled on the sub - vi.

    Looking at the code you provided - don't just disable debugging -! you have some other options of "exécution" to reset.

    This should speed up the Sub - vi SR will be your friend again!

  • Table/Shift register losing values

    Hello

    I have attached the VI.

    The vi has a table with values in them. Simply, it looks a number when this number of games, it moves on a column and add everything in that cell in a table. He continues to do this until he sees 'END' at which point she stops.

    The problem I have is that everything seems fine for the first two "values" after which no matter what additional value he acquired he loses everything and keeps only the last known value.

    Your current code takes the unique element of your table and makes a picture out of it.  You then insert the name Test.  So everything that precedes the family name went at that time.

    Here is the code updated the minimum which keeps the TABLE in the shift register and simply adds new test name in the table.

  • How to clear a table used in a shift register quickly?

    Hi all

    I'm sure it's a quick, but I'm missing the concept.

    I have a table of boolean in a shift register. I have a case where I basically have to 'reset' the table rather than adding on... What is the best way to do this?

    Thank you

    Cayenne

    Use a constant empty Boolean matrix to clear your table.

    Steve

  • Problem backup a table using a shift register

    In the attached VI I'm build a table 1 d of channels, then try to record using a shift register. For some reason any is not backed up my data and I don't understand why.

    Thank you.

    You must connect the table where all empty, else it will reset to an empty array whenever such a case occurs.

    You also need a registry change on the inner loop.

  • Shift register clear before rerunning the VI

    I have this VI very simple read the voltage of an acquisition of data until I stop the loop, then it saves the data to a .wav file.

    My problem is: whenever I stop the VI, I expect the registry to shift to clear. But if I restart the VI it saves the old data in the shift register and the new data in the .wav file. I want to just the new data when I run the .VI, without having to close the program each time.

    Help, please.

    Right-click on the control to the table, and choose "clear picture" (or any option os tht called) and try again. It's a cluster of an array of types of waveform data. (Later), you can right-click and choose "display as icon".

    Ben

  • How to make shift register init happens only once, so that the data can persist across multiple tracks of a loop?

    Here's the situation:

    We are repeatedly followed eight real-world signals and comparing them to a threshold value.  We do this via a loop For inside a While loop.  The loop For runs eight times per pass.  We have implemented a binary table 1 d and the use of the index of the loop For as the array index, by putting a Boolean result in the table using the function replace table subset.  We want to keep the data in the table to be 'sticky', in the sense that any True value is locked, so even if a fake comes later, this array element true.  However, since we initialize the array in order for the replacement to the work table, we see that whenever the loop For again, it resets the table and destroys the history.

    I have attached a simple VI to illustrate the concept, using a random number generator as a stand-in for the real world signals.  How we change this VI do and entered real lock through multiples for loop runs, indefinitely?

    In case it is not obvious, I am a relative beginner, so please keep count in your response.

    Thank you

    B

    scottbbb wrote:

    For B, although I love the simplicity of it, I have a question: it solves the problem of the re-initialization?  What the shift of the While loop register get initialized - only once during its launch?

    Yep, the shift register Initializes only at the beginning.  You could say that every time the while loop is called (not each iteration) the shift register is reset with the wrong table.

    And, Yes, GOLD will always keep a REAL when it is TRUE.

    Usually, the simplest solution is the best.

  • Cancellation of registration user stored in the shift register event generates the error 1 if Subvi runs intermittently

    Hello

    I'm trying to understand the behavior of the attached excerpt from a larger overall vi functional.

    In a State, I'm generating a user event and in a State later unsubscribe from the event and destroy it.

    Now, if I went through the VI together in one step (i.e., step through events? set to FALSE), the VI runs without generating an error. However, if I run the VI by intermittent and output after each execution of the loop, the vi generates error 1. Why is it so? Please notify. Thank you.

    Peter

    Why are you registration and deregistration of events user, but you have no event structure in your VI who use them?

    When you run events, probaby the event you registered disappears when your VI stops running.  If you were able to keep your VI in the foreground running, then the life of the event would persist.

    The event number still exists in the uninitialized shift register, but it does not say more once your high level VI stops and you get the error 1.

    If it was really a global functional VI, you would terminals connected to the connector table in your VI, you would call this as a Subvi as part of a main VI and life event would persist and you wouldn't mistake 1.

  • Increment of the counter without using the shift register

    Is there a way to count = count + 1, with using a node registry or feedback shift?  I have a structure of the event within a while loop (see table).  When the button is touched (kickoff event), a test is carried out.  Based on the test in the case of a string is passed outside of the event to a case statement of success/failure.  The user can run one of these 'events' as many times as he or she wishes.  And in an order any... Test1 (fails)... test 1 (fails)... again... test1 (go) again... test 2 (pass) then test 1 (pass).  When the stop button is reached, I would like to know how many times each pass/fail is produced for each test.  Try to stay away from shift registers, as I have 18 w key so a possible failure for each, so I would need 36 shift registers.

    In my example, the printed final statement would be:

    TEST PASS/fail # x test was performed

    test1 failure 1

    2 in case of failure test1

    Test1 pass 3

    Test2 pass 1

    4 passes test1

    etc.

    Do not see an attachment.

    You can use a shift register to store a table.

    Each button would be mapped to an array index. For each button pushed you the value of the index table, + 1, replace the array element and pass out back for the shift register.

  • Shift register Alternative

    Hello

    I try to have my program permanently store the last several minutes of data that my sensor collects and run a calculation to see if a certain fraction of it is greater than a threshold. What I know, I could store the values in the shift registers, but I put on a hundred of thousands of values and who will get to clumsy on my block diagram and I was wondering what were the best ways to store these values.

    Thank you for your time.

    endlessOranges wrote:

    The probe should collect samples at a frequency of 1 kHz and I want to store the values of the last 593287. I'm looking in the tables store the values in the shift register, but I'm still pretty new with programming in this and are struggling to find a way that doesn't involve manually by dragging a lot of boxes to specify each index in the table to store values in.

    Simply use the data queue PtByPt .  It does everything you want.

  • replacement for the shift register chart

    Hi, I have a problem with my program. When I want to compare graphic legend with my present graphic it just overwirite with my graph.when this I add new data and then run my program it does not work. I tried to use shift regoster but my program eror. where should I put the register shift in my program? Thank you

    The shift register is on the outer loop. There is no need for inside while loops. The shift register should contain a table of two parcels of xy. Replace one of the accrding of two plots to the key using "replace the subset of the table".

    You don't need to a simple shift register, you have far too much code.

    (Please attach the screws with a suitable name. My Downloads folder already contains dozends of files "x.vi no title")

  • Shift register to replace local variables

    Hello

    I'm looking for a way to make a marquee on a Boolean LED. Currently, I use a local variable to make the scrolling action (see the code, the loop For on the right). However, this method requires CPU more power and also prone to several other error. Therefore, can someone help me to replace local variables with shift register? If possible, do not change the other loop. Thank you.

    -l' scrolling action must be continuous

    -use the attached config. file

    -allows to test with any text message

    Why do you think that you need so many loops?

    Try this, perhaps this may give you some ideas...

    (Look at buffer allocations. My table of Boolean 2D works at constant size and completely in place. Not only were constantly read and write to and from the local variables, you were also constantly growing and reducing the size of the table. It's very ineffiicient. I don't see the purpose of your outside while loop or FOR your first loop. None of your shift registers makes a lot of sense. You probably want to close the file of configuration (not shown in my modification)).

  • How to program the shift register to play only when a new user is detected user?

    Hello

    I'm currently developing a program of position control in labview. The program is quite simple, in which case the user will enter the distance on which he wants the table in the labview program and labview will send the signal to move a motor that will turn a ball screw to move a table horizontally to the targeted position. The criterion is that the profile of the engine depends on the distance to move, if a biphase (acceleration and deceleration) or three phase (acceleration, steady speed, deceleration) to reach the position of the target.

    The problem occurs when the user wants to enter a new entry second position) for the table, as the input by the user is the position that the table should be, but the necessary input to determine what profile the engine follows depends on the distance that the table moves to the target position. Therefore, I need a function to save the entry by the user temporarily and reminds that when a new user input is detected. Hereby, I would be able to use the difference of the input (input [n + 1] [n] input) and animal feed to determine what profile the engine follows and the entry by the user can be kept in the position he wants to the table to get (to compare with encoder).

    I thought to use for shift registers do, but I am not able to perform the deduction ([n + 1] - [n]) only when it detects a new entry. When I try to use registry to offset, it moves to the target location, and we only reached it will go to the original position. For example, when a user entry 90, this means that the table must be moved to the point 90. The shift register is initialized to 0, it will move to the point 90 (90-0 = 90), but arriving at 90, the shift register sends a signal of 90 (90-90 = 0) and the table back to its original position.

    Is it possible that I can delay the reading of the shift register only when a new entry is detected or there at - it another way for me to achieve what I want?

    I tried searching the forum site and neither discussion but could not find similar problems. Thank you for your help in advance.

    As I understand it, the use of shift registers with a structure of the event (to detect a user event when the user enters a new value) should solve the problem. Do not forget to post your request (or a version of it that isolates the issue) when you arrive at the lab, if we can get a clear visual of the issue you are facing.

  • Change the shift register

    I hope someone can direct me on that. I'm stuck.

    The NTC, I want that it start at zero, enter the nested loop

    and when the case statement is equal to one, add 3000,

    so I have a lag on "undesirable" elements in the 1 d

    table I'm parsing...

    TIA!

    the nested loop shift register is not initialized, it is best to initialize it with a constant 0

    Then, the index entry Array subset function is connected after or before the function incriment? I can't decide...

    in any case, if it is connected before the incremint function then the nested loop iteration 1 will send a 0 at the entrance to the function of the subset of the Array index.

    EWW! , a lot of entries, words of functions in the above paragraph lol , can u get me here?

    now I can just understand the problem what exactly you're talking about. the sequence of events for your code will be like this:

    After the nested loop is complete, the output will be available (1 d the function add array element table) to the structure of the case where you want to add 3000 to the value of the shift register and start the loop nested with initialized again records with value = 3000? Am I wrong?

    If I'm right, you must reset the shift by using a control register, create a local variable to him and place it in the business structure then her manipulate it as shown below:

    Since the default data of "N" type digital command value is 0, then initially the shift registers will be initialized with 0 as the guy above

    Thank you

  • Functional Global Variables: an indicator can be used instead of a shift register?

    It is a simple question, but I can't find an answer to it. The model agreed to a functional Global Variable is to use an uninitialized as in this example shift register:

    ('Référence IN' and ' Reference to "is actually a pile of references.) There is also a "Se Refnum" case, which comes the straight through the tunnels shift register.

    My question is, why can't we do store the indicator data? It is much simpler to use a shift register (IMHO a non obvious way to store global data!):

    The case "Se Refnum" does absolutely nothing. Other functions such as erasure of data can be implemented just as easily. The advantage of the FGV to help avoid race conditions is maintained because you always use the VI to access the data.

    JonP says:


    Not so much, the Inidicator can happily live outside the case structure, together and Clear would be just assign different values.

    If you have only a case structure, the indicator could not live outside of it.  In order to maintain the indicator data, your design requires that it is not written in for a case of Get.  If you have an exterior structure deal that decides on 'Get' or 'set or clear' and (in the case of "Set or clear") contains the terminal of the indicator and a classiquee case that decides on 'Set' or 'clear '.  However, I would consider this a design below using the standard template of the FGV.

    The difficulty with retrieving the value if you want to do a read operation / writing change. But LV provides many ways to retrieve data from an indicator (one you don't mention is the 'Value' property), do you mean that's all "incorrect"?

    Yes (I mean that they are all incorrect).

    You could hack your way around the design to work with a single structure of matter and the terminal of the indicator being outside using a method to read the value of the indicator and through a tunnel to the structure of the case through wiring for the tunnel of writing indicator in the case of 'Get '.  However, who will require a local Variable or value of property node.  As I said, these (I only mentioned the local Variable originally) are not good choices for performance and scalability.  If you are not aware of the functional differences between the terminals, local Variables and nodes of property value, refer to this article (obviously advantages/disadvantages such as redraw objects on the front panel are not relevant here).

    I guess you could say that indicators should only be written, but it is difficult to be pure!

    No, it's not, just use the classic design of the FGV!

Maybe you are looking for