Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Help with using interrupts and ATtiny13.

2005-08-05 by Zack Widup

On Fri, 5 Aug 2005, Thomas Keller wrote:

> On Fri, 2005-08-05 at 09:55 -0500, Zack Widup wrote:
> > You can do it that way, but I assume if I am not planning on using a
> > given interrupt, it doesn't matter what is in that vector location.
> > It hasn't gotten me into troble yet (fingers crossed!).  What I
> > usually do is:
> > .ORG 0000
> >    RJMP Reset
> > .ORG 0003 
> >    RJMP Timer
> > .ORG 0009
> >    RJMP ADCSVC
> 
> [extraneous text deleted for brevity]
> 
> Zack:
> 
>    While this will work, and deos save a small amount of typing, it
> would not fall into the categpry of "recommended coding practices," at
> least., not in MY book.  *grin*
> 
>    The reason being that while you may not EXPECT certain interrupts to
> occur, they can, and sometimes will occur.  By having an explicity RETI
> for each possible interrupt vector, you avoid the complications of
> unpredictable execution of interrupt handling routines.
> 

Yes, as I mentioned I haven't had an interrupt mishap - YET.  But 
sometimes I do have strange things happen, especially when running the 
chip in the vicinity of hundreds of watts of RF.

I like Kat's idea of the flashing LED.  At least I'd know there was a 
problem!

> 
>   FInally, not to put too fine a point on it, but I HIGHLY recommend
> massive, verbose commentary in source code.  Indeed, my source code
> files are often 60% or more comments, as opposed tothe code content.
> There are several reasons for this.  For one thing, you cannot expect to
> remmeber what it was you were thinking when you wrote a specific piece
> of code, when reviewing it years (or evenm months) later.  Also, if you
> are planning to share your code, the more complete and detailed the
> commentary, the easier it wil be for others to understand what you ahve
> written.  This issue of commentary applies espeically to header/include
> files such as I discuss above.  Do not assume that becase a line reads:
> 

I tend to do that, too.  Not only is my memory not quite what it was when 
I was 25 (I myself will forget what I was doing with some code months or 
years ago), I realize someone else might be reading the code I wrote some 
day and will be trying to figure out what I did.

It seems I didn't have too much problem remembering things back in the 
days when I wrote Z80 code (my first microcontroller projects).  But, as 
they say - as you get older, the first thing to go is your memory and 
the second thing is ... hmm, I forget.

Zack

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.