Jump to content

Loop execution condition question


Recommended Posts

QUOTE(ironcross77 @ Feb 13 2007, 10:00 PM)

Hi I have a temperature measurement vi running inside a for loop. I want the loop to execute only when the present value of teperature is 5 degrees or more than the previous value. I am storing values using shift registers.

The easiest way to do this is probably to have a while loop around your acquisition -- Have it exit the while loop when the value is 5 degrees more than the last time the loop exited. I'm assuming that you're acquiring the temp signal in the "LJ EAI" VI towards the top of the loop. Inside that VI, where you actually do your DAQ read, make this VI wait until temp is achieved.

However, two warnings to watch out for:

-You'll need to make sure you synchronize with the other VIs in your top-level for loop. As it is right now, it's undetermined if the top "LJ EAI" VI will run before the bottom one. You'll want to use a wire to make sure that the bottom executes after the top is complete.

-While you're doing the acquire and waiting for temp to become greater than 5 degrees from the last reading, this loop may run forever if the temp never rises. You'll need to implement a way to ensure that this loop will stop (A notification from the top-level will work, or something similar)

Note: You could put a while loop around the top "LJ EAI" VI assuming that all that VI is doing is acquisition of your signal.

I've attached a quick screenshot of what your acquisition would look like.

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.