John,
sounds a little like not a clear algorithm.
Let me state some assumptions on what you'd like to achieve before giving you an idea.
Using a loop makes sense if you plan to repeat something several times (including maybe zero times). In your case let your counter scan at one voltage. If such a single scan is quick enough so that you can afford finishing it before your program reacts on you pusching the button, than just connect the button with the termination connector of the loop and you'r done. You may save a complete scanning if you put it into a case structure that is just executed when the loop continues.
If, however, your scan takes (much?) longer than the required reaction time, you need some aborting mechanism for that scan as well. This is now completely your turn, as I do not know anything in detail about your setup. Maybe the driver for the counter supports an abort. Or you can split the scanning into much shorter substeps and use a proper means to check for a required abort. This might as well be an putton pressed event. But I'd prefer not to evaluate an UI event in another module. Instead I'd suggest using that event to send a notification or queue element to the other module to request an abort of the counter.
Greetings from Germany!
--
Uwe