From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do not trigger event until a button is pressed

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"?


 


0 Kudos
Message 1 of 10
(3,073 Views)

HelpSmiley Sad

0 Kudos
Message 2 of 10
(3,062 Views)

Help is here.

Prashanth N
National Instruments
0 Kudos
Message 3 of 10
(3,060 Views)

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

Matthew Trott
Applications Engineer
National Instruments UK
www.ni.com/ask
0 Kudos
Message 4 of 10
(3,059 Views)

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?

Prashanth N
National Instruments
0 Kudos
Message 5 of 10
(3,057 Views)

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

 

David B
Applications Engineer
National Instruments UK
0 Kudos
Message 6 of 10
(3,052 Views)

Thank you !!!!!

0 Kudos
Message 7 of 10
(3,044 Views)

Thank you~

0 Kudos
Message 8 of 10
(3,043 Views)

And thank you David

0 Kudos
Message 9 of 10
(3,042 Views)

Another homework done?

0 Kudos
Message 10 of 10
(3,030 Views)