Jump to content

Portion of code want to execute only once


Recommended Posts

Hi..

I have made one VI. In which some portion of code I want to execute only once. For that I have made one case statement. First time case condition is true and

desire code is executed. But how can I stop executing that code second time. Means second time I want to make case condition variable false.

How can I do that?

Thanks in advance.......

Link to comment

QUOTE(prayami @ Mar 26 2007, 05:39 PM)

Hi..

I have made one VI. In which some portion of code I want to execute only once. For that I have made one case statement. First time case condition is true and

desire code is executed. But how can I stop executing that code second time. Means second time I want to make case condition variable false.

How can I do that?

Thanks in advance.......

Search in the palettes for the "First call?" primitive. Wire that boolean output to your case structure. That prim will return true the first time it is called, but false thereafter. If you stop the VI running and restart, the prim resets.

Link to comment

QUOTE(Aristos Queue @ Mar 26 2007, 06:22 PM)

Search in the palettes for the "First call?" primitive. Wire that boolean output to your case structure. That prim will return true the first time it is called, but false thereafter. If you stop the VI running and restart, the prim resets.

First call works well if you only want the case called only once during program execution, but if this is a subvi that needs to be initialized each time it is called you should use a shift register.

Link to comment

Thanks for reply. I want to make subVI so gleichman is right. I have to make shift register. I tried to make one but as I am new to LabVIEW. I am not getting

success. I know it is very basic but don't know, why I can't make it happen?

Is there anybody who can send me simple subVI in which (may be using Shift Register) some portion of code can be called once even though the subVI is in the

while loop when that subVI will be used.

Thanks in advance.......

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.