Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

ExitScan command to stop program


TAM Aug 21, 2014 04:33 PM

Hi All,

I have a quick question about the ExitScan command. I am using a CR800 to trigger an automated water sampler (ISCO 3700) with a capacity of 24 sample bottles. In the case where all 24 samples are collected, I trigger a "dumpFlag" which then sends me a text message to go collect the sample bottles. My question is should I use the ExitScan command to put a halt on my program. My intention is to stop the program, collect the bottles, and then manually restart the program. If so, when I restart the program, does it return to the Scan command or the BeginProg command (I have a few lines of code after BeginProg and before Scan so this information would be important).

Thanks very much for your input,

-Tony


Dana Aug 22, 2014 07:21 PM

It seems the easiest thing to do might be to have a boolean variable in your program (we often use Flag()), in an If statement that controls when the code in the program is run and when it is not (rather than an ExitScan).

So...something like:

Flag(2) as Boolean

BeginProg
'set the flag to true so the code runs first time around
Flag(1) = True
Scan
If Flag(1) Then
'run the code to collect your samples
'When samples = 24, set Flag(1) low
EndIf
NextScan

EndProg

This would also allow you to manually start/stop the scan whenever you needed -- to restart, set the boolean value to true (and the code within Scan/NextScan would run), and if you needed to do maintenance or stop the program for any other reason, you could by setting the flag to false.

In this instance, the Scan would basically still run on the interval, but if all instructions were inside the If statement nothing would actually be running until Flag(1) was true. You also have the flexibility of keeping some code within the If Statement so it could run conditionally and other code outside that gets run each scan (for instance, battery voltage or internal temp).

I hope this helps,

Dana


TAM Aug 22, 2014 08:01 PM

Thanks very much! That seems like a pretty simple solution!

Log in or register to post/reply in the forum.