Reset a feedback node within a loop

Hi everyone,
I am new user of LabVIEW and sometimes even the most simple task seems to be very difficult for me.
What I am trying to do is this:
1. Reading a signal (I am using the random generator in the example below).
2. Display the signal on the screen (the Waveform Charts)
3. When I press a button, a predefined number of signals should be saved to file.
I have managed to both display the signal and save it to file, but I am unable to find a way to stop the file saving when enough signals have been saved.  I am now trying to count the signals saved using a Feedback Node.  This works fine the first time the button is pressed, but the next time the button is pressed, the Feedback Node continues from the last time, ie. it is only reset when the outer While-loop is run the first time.
So my questions are:
1. Is it possible to reset the Feedback Node when the Boolean variable as shown in the example changes from True to False?
2. Is there a better way to save the data (and being able to display it to screen (and later using the data in the VI)).
Best regards,
Martin T. 
Solved!
Go to Solution.

Yes you can using a simple 'Select' function:
Ton
Message Edited by TCPlomp on 29-10-2009 10:09 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!
Attachments:
Example_VI_BD.png ‏10 KB

Similar Messages

  • Reset feedback node

    Hello.
    The community has posted a few examples of how to reset a feedback node, but I'm not sure I understand these examples. What I'd like to do is reset the feedback node that resides within a nested for loop. i.e. Whenever I actuate the "collect" boolean, I want the "loop count" indicator to start at 0...and then increment (+1) within the nested for loop...and then reset to 0 if I select the "collect" boolean...and then increment...etc.
    Thanks for any guidance/suggestions.
    Attachments:
    feedback.jpg ‏52 KB

    Original attachment was not legible...hopefully this one is better.
    Attachments:
    feedback node.PDF ‏442 KB

  • SubVi with feedback nodes used more than once inside a While Loop

    All,
    I have a subvi that does a set of operations and uses 3 feedback nodes. I am using this subvi inside a While Loop a total of 4 times. I've noticed that all instances used share the same result at each corresponding feedback node but I would like to have an individual result from each of them. Is there an easy way to go around this problem? I have come up with ways to avoid this: a) create a different vi for each time the subvi was used. b) use global variables instead of feedback nodes. Is there any easier way to go around this issue?
    ExamplePlease note that both subvi's are the same) If on my first subvi I calculate a maximum value and get 1.29 (then goes to feedback node) on my second subvi i get 1.01 my feedback node at the second subvi still registers the maximum value to be 1.29. (and I want it to be 1.01!)
    Hope this is not too confusing, I've been scratching my head with this for a while, can't find the "easy" button. Thanks in advance.
    -Pop
    Im using 9.0.
    Solved!
    Go to Solution.

    Attaching the code would be helpful. Anyway, I am not sure how multiple feedback nodes are supposed to operate so I will defer that to others to answer. As far as being able to use distinct values or instances if you are using a subVI you could mark it as reentrant. That way each call to it will behave as it it were a copy of the VI and it will have its own memory space. This should include the feedback node. You may be ending up with a single subVI and in reality a single feedback node. If you need to pass data between calls than simply wire the data through. You could also use an Action Engine to store and retrieve values. An AE is a MUCH better solution than a global variable.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Reset feedback node through button (Boolean)

    Hi all, 
             I am using feedback node, and I want this feedback node to be reinitialized whenever I a press button (means whenever my case strucutre goes false). I really don't know how to do that. I can reinitialize all of my values except "array size". Please find the VI attached. ( I'm beginner so I might be doing it in a very complicated way). One more thing I can't use shift register because I have to include this code in other VI and it will make things more complicated for me.
    I hope there will be a simple way to reinitialize feedback node using boolean button.
    Regards,
    Amna
    Attachments:
    RTB.vi ‏22 KB

    I would recommend to use a shift register instead. Here's a quick draft. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RTB_MODCA.vi ‏22 KB

  • Restting A Feedback Node

    Hello,
    In the attached VI the counter is not resetting. I am trying to reset it on every cycle of the outer loop.
    Message Edited by MCU on 03-16-2009 05:22 PM
    Attachments:
    feedback node reset.vi ‏7 KB
    feedback node reset.png ‏9 KB

    Is this what you are trying to do?  If not let us know.
    Message Edited by jmcbee on 03-16-2009 04:29 PM
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    Reset Counter.PNG ‏7 KB

  • Feedback nodes in Error cluster

    Some time back I
    had posted a VI called Simple StateMachine template. Based on the
    comments from fellow members I have redone it and am attaching it
    herewith. ( LV7.1 + Win_XP Professional )
    If you just open it and check the block diagram, you will notice that
    LV has introduced a feedback node in the error cluster looping between
    DAQMx function Write Digital Output and Read Analog input. I am not
    sure why LV does this even though the two functions have no common
    reference or relevance between them.
    You can also try this : Just remove the data lines to the two Digital
    Out functions, and also the error cluster with Feedback node . Rewire
    the Error cluster but this time without the feedback node. And now if
    you try to connect the Digital Out data lines, you will find that the
    Data lines are drawn with feed back nodes !!
    I am sure LV is trying to tell me something - only that I don't understand what it is. Can some one  elaborate on this ?
    Thanks
    Raghunathan
    Message Edited by Raghunathan on 07-04-2005 08:29 PM
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.
    Attachments:
    PRP_Main.vi ‏288 KB

    You have an impossible loop in your code (Run it with execution highlighting to verify):
    Dig8-15 relies on data from the case structure.
    analog input 0-7 provides data into the big case structure
    This means that Dig8-15 cannot execute until the case has executed, but the case must wait for data from analog out. LabVIEW is smart enough to insert a feeback node such that AI0-7 gets the error from the previous interation. This is NOT a desirable situration. 
    Without the feedback node, yuor code is broken. AI0-7 cannnot run because it must wait for DO8-15 to execute. DO8-15 cannot execute because it must wait for AI0-7.
    You should:
    Uncheck the diagram option "Auto insert feedback nodes in cycles" to make sure to get broken wires so it is easier to find the problem.
    FIx your dataflow. Please make sure your wires flow left-to-right, it make errors like this less likely. You need to wire the error clusters in the order the subVIS execute.
    I hope this is clear enough, but please ask is you continue to have problems. Good luck!
    Message Edited by altenbach on 07-04-2005 07:18 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Feedback nodes / delays and Resource Usage on FPGA

    Again it's time for an exotic FPGA semi-noob question from myself.
    This has been bugging me for a long time:
    When implementing a delay stage on a Virtex-5 target, we have a few options available.
    Feedback nodes : Uses LUTs.  Virtex 5 has 6-input LUTs.  Does this mean that a Feedback node with delay 1 requires the same resources as a Feedback node with delay 6 and a Feedback node with delay 7 requires double the LUTs as one with delay 6?
    Example: A single unit delay feedback node for a U16 requires 16 LUTs.  What is the LUT usage for 6, 7, 9 delay?
    BRAM : Uses few LUTs and Registers. I reckon I understand this one.
    Discrete Delay : Can't be used as feedback but is more efficient than feedback nodes?  It is written in the help that feedback nodes with the reset support disabled CAN be implemented as SRLs allowing the compiler to choose th ebest option whereas the Discrete Delay primitive forces an SRL  Is the SRL implemented using LUTs?.
    Which of these options is recommended for which purpose.  We're really filling our chip and need to start considering such aspects of number storage.
    Sorry for the over-reaching vague questions again.
    On the other hand, being on a steep learning curve is actually almost thrilling.  Every bit of information helps me learn so thanks for that in advance.
    Shane
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

    JLewis wrote:
    The number of inputs is only indirectly related to the supported delay. The V-5 and above CLBs (Configurable Logic Blocks) can be configured as dedicated shift registers with delays up to 32 in a single LUT per bit. The main restriction is that these shift registers are not resettable, so you only get this implementation when configured without an initialization value. Delays above 32 can be efficiently implemented in multiple LUTs (ie, 1 LUT per 32 delay). These shift registers are known as SRL16 or SRL32, depending on the target family.
    So does this mean that on a LUT-basis, a shift register (with the reset conditions met) with a delay between 1 and 32 costs the same amount of resources?  33-64 delay costs twise that of a single delay?  Is this correct?  I think I need some benchmarking code.....
    JLewis wrote:
    Discrete Delay maps to the same shift register implementation as feedback nodes if the reset condition is met. Otherwise, the main difference is that the Discrete Delay exposes the dynamic delay feature available in the hardware shift registers and, as you noted, can't be used in a feedback cycle. If neither of those considerations is a factor in your design, it's just a matter of preference.
    This document from Xilinx contains the keys to the kingdom, as far as what hardware capabilities are available: http://www.xilinx.com/support/documentation/user_guides/ug474_7Series_CLB.pdf
    That's kind of what I thought.
    JLewis wrote:
    Hi Shane,
    Great questions!
    Well thank you,  Thanks for the answers.
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • Feedback node global

    Were these just a fad? I stopped using them years ago because I heard they had performance problems. But I also heard that they were not intirely implemented correctly and NI was going to fix it.
    PaulG.
    "I enjoy talking to you. Your mind appeals to me. It resembles my own mind except that you happen to be insane." -- George Orwell
    Solved!
    Go to Solution.

    I remeber doing a test not long ago and found that the FBN was slightly slower than the SR for creating FGVs.  I'll have to test it again with the lastest LabVIEW version.  I do remember back in the 8.6 days of Darren stating the the FBNs were faster due to not needing the loop overhead.  So a lot of my FGVs use feedback nodes.  I think they make it cleaner.  Some I work with think the SR is easier to understand.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Feedback node in LabVIEW

    Hi everyone,
    I am trying to simulate the second-order generalized-integral SOGI in LabVIEW and compare step by step with Simulink. The results are the same until I make two feedback loops by using feedback nodes. The graphs in LabVIEW show nothing. Can you give me some recommends for these iteration loop?
    I attach SOGI and my simulation model for detail.
    I really appreciate your nice help!
    Best,
    Tuan
    Attachments:
    SOGI_fig.png ‏96 KB
    Implementation.png ‏11 KB

    You need to initialize your feednode nodes to an array of the appropriate size to match your waveform length.
    In LabVIEW, what happens if you have {1,2,3} - {0,2}?  The output array will be of length of the smallest of the arrays being subtracted.  So you will get {1,0}.  So what happens when you subtract an empty array?  You will have an empty array as your output.
    Here's a quick edit of your code.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    TestPhase.vi ‏30 KB

  • Feedback node behavior

     I never expected a difference between Array1 and Array2 in the attached vi.
    In the feed back version, if the incoming array is all false, Feedback indicator is not initialized to empty, and Array2 contains stale data.
    Attachments:
    FeedBackNode.vi ‏23 KB

    beavercreek wrote:
    Dang it,  sorry about the attached.  I was trying to be nice by back versioning the source code, but I went beyond the feedback node feature.
    I don't really have a question,  I just expected the initializer to intialize Feedback (and Array2) to empty, regardless of if the true case ever executed.
    My bad, and a heads up to others.
    I don't know why you'd expect an initializer to initialize something back to empty after code has executed.  The initializer only operates on the feedback terminal when it executes.  Once you get into your For Loop, the initializer terminal never comes into play again.
    One problem with your code is that your terminal is at the output of the feedback node rather than the output of the build array.  So the data going into the feedback array indicator is always from the last iteration where the boolean was true, not the current iteration.
    If you want to get the data in the array indicator after the for loop is done, then I would use the variation with the shift register, and not use the feedback node.  Or if you use the feedback node, use the initializer terminal on it, then it isn't necessary to have the case structure and you can wire the data directly out to an indicator outside the for loop.
    Attachments:
    FeedBackNode[1]_BD.png ‏32 KB

  • Feedback node from case structure

    checkLED.vi is my first rev of this. Then I realized I can incorporate the 345/348 selection into the case structure, which resulted in checkLED2.vi. However as soon as I did this, the feedback loop inserted itself. I don't understand why this happened and what it means. The string coming from the case structure is an INPUT to the two 34970 vis. There is no feedback going on here. If Labview sees this as feedback, why didn't it insert the feedback node in checkLED.vi?
    Attachments:
    checkLEDs.vi ‏23 KB
    checkLEDs2.vi ‏23 KB

    Look at the dataflow you have created by moving the strings into the case statement. The case statement requires data from the iteration terminal and from the VI in the sequence structure. The sequence structure requires data from the switch VI which in turn requires data from the case statement. This is a clear feedback situation that you did not have before.

  • Feedback Node error and NXT

    I'm trying to create a simple counter using a LabView 8.5 and the NXT.  I'm using a Feedback Node and it does not show an error while editing the VI.  When I try to download the VI to the NXT I get the following error.
    ERROR: An error occurred during parsing.  Node was unable to be parsed. ((Class: FeedbackNode) (VI:Teleop.vi))
    List of errors:
    ERROR: An error occurred during parsing.  Node was unable to be parsed.
    When I click on the error it highlights the feedback node (arrow pointing left).
    Sean

    I found the problem after reading this document:
    ftp://ftp.ni.com/evaluation/mindstorms/LabVIEW_for_NXT_Advanced_Programming_Guide.pdf
    Feedback nodes are not supported in a while loop.  But, you can convert it to a shift register and it will function.
    Sean

  • Feedback Node Crash

    I seem to have stumbled across a bug in LabVIEW 2010. I'm trying to create a subvi that loops FP read, with the FP refnum stored in a feedback node. Unfortunately every time i wire up the feedback node and try to save the vi, LabVIEW crashes. It also crashes if i try to run the vi. Fortunately it does so gracefully and my other vi's can be recovered, but does anyone know if there's a workaround to actually implement this?
    Related vi attached.
    LabVIEW 2010 (v 10.0f2), 32-bit running on Win XP
    Attachments:
    FP Read x measurements.vi ‏17 KB

    Does it give any error codes? I don't have your subVI. The main one is simple enough. Try recreating it from scratch. Sometimes VIs get corrupted or just go insane.
    =====================
    LabVIEW 2012

  • Feedback Node Initializer Being Ignored ?

    Hi
    I have a feedback node sat in a For Loop, the number of iterations is determined by an input array. The same input array is wired to the initializer terminal of the Feedback node.  The Feedback node delay is set to 3 and yet the output of the node only contains the first value of the array for the first 3 iterations. It's easier to show than describe.
    So I would expect the output Array to contain the values 3,1,0,0,1,2 yet it actually contains 3,3,3,0,1,2
    If I wire the scalar value 99 to the initializer then I get the expected 99,99,99,0,1,2
    What am I missing ?
    This is LabVIEW 2011 for MAC OS X
    Don't forget to give Kudo's for a good answer !
    LabVIEW Champion
    Certified LabVIEW Architect
    Certified TestStand Architect
    Solved!
    Go to Solution.
    Attachments:
    Feedback Node.vi ‏8 KB

    To expand on Swatts answer a bit more.  You are actually only initializing the feedback node with a single element because you have the array auto-indexing at the loop tunnel.
    If you fed the entire array into the For Loop and the initializer terminal, it would have worked the way you expected.
    Attachments:
    Feedback%20Node[1].png ‏6 KB

  • Feedback Node Bug?

    I came across an odd situation when using a Feedback Node where a established a delay of more than 1 iteration.  (LV2011)
    I have a waveform datatype.  I wanted to delay the waveform by an iteration of the loop before displaying in a graph, so I added a feedback node.
    Then I realized I wanted to delay it by a few more iterations, so I went into the properties and set the delay to be greater than 1.
    Because I had stale data in the feedback node after 1 run, I wanted to intialize the feedback node, so I right clicked on the initializer terminal and picked create constant.  An array of waveforms was created, and this broke the output of my feedback node since it was wired to a scalar waveform type.
    If I do not have a delay longer than 1, (more normal feedback node), then a scalar waveform is created and no problems.
    Interestingly, I tried the same thing with the more basic numeric datatype, an array was created in one case, a scalar in the other, but the array did not break the output of the feeback node.  I'm not exactly sure what an array into the intializer would mean for a long delay feedback node.  It might make sense that it allows you to create an array of different initial values for each step, and this link on the web help mentions that http://zone.ni.com/reference/en-XX/help/371361H-01/glang/feedback_node/.  But the help embedded in LabVIEW doesn't mention that.  (See attached image.)
    See attached snippet.
    Attachments:
    Example_VI_BD.png ‏33 KB
    Feedback Node Help.PNG ‏145 KB

    Ravens Fan wrote:
    The only other question I have is whether it is appropriate for an array of elements to be generated at the intializer rather than just an element.  A 1 item delay feedback node generates an element,  a 2 or more delay generates an array as default.  What is the difference in the feedback node that treats the creation of that constant differently if Z=1 vs. Z = 2 or more.  It is just a feedback node with a different delay.  While an array would make sense as a data for the initializer for multi-delay feedback nodes, it is just as valid to have a single element as the input if you want the same output to repeat.
    I say yes, it is appropriate to generate an array for a node with a delay > 1, especially given the connection to the unilateral Z transform.  However, you are under no obligation to provide an initial value for all values, you can put a single value into the array and it is equivalent to the scalar input.  You can even put two values in and the second will be repeated until the delay is reached.  With the SR you have to initialize all or none.
    Not everyone has my handy-dandy QD shortcut to convert scalars to arrays (why not?), but I still think it is easier to either live with single element arrays or rip the constant out of the array and rewire than it would be to create a scalar and then reach for the array container or build array.
    My 2c, I rarely increase the delay personally, but I do not do FPGA either.

Maybe you are looking for

  • VGA and S-video

    Can I use both a VGA device and a S-Video device at the same time? Anyone know of a workaround on this?? Thanks!!

  • Event - At selection-screen

    Hi Friends, Use of at selection screen event is to perform some validation PBO .. process before output. But wht is the use of AT SELCETION-SCREEN ON AT SELECTION-SCREEN OUTPUT Please explain with some sample programs.

  • Scipping in SAP script printout

    hai , i have a layout with the size 15 X 7 cm , when next page printing , the printer scipping 10 cm , but i want to be scip only 8 cm. HOW?

  • Aperture vs PSE8 vs iPhoto

    I have all three SW's on a Mac and have three questions: 1. Is there really a difference between Aperture and PSE8 when it comes to basic photo manipulation? They both offer SW for use with RAW images but at least with PSE I can do some broader and d

  • Exception: java.security.AccessControlException

    hi, im writing a swing applet that uses a gif in a toolbar. it works fine in the appletviewer but when i try and run it in IE i get the following message: Exception: java.security.AccessControlException: access denied(java.io.FilePermission new.gif r