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 Jim Wagner

The scheme suggested below is good, but I would use the
named aliases for the vector addresses. That way, when you
change processors, all that is automatically managed.

Jim


On Fri, 5 Aug 2005 09:55:40 -0500 (CDT)
 Zack Widup <w9sz@prairienet.org> wrote:
> 
> 
> 
> 
> On Thu, 4 Aug 2005, Kevin Laborda wrote:
> 
> > First, I use AVR Assembly.  The thing that
> confuses me is when initiliazing the vector table how do
> I "skip" the vectors I don't want.  Isn't
> the order important when listing the interrupts. Example
> code:
> > 
> >  .ORG 0000 ; Address is zero
> >     RJMP Start ; The
> reset-vector on Address 0000
> >     RJMP IService ; 0001: first
> Int-Vector, INT0 service routine
> > [...] here other vectors 
> > 
> > if I don't want the interrupt at the 000x location
> do I use reti? 
> > From tn13def.inc:
> > 
> > ;**** Interrupt Vectors ****  
> > .equ INT0addr      =$001
> ;External Interrupt0
> > .equ PCINT0addr    =$002 ;Pin Change
> Interrupt0
> > .equ TIM0_OVF0addr     
> =$003 ;Overflow0 Interrupt 
> > .equ EE_RDYaddr      =$004
> ;EEPROM write complete
> > .equ ANA_COMPaddr =$005 ;Analog Comparator Interrupt
> 
> > .equ TIM0_COMPAaddr     
> =$006 ;Timer/Counter0 Compare Match A  
> > .equ TIM0_COMPBaddr    =$007
> ;Timer/Counter0 Compare Match B  
> > .equ WDTaddr      
> =$008 ;Watchdog Timeout
> > .equ   
> ADCaddr      =$009 ;ADC
> Conversion Complete Handle
> > 
> > So, after Reset ($000?), I'd have the INT0addr
> followed by PCINT0addr etc.  If I only want reset
> then the Overflow0 Interrupt would I do
> > 
> > .ORG 0000
> >   RJMP Reset
> >   RETI
> >   RJMP Timer
> >   RETI
> >   RETI
> >   RETI
> >   RETI
> >   RETI 
> > 
> > followed by initializing the stack and
> timer/prescaler in the Reset label code section?
> > 
> 
> 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
> 
> That way I only write code for the interrupts I'm using.
> 
> 
> > Also would the following work for generic stack
> initialization (for what I need)?
> > 
> > .def TEMP = r16
> > [...]
> > Reset:
> > ldi TEMP,low(RAMEND) ; Set stackptr to ram end
> > out SPL,TEMP
> > ldi  TEMP, high(RAMEND)
> > out  SPH, TEMP
> > [ Timer0 initialization]
> > sei
> > 
> > or does the ATtiny13 require something else?
> > 
> > Thanks,
> > 
> > Kevin
> 
> Not sure about the ATtiny13 as I haven't used that one
> yet, but it should 
> work with ATmega8, ATmega16, etc.
> 
> Zack
> 
> 
> 
> 
>     
> 
> 
>   
>   
>     SPONSORED LINKS
>   
>           
>                   
>             
>         Atmel avr
>       
>                       
>         Microcontrollers
>       
>                       
>         Intel microprocessors
>       
>               
>                         
>             
>         Pic microcontrollers
>       
>                       
>         8085 microprocessor
>       
>                     
>            
>   
> 
> 
> 
> 
> 
> 
> 
>   
>   
>   YAHOO! GROUPS LINKS
> 
> 
> 
>    Visit your group "AVR-Chat" on the web. 
>    To unsubscribe from this group, send an email
> to: AVR-Chat-unsubscribe@yahoogroups.com 
>    Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service.
> 
> 
> 
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

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.