Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] Re: Any way to make interrupts faster, please?

2010-01-20 by Cat C

That's seems like great advice,  
But I've never done a thing like that before (reminds me of a nice song ;-)
... so it will take me some time to figure it out, unless you'd show me how, seeing that you're already so involved :-)

OR, I suppose I can just put the whole assembly in the C file like I already have some below?
Just take it from the "lss", wrap it with "asm - blah" and I'm done?
I think the s file would save me some "wrapping" so it would be nice :-)

The code that generated the assembly shown is:
>>>
ISR(PCINT0_vect, ISR_NAKED)
{
    asm("push R24\n");        //Save R24 because it's used
    asm("in    R24, 0x3f\n");    //Save SREG in R24
    asm("push R24\n");        //Push R24 again
    if(bit_is_set(PINB,PORTB2))
    {
        SPCR = _BV(SPIE) |_BV(SPE) | _BV(CPOL); 
        GPIOR0 = sInByte1;
    }
    asm("pop R24\n");        //Restore R24 for SREG
    asm("out 0x3f, R24\n"); //Restore SREG
    asm("pop R24\n");        //Restore R24 for itself
    asm("reti\n"); 
}
<<<

Thanks,

Cat

> To: AVR-Chat@yahoogroups.com
> From: dkinzer@easystreet.net
> Date: Wed, 20 Jan 2010 23:19:27 +0000
> Subject: [AVR-Chat] Re: Any way to make interrupts faster, please?
> 
> >I suppose only the Rxx that are inside the ISR in the lss
> >file need savin'
> That is clearly true.  The problem is, however, that you can't guarantee that some future version of the compiler won't use different registers compared to the one you're using now.  Even with the same version of the compiler, if you build your application for a different AVR the registers used might change.  These are clearly "accidents waiting to happen" and you can probably count on them happening at the most inopportune time.
> 
> In situations like this I would highly recommend moving the entire ISR to a .S file where you'll have complete control and the assurance of no surprises in the future.
> 

 		 	   		  

[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.