Pausing and Resuming a Recipe in DAQ factory


AdityaSinha

Recommended Posts

i'm attempting to modify a recipe to be paused at a time (possibly using a button) and then resumed (to continue from the same point where it was paused). I tried creating a global flag variable which would step into the RunSeq sequence in your recipesample2.ctl file (attached with my modifications, look for comments in capitals). The loop going through all the recipe steps would occur only if this flag variable were true, if false, it wouldn't enter the recipe steps while loop. This however did not work and I was wondering if anyone has tried this already or has any inputs/ideas I could potentially try.

recipesample2_modified.ctl

Link to comment
Share on other sites

So you want it to pause in the middle of the recipe?  In that case, the if() should be INSIDE the while loop, since the while loop is the loop that runs the recipe.  You'll want something like this:

while((RecipeRunning) && (RecipeStepCount < numrows(RecipeSteps)))
   if(pause_rec==1) 
      delay(0.02)
      continue
   endif
   stepnum = RecipeSteps[RecipeStepCount] // for readability
   execute(format(StepAction[stepnum],RecipeParams[RecipeStepCount]))
   RecipeStepCount++
endwhile

So, if pause_rec is 1 the loop will just spin every 20 milliseconds until either the recipeRunning flag goes to 0, or the pause_rec does.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.