Yeppers, that's exactly what I'd like to do.Do you mean like setting the code so that, for example, if b0=17 then interrupt?
Still not sure what you are trying to do JJ. Sounds like the code starts to pause then changes it's mind on how long to pause for. That's quite an unusual situation.Jaguarjoe said:I would like to reset a pause time period and give it a new value while the pause is active.
I have an ADC channel output variable which is used as the pause value in a ring counter. The higher the ADC output, the faster it cycles. At high pause values ( many seconds) I have to wait for the pause to time out before I can fetch a new ADC value and pause at that corresponding value which gives me a different cycle time. In a nutshell, the program stops while executing the pause and won't update the ADC while it is stopped there timing out. As previously mentioned, 3 or 4 mini pauses instead of one long pause will lessen the effect by a factor of 3 or 4 and would be OK even though its not the ideal way of doing this.Still not sure what you are trying to do JJ. Sounds like the code starts to pause then changes it's mind on how long to pause for. That's quite an unusual situation.
'Init
PauseCounter = 0
OldADCValue = 0
'Main
DO
Pause for a fixed short time
Read ADCValue
If ADCValue <> OldADCValue Then
Threshold = ADCValue * 10 (or whatever calculation you like)
EndIf
OldADCValue = ADCValue
Inc PauseCounter
If PauseCounter >= Threshold Then
PauseCounter = 0
Do something to do with your ring counter
EndIf
LOOP