PDA

View Full Version : Interrupt while asmmbler command.



Shamir
- 25th December 2006, 17:59
Hi,

I know that PBP will not go to ISR while it is in a PBP command, but is it also true when performing a asm command ?

I tryed it and as i show it dosn't ,am i wrong ?

Thanks
Shamir

sougata
- 26th December 2006, 07:52
Hi,

PBP does not branch to the interrupt vector when an interrupt occurs. By using the On Interrupt, PBP checks for interrupts and flags it. When it finishes the current function it jumps to the defined basic interrupt routine. For example when executing a function block, say serout, PBP would complete the serial out and then process the interrupt. So that's where the latancy is introduce. If PBP is executing a pause then it does it by some iterations of its own library. That means pause is itself a delay loop and your statement defines how many times it should loop around to introduce the desired delay. Thus while executing its own library PBP would finish it and then process. If you are executing an asm statement that already means that PBP is not in the process of executing its built in library. So the latency is less.
As I always mention please look at this thread and appreciate the smart and hard work darrel has done, http://www.picbasic.co.uk/forum/showthread.php?t=3251

BTW if your app is time sensitive and you would be handling higher/lower priority interrupts it is a good idea to use asm. Also to reduce your bank addressing headache you can use the system bank to hold your variables (if they fit) used in the ISR. If not then indirect addressing is what I use on the PIC18

Happy New Year to All

Acetronics2
- 26th December 2006, 11:13
Hi,Shamir

Answering your question, Assembler interrupts have a small latence time ... Microchips tells "around" 4 clock cycles in its datasheets and midrange manual.

this gives one assembler instruction time ... two, if pessimistic !!!

Now, the good question is to know EXACTLY what needs to be saved ( and restored after ... ) THIS portion of code always take some time, and even need some timing values to be corrected in a further step.

Darrel's "instant Interrupts" is the easiest way to care with interrupts "headache" ... but just takes MINIMUM time - Only MINIMUM !!!

Alain