Jump to content

While Loop control


Recommended Posts

I am using a FPGA card with Labview.

I want to use a square wave to control the execution of some code in a while loop.

So when the square wave is high the loop executes. When it is low it does not. The square wave will be about 1Khz.

I tried the square wave function, but it only will work for me when it is in it own loop.

When I try to control the loop from the outside it stops working.

Thanks

Link to comment

I'm not sure I follow what you what to do. Do you want to execute your loop on the rising edge of the square wave? or have it execute as fast as possible when the square wave is high? I'm going to assume you intend to use the square wave as a clock signal, in which case I don't believe that is possible in the traditional sense. What you can do is poll the signal and check for a transition from low to high(false to true) and place your code in a case statement that only executes on that transition. An example of what I mean is below. If you want you code to execute as long as fast as possible when the signal is high simply wire the I/O directly to a case statement.

post-16203-126412299052_thumb.png

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
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.