PDA

View Full Version : PAUSE and ASM interruots



MikeBZH
- 3rd July 2024, 18:11
Hi,

I need some clarification about the behaviour of the PAUSE instruction (OR PAUSEUS) when an ASM interrupt occurs.

First, will the interrupt be taken into account or ignored ?

If taken into account will it immediatly terminate the PAUSE instruction or will it delay the execution of the remaining time of PAUSE until the ASM interrupt code is executed ?

Thank you for your help.

MikeBZH

Acetronics2
- 3rd July 2024, 21:37
Hello, Brittany

an asm not masked interrupt will immediatly jump to ( generally ) location 4 of the program ... whatever the program is doing !

that done ... a "classic" interrupt stubb will jump back to the remaining time of the PAUSE ( or Pauseus ). So no Delay guaranteed for the PAUSE statement ...

BUT some tweaking can keep the PAUSE Length ( if possible ) : you have to substract the interrupt duration from the PAUSE PBP used internal counters ...

Flankly ... your question needs to much better explain the context ... as it's not " crystal clear " !

Alain

MikeBZH
- 4th July 2024, 07:20
Hi Alain,

Thank you for your answer which is perfectly clear.

About the context :

I have a permanent repetitive loop which successively calls several subs, always in the same order. This loop, wrotten in PBP, is periodically interruoted by an ASM program, There is no relation between the loop and the interrupt frequencies. Loop : about 2.5 kHz, interrupt : about 60 kHz.

I want to slow down this loop so the simplest way would be to add some PAUSE inside. So my question was: "What occurs if an interrupt comes when a PAUSE is being executed".

The loop duration is not critical at all, so the behaviour you describe should be appropriate.

Thank you for your help

MikeBZH

Ioannis
- 4th July 2024, 19:00
Pause is a PicBasic command.

This command can be interrupted just fine with an ASM interrupt. But you have to be careful to save and restore critical registers during the ISR execution.

The problem is evident in PicBasic On Interrupt system, because the Basic Interrupt will be executed after Pause has finish.

Ioannis