09-22-2011 06:59 AM
Hi guys,
I am new to LabVIEW. I am making a simple project. Input an integer N with a numeric control and generate Fibonacci sequence (from f1 to fn). My generated sequence keeps updating every time I change the value of the numeric control. How can I make it remain the same after I input a new value of N, and changes after I press "update sequence"?
09-22-2011 07:18 AM
Help
09-22-2011 07:19 AM
Help is here.
09-22-2011 07:20 AM
Hi Chenxuan
There is a structure built into labview to do exactly this called Event. You can find this in the programing pallete in the block diagram and selecting from the structure sub pallete. There is a good tutorial i have found on the NI Developer Zone that will explain this further.
Event Driven Programming in LabVIEW
http://zone.ni.com/devzone/cda/tut/p/id/3331
Hope this helps your project.
Matt T
09-22-2011 07:23 AM
Two answers.
Easy: Make a while loop. When a button is pressed, go into a subVI and calculate the fibonacci series. Pass this value to both an indicator and a shift register. When button isn't pressed the old value from shift register is passed to the output. (or you could do nothing. value wont change)
Challenging: Learn how an event structure works. Make the fiboncacci calculation only when your button is pressed. Else, do nothing/ pass old value as before.
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/event_structure/
Did I help?
09-22-2011 07:30 AM - edited 09-22-2011 07:31 AM
Hello,
I am an Applications Engineer at National Instruments UK.
As I understand it you have already developed a code to calculate the sequence given the integer 'N'. I am assuming that you are wanting to display the output sequence as an array and that you have already worked out how to do this. Having searched the Knowledge Base (KB) for similar VI's, I have come across the following example:
https://decibel.ni.com/content/docs/DOC-13558https://decibel.ni.com/content/docs/DOC-13558
This example uses notifiers so that the bottom While Loop waits on a notification from the top While Loop before it computes the next sequence. Instead of the event in the Event Case Structure being 'Fibonacci Index' value change, yours could be an 'Update Sequence' value change that will then send the notification to the bottom loop to update the sequence when this value is true.
If you require more information on notifiers and how to use them it can be found using the following link:
http://zone.ni.com/reference/en-XX/help/371361H-01/
I hope this helps with your issue and let me know if it works or not and I will try and help you further.
David
09-22-2011 07:39 AM
Thank you !!!!!
09-22-2011 07:40 AM
Thank you~
09-22-2011 07:40 AM
And thank you David
09-22-2011 07:56 AM
Another homework done?