[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] interrupt in as

From: Kujala Matti
Subject: Re: [avr-gcc-list] interrupt in as
Date: Wed, 10 Oct 2001 15:31:14 +0300 (EET DST)

> Hi,
> can explain me somebody how can i implement an interrupt-handler purely in 
> assembler ?
> I would need an interrupt routine with no overhead from the c-compiler. If I 
> use
> {
> asm("nop");
> }
> I get code output like this:
> 000000b4 <_interrupt1_>:
>   b4:   1f 92           push    r1
>   b6:   0f 92           push    r0
>   b8:   0f b6           in      r0, 0x3f        ; 63
>   ba:   0f 92           push    r0
>   bc:   11 24           eor     r1, r1
>   be:   00 00           nop
>   c0:   0f 90           pop     r0
>   c2:   0f be           out     0x3f, r0        ; 63
>   c4:   0f 90           pop     r0
>   c6:   1f 90           pop     r1
>   c8:   18 95           reti
> The Problem is now, that i have an extremly time critical applikation and i 
> have for some reasons only 16 (!) takt-cycles to handle this interrupt 
> optimal. The code constructet wasts about 12 of them.

Doesn't that code use something like 20 cycles?
Anyway, you are talking about a very tight timing.

Worst case you have just begun executing a 4 cycle instruction when the 
interrupt occurs. The instruction will be completed so here goes 3 cycles. 
The jump to the routine throught interrupt vector takes 6 cycles, so we 
are at 9 cycles total. Return with reti takes 4 cycles, for 13 cycles 
total. You are left with only 3 cycles to do whatever you want. 

Correct me if above was somehow wrong.

Here is something I wrote, however I don't know if it works with the 
current version of avr-gcc:


What sorcery, what spells, have brought thee here?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]