Completing PAUSE - after Interrupt ?

manie

Senior Member
Picaxe 28x1/2 or 40x1/2.
I will have Hserin/out interrupt set up as required. Normal instruction execution after interrupt continues with next line, this I understand. A "pause" that is inetrrupted however, is cut short (again as I understand).

Can anyaone think of a way to "continue" with the REMAINING period (plus or minus...) of this interrupted pause ?

I suppose one way is to For....Next with multiple shorter pause periods instead of one LONG pause period. That way the code will continue within the interrupted For....pause x....Next loop won't it ?

Thanks for your input
 

westaust55

Moderator
Depends how exact you need your pause to remain.

Even a for next loop will stop early on the pause under operation and thus shorten the period.

More repetitions of the FOR.. NEXT loop with a shorter PAUSE period may improve achieveing approx the actual desired period. But then, how often is the interrupt?

More information on desired accuracy of the overall pause just may help with possible recommendations.
 

manie

Senior Member
Westy: Thanks. The final period is not critical at all. The pause is to action the wait period between cycles of reading temperatures and adjusting the ventilation. This represents one cycle. (Chook-House project new software version). The cycles will probably repeat every 30 secs (minimum) to every 2 mins (maximum). The Hserin interupts can happen at any time and will come either from the PC via RF(remote) or from the Keypad (local) whenever a parameter update is required (ie. manual input). I would like to keep the period reasonably close to its parameter setting, say 60 secs wait between cycles in order for any previous ventilation adjustment to "settle" a little before next reading and adjustment. A few seonds ( say 5-10) slower or faster will not matter at all.
 

westaust55

Moderator
In that case, if a 10 to 15% variation is tolerable, then try the FOR...NEXT approach with a short PAUSE period and higher number of loops
 

manie

Senior Member
Thanks Westy: As I thought but now verified by more experienced member...

Just to clear: so after the interupt completed, the For...Next will continue to its normal end ?
 

inglewoodpete

Senior Member
Thanks Westy: As I thought but now verified by more experienced member...

Just to clear: so after the interupt completed, the For...Next will continue to its normal end ?
Everything else will continue where it left off. Only the remainder of the specific pause that was executing at the time of the interrupt is lost.

Depending on your need for accuracy:
The other way, if time is critical, is to use the on-board timer. The timer would need to be set going at the start of the pause and read at the end. If there was lost time, a variable pause would need to be inserted to compensate. Then, if that pause was interrupted....

It could be done but it depends on how much you need it. If timing is critical, use the timer rather than a loop in the first place.

Peter
 

manie

Senior Member
Peter: Thanks also. I did look at the timer issue but the accuracy is not THAT critical. As I said, if the cycle repeats every say every 60secs, then if interupt occurs and is completed within a few mSecs and the loop is executed to it's completion, it means that maybe a second is lost somewhere. That cycle then completes in 59secs. That will be really good enough.
Thanks for the input guys.
 
Top