The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 02:55:28 02:55


Login with username, password and session length


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

Posts: 193

Thank You
-Given: 60
-Receive: 16



« on: February 03, 2008, 02:11:31 14: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: 41

Thank You
-Given: 18
-Receive: 51



« Reply #1 on: February 03, 2008, 07:15:00 19: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: 193

Thank You
-Given: 60
-Receive: 16



« Reply #2 on: February 03, 2008, 09:10:36 21: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: 41

Thank You
-Given: 18
-Receive: 51



« Reply #3 on: February 03, 2008, 09:22:49 21: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, 11:36:18 11: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: 193

Thank You
-Given: 60
-Receive: 16



« Reply #5 on: February 04, 2008, 05:22:17 17: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
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #6 on: February 06, 2008, 09:50:24 09: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: 169

Thank You
-Given: 184
-Receive: 100


« Reply #7 on: February 11, 2008, 05:02:56 17: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, 01:16:45 13: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