The Godfather talking
You think I am funny guy huh?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 11:31:30 11:31


Login with username, password and session length


Pages: [1]
Print
Author Topic: interrupt priority in avr ?  (Read 10559 times)
0 Members and 1 Guest are viewing this topic.
omidsht
Active Member
***
 Muted
Offline Offline

Posts: 192

Thank You
-Given: 60
-Receive: 16



« on: February 03, 2008, 01:11:31 13:11 »

hi ,
how can we set interrupt priority in mega16 ?
for example in 8051 , we had IP register to set up the priority levels , how we do the same in ave mega16 ?

thanks

omid
Logged
rtm
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 90
-Receive: 71


a.k.a. klug


« Reply #1 on: February 03, 2008, 06:15:00 18:15 »

Interrupt vectors in atmega16 have fixed priority in accordance with their address. The lower address - the higher priority.
Logged
omidsht
Active Member
***
 Muted
Offline Offline

Posts: 192

Thank You
-Given: 60
-Receive: 16



« Reply #2 on: February 03, 2008, 08:10:36 20:10 »

Interrupt vectors in atmega16 have fixed priority in accordance with their address. The lower address - the higher priority.
are their address fixed or they depend on how you write the program ? i mean can we change their addredd to change the priority ?

omid
Logged
rtm
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 90
-Receive: 71


a.k.a. klug


« Reply #3 on: February 03, 2008, 08:22:49 20:22 »

Sorry, I can not reply by PM - it is disabled for me.

Yes, every vector has fixed address. You can not change vector address. For example INT0 interrupt will always change program pointer to $0002 address.

So, you can not change priority of interrupts. The only thing that you can make in your program - to disable other interrupts when starting some interrupt subroutine.
Logged
telyadi
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 0
-Receive: 0


« Reply #4 on: February 04, 2008, 10:36:18 10:36 »

a correction:
When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts
are disabled. The user software can write logic one to the I-bit to enable nested interrupts.
All enabled interrupts can then interrupt the current interrupt routine. The I-bit is
automatically set again when a – RETI – is executed.
Logged
omidsht
Active Member
***
 Muted
Offline Offline

Posts: 192

Thank You
-Given: 60
-Receive: 16



« Reply #5 on: February 04, 2008, 04:22:17 16:22 »

a correction:
When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts
are disabled. The user software can write logic one to the I-bit to enable nested interrupts.
All enabled interrupts can then interrupt the current interrupt routine. The I-bit is
automatically set again when a – RETI – is executed.
if I-bit is manually set to one , in interrupt subroutine , does any other interrupt , interrupt the current one or only the one which is higher (the less address) is nested ?


omid
Logged
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #6 on: February 06, 2008, 08:50:24 08:50 »

Hello omid,

If you enable the interrupts within an ISR, all interrupts irrespective of their priority(address-wise) are enabled. You can check this by simulating in AVRStudio. But AVR docs are unclear about this. So better assume that all interrtups are enabled, if you are going to do nesting.
One way to allow only specific interrupts while nesting is to disable interrupts which are not required just before enabling I-bit. Make sure you re-enable these interrupts before exiting ISR, but after disabling I-bit.

regards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
picavr
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 263
-Receive: 100


« Reply #7 on: February 11, 2008, 04:02:56 16:02 »

when you know the chronogramme of evenement you can use this solution
program:
enable interruption-priority1
on intrrupt interruption-priority1 gosub subinterruption1
on intrrupt interruption-priority1 gosub subinterruption1
on intrrupt interruption-priority1 gosub subinterruption1
.......
on intrrupt interruption-priority1 gosub subinterruptionx
.....

do
loop

subinterruption1:
enable interruption-priority2
instruction.....
return

subinterruption2:
enable interruption-priority3
instruction.....
return


subinterruption3:
enable interruption-priority4
instruction.....
return


subinterruptionx
.....
instruction.....
return



Logged
mpas
Guest
« Reply #8 on: February 24, 2008, 12:16:45 12:16 »

right way is nested interrupt routines don't use
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC