Adding Shift Register to Stacked Case structure

According the the Help, you can add Shift Registers to Structures.  The Stacked Sequence is a Structure, but I don't see the option to add a Shift Register when I right click on the left side of the Structure.  Am I missing something?  I want to run my Error In and Error Out lines through the Shift Registers in a Stacked Sequence so as not to have to do it using a Feedback Loop, as that would get messy.
Solved!
Go to Solution.

Newenglandguy_LV wrote:
NIquist wrote:
I think what you want is the "Add Sequence Local" function which allows you to pass data from one frame to the next.  It's an ugly, confusing choice when you have much better options though. 
It sounds to me like you just need to create some subVIs to better compartmentalize your code.
I do understand your comment about compartmentalizing, but if I did that I'd have a VI for every few event sequences.  The only reason I'm putting them in a stacked sequence, is to allow whom every might want to understand the flow, not to have scroll across.  If I was working in a coding language, this would be a simple series of commands, in maybe 10 lines of code.  But that's where I'm struggling to see some of the advantages of LV.  I simply want to have errors flow forward, and send a series of commands to the same instrument with some delay in some cases.
Perhaps it would be easier to help you understand if you posted the code you have so far. Are you using the sequence frame because you are using the Wait function, which has no error in/out terminals? If so, you can easily whip up a wrapper VI for that function.

Similar Messages

  • How do you pass values between case structures?

    Hi,
    I have a simple vi where I am measuring voltage in a WHILE LOOP. The WHILE LOOP contains 2 case structures.  Under some measured voltages,  case 1 or case 2 will execute, and under some other voltages, neither case will execute, and the WHILE LOOP simply iterates again. 
    Case 1 and Case 2 both issue commands that are calculated using both the measured voltage and the PREVIOUS command value, using a very simple addition/subtraction sequence.  Case 1 and Case 2 are likely to execute many times before the voltage changes enough to pass into the "in between" range.  Each time either case executes, a new command is issued.  Each new command is a modification of the previous command by the addition/subtraction process.
    The two cases refer to an upper threshold and a lower threshold.voltage value.  There is also a voltage range in between the lower and upper threshold values where we do not issue any commands.  Commands are issued only when Case 1 (voltage<lower threshold) or Case 2 (voltage>upper threshold) is TRUE.
    In the case structures, the measured voltage is used to calculate a command value by adding or subtracting to the previously calculated command, where either Case 1 or Case 2 are TRUE.  The case structures do NOT use any of the voltage values measured in the "in between" range. 
    Suppose that Case 1 is executing and sending commands properly, and then, the voltage value changes to the in-between range and continues to the Case 2 range.  What I want is for the Case 2 to use the last command issued by Case 1 for the Addition/Subtraction.  Recall that many voltage values are likely to be measured in the "in between" range and none of these will result in issued commands.  How do I capture the last command from Case 1.  Of course, I want to go both directions.  A total of four differen sequences are possible:
    Case 1--> In between --> Case 2
    and
    Case 2 -->In between --> Case 1
    and
    Case 1 -->In between --> Case 1
    and
    Case 2 -->In between --> Case 2
    How do I capture that last command issued, and store it until either case becomes TRUE again, and then make the case use this command?  I don't think that a shift register will work because the "in between" range will change the value in the shift register, and I don't see how to implement a shift register with a Case structures.  Will the feedback function work for this?
    Thanks for your thoughts.
    Dave

    Action Engines probably are a good idea.
    I think the state machine in the attached vi should also be sufficient.
    Attachments:
    State Machine Example.vi ‏11 KB

  • How can I append some data to an array via a case structure?

    Basically i want to do the following thing:
    do
    if control=0
    else
    Data=Data append data1
    end if
    }while(run=1)
    We try to avoid local variable since the size of Data is pretty big. I am pretty sure i can add a shift register in a loop structure.But is it possible to add a shift register in a case structure?
    Thank you!

    The best you will be able to do is going to be a variation on what CC suggested regarding replacing array sub-sets.
    If you do not know how big it will end up then over-allocate but still use the replace array subset.
    The delays you are seeing are due to the memory buffers groing and additional memory need allocated as the array grows. The Replace array subset function operates inplace and re-uses the buffer it is passed. There is no clear KB regarding which array operations operate inplace and which do not.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=74847&requireLogin=False
    Under Tools >>> Advanced >>> Show buffer allocations will show you where buffers are being allocated (LV 7.1).
    If you post a zip or llb of you code I am sure someone will have more to add.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to use shift register in this structure?

    Dear All,
    In order to use less variety of graph, I want to use shift register to manage and send data to graph.
    But there is not only event structure in my vi, for some reason(because I want to use only one button to control running and stop, and this must do through variety of button, I can't put this loop into the event structure) I must use other while loops, I don't know how to use shift register in this structure.
    Please tell me anything helpful.
    Thank you!
    Attachments:
    shift register.vi ‏26 KB

    hi there
    there are a lot of solutions. my favorite one is the usage of a so called "FGV" (functional global variable). this allows you to strore, manipulate and transport data through your app with a minimum of wires. see attachment.. (other users may have other favorite solutions...)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"
    Attachments:
    Shift Register 7.1.zip ‏20 KB

  • Calculate maximum value of subarray while creating it using a case structure and shift registers

    I have two 1D arrays that contain cyclical information (kind of like a sine wave).  One that contains information on position in degrees and another that contains torque.  I would like to calculate the maximum torque value each time the position is within a certain range (e.g. from 30-80 degrees).  The ranges are repeated - that's why it is cyclical.   I use the "in range" function, a case structure and shift registers to build a new array with values that fall within the range I specify - this was the easy part (see VI attached).  I'm struggling with a way to calculate a maximum value for each subarray formed when values are "in range".   Your help is much appreciated.
    Solved!
    Go to Solution.
    Attachments:
    Simple Calculate between anatomical position range.vi ‏16 KB

    It's not really noise - it's more inconsistency.  So a position output can run: 20, 30, 40, 50, 60 etc.  OR, it could run: 21, 24, 32, 41, 44, 51, 59 etc. But, it is always cyclical. 
    Attached you will find a .csv file with the data arrays - I'm using POS (ANAT) degrees column (column D if you open in excel).  There you also see torque in ft-lbs along with some other information.
    Attachments:
    025C.csv ‏224 KB

  • Getting Back Values from Shift Register from Other Loop (FPGA)

    Referring to the picture above, both while loops are inside one while loop (not shown in picture). Problem is im trying to execute the numeric control once only and use the value from the second loop after that. I tried many ways and still have no idea how...could someone help? Thanks in advanced
    Solved!
    Go to Solution.

    augustg,
    You might try using a case structure to route the numeric control into that shift register only on the first iteration of the outer while loop and in all other cases route the output of the case second loops shift register back into the first. Kind of hard to put into words, but something like this:
    The case structure to the right that I added has one additional case "Default". In this case the value from the shift register of the outermost while loop is wired straight through. Hope this helps!
    Nick C | Staff LabVIEW Platform Product Support Engineer | National Instruments

  • How to program shift register to read only when a new user is detected from user?

    Hi,
    I'm currently developing a program for position control in labview. The program is quite simple, whereby user will input the distance that he wants the table to be in the labview program, and labview will send signal to move a motor that will turn a ball screw to move a table horizontally to the targetted position. The criteria is that the profile of the motor depends on the distance it needs to move, whether a two-phase (acceleration and deceleration) or three-phase (acceleration, constant velocity, deceleration) to reach the target position.
    The problem occurs when the user wants to enter a new position (second input) for the table, as the input by user is position the table needs to be but the input required to determine which profile the motor follows depends on the distance that the table will move to get to the targetted position. Therefore, I would need a function to store the input by user temporarily, and recall it only when a new input from user is detected. By this, I would be able to use the difference of the input (input [n+1] - input[n]) and feed it to determine which profile the motor follows and the input by user can be kept as the position he wants the table to travel to (to compare with encoder).
    I thought of using shift registers to do this, but I am not able to make it to perform the deduction ([n+1] - [n]) only when it detects a new input. When i try using shift register, it travels to the targetted position, and one it reaches it will travel back to the original position. For example, when a user input 90, it means the table needs to move to point 90. As the shift register is initialized to 0, it will move to point 90 (90-0 = 90) but upon reaching 90, the shift register sends a signal of 90 (90-90 = 0) and the table returns to it's initial position.
    Is there any way that I can delay the reading of shift register only when a new input is detected or is there another way for me to achieve what i want?
    I've tried searching the discussion forum and ni website but couldn't find similar problems. Thanks for your help in advance.
    Solved!
    Go to Solution.

    Hi,
    I've managed to get what I needed by using a shift register + event structure as suggested by Adnan. However, I face another problem after implementing SR+event. I've attached two files, first the original program and second the updated program using SR + event. (it's only the jpg file as I've forgotten to save the labview program, will upload the program by tomorrow.
    In the original program, I have an elapsed time that is able to run continuously when I run the program. In the updated program, my elapsed time don't seem to run continuously when I run the program (as shown by elapsed time indicator). I need the elapsed time to run continuously as a input to calculate my motor profile.
    I suppose this is caused by the introduction of the event structure, will adding a case structure to wrap the event structure solve the problem or is there another way to get pass this. Appreciate if someone could drop me a pointer or two.
    Thanks
    Attachments:
    Mar 16 - continuous elapsed time.png ‏12 KB
    Mar 16 - elapsed time not continuous after introducing shift register + event structure.png ‏17 KB

  • Case structure no false output

    Hey guys,
    To start off, I am very new at Labview.  I have posted about this project before but my professor has changed the assignment slightly.
    - Generate a random set of N points (x,y) between 0 and 100
    - Find the closest point to each point
    - Calculate the number of points with a closest point of less than D
    - Graph the points with the points with a closest point of less than D clearly marked
    So far I have manged to get everything done except for the last part, at least completley.  My approach was to create a case structure with < D as the requirement, if true build array if false I wanted it to do nothing, but I can't seem to do that.  I tried using a number ourside of the array size but that doesn't seem to work either.  Then I tried using a a shift register to do the same thing but had the same problem.  I could use some help if at all possible.  I have posted both codes below.  1_9 is the case structure alone and 1_10 is the shift register approach.
    Attachments:
    Assignment 1_10.vi ‏27 KB
    Assignment 1_9.vi ‏31 KB

    Not bad- monor tweaks set off with some color attached.
    NOTE use BD comments. Watch your data types (point closest should be an Integer type not a double) use increment rather than adding 1. kill the iteration indicators you are outo indexing off of an array generated with the Number of Points(N) control- there is no need to write N number of times to each indicator.  why you CHOSE to cross the wires into and out of the fourth loop baffles the mind
     EDIT: the SR should be initialized with an EMPTY array I just noticed that it has 1 element. that is a bug
    Jeff
    Attachments:
    Assignment 1_10_MOD.vi ‏26 KB

  • Run only once in case structure

    Hello,
    I have a menu set up that is wired to a case structure.  Of course the menu is some boolean buttons that are set to switch when pressed so the case will stay open as long as the button is true.
    inside that case I have another menu and a case structure that operates the same.  In one of these cases I have a piece of code that I only want to run once.  I have tried the while loop that runs once and a for loop that only runs once, but the section of code seems to run continuosly instead of just once.  It works ok if I use any of the latch functions but not the switch when pressed functions.  However, I need the button to stay pressed until the user is finished with that case.
    I really don't want to use an event structure as I was saving that for another piece of code that monitors inputs.
    Anyone have a suggestion?

    Typically, this works easiest with a shift register and and a boolean "implies" function.
    In the code example (see image), the button is set to "switch until released". (Of course you probably don't need the NOT, simply place your one-time code into the FALSE case )
    Message Edited by altenbach on 01-26-2007 01:52 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    implies.png ‏8 KB

  • Keeping count of how many times a case structure has been entered.

    I have a "Case" structure (when a button is pressed, it is "case True").
    I want to keep track of how many times this "case True" has been entered.
    How can I do this?
    Solved!
    Go to Solution.

    For that you need to have a shift register or a feedback node and keep counting whenever the case structure case is executed the count will be increased by one see the attached snippet.
    Good Luck
    The best solution is the one you find it by yourself
    Attachments:
    CaseStructure count.png ‏10 KB

  • How to manage a case structure Untill a value is reached

    Dear all,
    I am collecting data with DAQmx and after a value is reached i want to do smthg else, for this reason i created a case structure and i put to the case selector that if a value is smaller than "10" then it is true. If it is false it should stop and do what i say even if the value gets under "10 again". 
     So how can i make this: "once the value is reached then do what i say  even if  the case selector value is back to true state after a while"
    Thanks.
    Kind regards.
    Solved!
    Go to Solution.
    Attachments:
    False-CaseStructure.png ‏15 KB
    True-Case-Structure.png ‏19 KB

    You can use the shift register to make a condition so once it enters into the value greater than limit case then it will not go to the other case even if the value goes below.
    The best solution is the one you find it by yourself
    Attachments:
    Case Selector.vi ‏7 KB

  • Using a shift register to detect input...

    Hi guys,
    I'm creating a LabVIEW VI that needs to be able to detect when a user changes an input. I read a previous post that suggested using clusters and shift registers to compare previous data.
    My question is how do I use shift registers? I've created a shift register on a for loop, but I'm not sure when to compare the "previous" data to the "new" data. Do I need to add an element to the left side and compare it there? Is the right side the output? I'm just not sure how it works. An uploaded example would be nice. Thanks.
    -Mike

    Shift registers are very powerful but difficult to use for the first time.
    The shift register you just created has two "arrows", one on either side of the structure. The arrow to the left is the value from the previous (i:th) iteration and the arrow to the right you have to feed with the (i+1)th value.
    Now, if you want to compare values and look for a change you can compare your old value (the one coming out from the left) with the new value in your for loop. The feed your new value to the right arrow so that it becomes the old value for the next iteration.
    If you have many parameters to compare, clusters are very useful since they make things very compact. If you are comparing clusters, do not forget to change the setting on the comparison to compare aggregates (r
    ight click on it and select that option).
    Also, in most cases you need to set the initial (start) value for your shift register. This is done by feeding the left arrow with the default value from the outside of your loop.
    I attached a simple example, CompareSettings.vi, that shows how it works. Hope this helps. /Mikael"
    Attachments:
    comparesettings.vi ‏32 KB

  • Why won't my shift register work?!

    I am trying to calculate the volume by multiplying the rate by the time plus the previous volume. The previous volume is the part that I can't figure out. I used a shift register and it's not working.
    Attachments:
    screen shot of program test 12.gif ‏13 KB

    The first thing I notice is that the loop will never exit since the "Loop Done" is never being written to inside the loop.  I'm not seeing what the point of the while loop is.  Are you trying to wait so long until a certain volume is reached and then report it?
    From a general programming view, you should breakup your code into subVIs.  It'll make it a lot simpler to understand.
    I'm also noticing several "multiply by 1" in there.  Those do nothing, get rid of them.
    I also don't see the point in having separate code for the positive and negative flow rates.  The math works the same (V1 = V0 + rate).  The negative will subtract on its own.
    I would convert to a single flow rate.  For instance, if the rate is in ml/h, convert to ml/min inside a case structure and then do the volume calculation after the case structure.  If the rate is in ml/min, just pass the flow rate through the case structure and do the calculation.  This will eliminate duplicate code.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Trying to clear an array inside a case structure

    Good morning all.  I am trying (unsuccessfully, obviously) to clear an array inside a case structure.  (See case structure at right side of vi, I colored it green to make it easy to find).  Here's (briefly) what I'm trying to do.  I have 6 test probes in the process.  All six probes are connected to the Alcatel Detector through a 6-solenoid manifold.  As I run the test, I want to sample 1/second, for let's say 3 minutes.  For the first 30 seconds, I want to pull a sample from from probe 1, so I turn on solenoid one and leave it open for 30 seconds.  Now all 30 values are tagged as having come from Probe 1, and they're stored in array 1.  I can now compute an average value for probe 1. Then I close solenoid 1 and open solenoid 2, saving the next 30 values to array 2.  (and so-on, until I have measured all 6 probes for 30 seconds each).  Then I wait a pre-determined amount of time and repeat the process.  Here's my problem.  I want to clear out each array as I begin the second iteration, so that I can easily compute the average of the last 30 values.  If I initialize the array by connecting a constant 0 to the shift register on the for loop insid ethe case structure, it does not work, nor does it work to place the 0 outide the overall for loop (the next for loop going out, NOT the OVERALL for loop).  I know my programming skills are still crude, but I'm putting everything into this.  Anyone have any suggestions? 
    Attachments:
    HCMF rev 1 25 Apr.vi ‏485 KB

    Altenbach, I definately understand your approach, and I like it much better than my own.  But I still have no luck making it work.   I get the same result as before (my original attempt).  Value 0 of the array simply changes each iteration, with nothing "saved".  Each new value simply overwrites the last value.  Can you take a look at my new vi, with changes, and see if you can find the error of my ways.  I am but a rookie Jedi in the vast reaches of LabVIEW Space, and you are no doubt a Jedi MASTER
    Attachments:
    HCMF rev 1 25 Apr pm.vi ‏374 KB

  • Problem in using the shift Register

    I have a problem regarding shift register when i was using it in my application.
    During the runing of the application i found that sometime shift register not pass the value to the case structure. at that time result is not displayed.
    i have attached the application in which that problem occur and the process regarding the execution, how bug produce and how to check where the shift register stop. please find the attachment and reply on the same.
    Attachments:
    Shift Register Checking Application.zip ‏173 KB

    I'm sorry but I don't understand your program.  I only see one shift register in Result Display.vi.
    What I do see is a lot of odd constuctions of while loops that only run once in your Main.VI.  Also, a heavy reliance on global and local variables that I suspect are leading to race conditions.
    Have you tried using the debugging tools such as probes and highlight execution to see our your application is behaving?
    I'd also be concerned about how you have "Lock Front Panel Until Event Completes" in the cases of your event structure.  And those event call other subVI's that may take a while to run and rely on user interaction with the front panel.  I also don't understand why when I hit "OK", the subVI front panel remains open.  It just makes running your application that much more confusing.

Maybe you are looking for

  • Clipboad manager for my issues

    Hi! I am using xfce, and my problem is that if you copy text content with mouse for example in a browser window, and then I would paste it to a terminal window (Terminator), I can't do it with usual Shift+Insert, because the so called primary selecti

  • Problems during creation of journalling triggers

    Hi, I'm using headstart 6.5.1.13 and when I try to create journalling triggers with the HSU, the utility proceeds normal, but when I view the log there's an error, "Exception; Note that the text for this element may have been corrupted". Result, the

  • HDMI and Denon AVR-889

    Hi, I have the Mac mini mid 2011 wth the Intel HD 3000 card and it is hooked up via HDMI to my receiver then from my receiver to my Samsung TV. I have one nagging issue when switching sources, whenever I go back to the Mac mini the screen flickers li

  • Rman backup with nocatalog

    hi, if i take backup by rman nocatalog ,where it cud be problematic if take backup in nocatalog & wt should i do to resolve them. thxs

  • Cofiguration step for  SubContracting Order Cycle  (SCO)

    Pls,provide me the the configuration steps of SCO(Suncontracting Order Cycle)