interrupts disabled in SIGNAL() ?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are interrupts automatically disabled in SIGNAL() or INTERRUPT() functions? The AVR automatically globally disables interrupts when one occurs, but is this also the case in C?

/Jakob Selbing

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The AVR automatically globally disables interrupts when one occurs, but is this also the case in C?

C can't make the AVR go against its nature. When an interrupt fires, the AVR will always disable interupts.

When you declare the ISR as type SIGNAL(), the interrupt remains inihibted, unless you do something inside the ISR to change that,

When you declare the ISR as type INTERRUPT(), the first thing that the compiler will do as soon as the ISR starts, is re-enable interrupts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi I am using atXmega 256a3-au. In my system there are multiple interrupts configured. I use __save_interrupt,__disable_interrupt and __restore_interrupt to change global interrupt mask in sreg register when i want to perform some critical task.

clearing bit in SREG register saves the pending interrupts right?

 

My requirement needs only timer 1 interrupt to be enabled for few ms and rest all disabled. is there any way in which other interrupts can be saved..or kept pending ?

If i disable other interrupts than timer1, they will not be saved or kept in pending list right?

 

There is no such register in atmega in which i can explicitly disable mask of each module. Is there? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your post has nothing to do with the thread you have attached it to??

 

Clearly you are not using avr-gcc (subject of this thread).

 

Anyway, every interrupting peripheral in an AVR has an interrupt enable bit so if you want only one source to be active you just have to ensure that all the other enables are set inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Anyway, every interrupting peripheral in an AVR has an interrupt enable bit so if you want only one source to be active you just have to ensure that all the other enables are set inactive.

And just to add to cliffs comment, by default all peripheral interrupt enable bits are off until you specifically enable one or more of them, some goes for the global interrupt enable as well!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Once upon a time in an ancient relic version of avr-gcc there were 2 different keywords for ISR routines.

It may or may not have been "SIGNAL" and "INTERRUPT".

One of those behaved like the normal AVR, with global ISR's disabled during the ISR itself.

The other inserted an instruction to enable (Global?) interrupts early in the preamble of the ISR itself.

 

A more modern variant of avr-gcc may have something similar implemented, but you'd better read the manual ti be sure.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Smita, did you realize this thread is 14 years old? laugh

/Jakob Selbing