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-04 by Kevin Laborda

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?
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
----- Original Message ----- 
From: Jim Wagner
Sent: Thursday, August 04, 2005 9:48 AM
Subject: Re: [AVR-Chat] Help with using interrupts and ATtiny13.

Hi, Kevin -

Doing what you ask involves two separate things:

(1) Initializing the timer's registers and various
interrupt enables to generate the interrupt event.

(2) An interrupt service routine (ISR) that includes a jump
instruction (called a "vector") at the appropriate location
for the int you need to handle.

The interrupt vector locations are listed in a table in the
data sheet. How you put the jump in depends on whether you
are using assembly language or C.

For this, you ought to be able to get a pretty good idea of
what is happening using the Studio simultor, recognizing
that it is, at best, full of lots of "holes".

Best wishes,
Jim

On Wed, 03 Aug 2005 23:11:54 -0000
"klassasin" wrote:

> I recently obtained a STK500 and two ATtiny13V's.
> I've done basic I/O
> with them already, but I want to try something a little
> more advanced.
> I've been researching interrupts, yet I fail to find any
> particularly
> large amount of information on ATtiny13 interrupts.
> Specifically, I
> want to use 8-bit timer that it comes equipped
> with. I've looked
> through it's datasheet, yet the section on interrupts is
> confusing me.
> I am unable to understand how to initialize interrupts
> (or the
> timer). I also am having trouble understanding how
> to respond to a
> timer overflow interrupt. Simply put, I need to
> initialize the timer
> interrupt so I can do a certain action every time it
>; overflows.
> Can anybody please help me with sample code to utilize
> timer
> interrupts on tiny13's or with a site that could help me
> with them?
>
> Thanks for any help,
>
> Kevin
>
>
>
>
>
>
>
>
>
>
>
>
> 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.