interrupts during the pause command

afb

Member
From the documentation I note that the input ports are "checked repeatedly" during PAUSE commands. Does anyone know how often this is please ? - I wish to check for the occurence of a 5mSec pulse - but what's the betting that during a PAUSE command interrupts are checked at the 50Hz rate used for the SERVO command! My code is running at 32Mhz if that has any bearing on it.

My pause is of the order of 13 mSec so I'm guessing if my pessimistic guess of a 20mSec checking rate is true, a workaround would be to implement a series of pauses of say 2 or 3 mSec each such that the inter-command interrupt check finds some portion of the 5mSec interrupt pulse.
 
Last edited:

oracacle

Senior Member
hardware or software. IIRC hardware will interrupt a pause but the pause will not be continued after return.
 

hippy

Senior Member
I don't know how often the inputs are checked for interrupt but, as it's done within the PAUSE timing loop itself, it is going to be every 1ms at default speed, possibly more frequently. On an M2 at 32MHz that would be every 125us.
 

afb

Member
thanks for your input - the pulse that I wish to cause an interrupt appears on an input pin of the 08M2 - the interrupt mask having been set accordingly and interrupts enabled. So my question is if the PAUSE is say 13 mSec long, could a 5 mSec pulse on the 08M2 input pin occuring during this PAUSE be detected?
 

afb

Member
@hippy - actually it's the PAUSEUS command I'm using so there may be a different slant on your answer now (sorry!) I need to use PAUSEUS for its finer resolution.

The original project was looking for a 100mSec interrupt so the 16mSec (in PAUSEUS units) wasn't a problem at all, but accommodating an alternative peripheral which generates a 5mSec interrupt pulse is!

I find in practice the 5mSec interrupt pulse is only detected once every 3 or 4 times on average - but splitting the 16mSec into 5 repeated lumps seems to give reliable operation (as I would expect by analysis, unless you know different!)
 

AllyCat

Senior Member
Hi,

PAUSEUS is a "tight" timing loop with only 10 PIC instruction cycles per pass, so there probably isn't time to poll the interrupt port.

However, you could use PAUSE for the major part of the delay and then a PAUSEUS to "fine tune" the last part of the delay. Note that PAUSEUS 0 actually takes around 700 us (slightly longer than a PAUSE 0 !), but from a value of 1 upwards the delay increases in accurate increments of 10 us (or 1 ms for a PAUSE), when using a 4 MHz clock.

Cheers, Alan.

PS: Yes, as oracacle says, the PAUSE is not re-instated after an interrupt, which can be another reason for splitting the PAUSE into multiple elements.
 
Last edited:

afb

Member
Hi Alan

Thanks for another insightful reply - always nice to hear 'why' rather than 'can't'.

Thanks for yours and oracacle's notes that PAUSE and presumably PAUSEUS are not resumed following an interrupt but in my application the interrupt signals aborting of the timing period so it is of no consequence - but another gold nugget of information, thanks

A lesser Alan
 
Last edited:
Top