Branch on Interrupts Enabled instruction

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

The AVR instruction set has a few instructions that I have never seen on any other processor.

For example, the Branch on Interrupt Enabled or Interrupt Disabled.

Has anyone every used these instructions? If so, could you post a sample of code so that I could see an example of when they would be advantagous?

Thank you,

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

Example

if Interrupt Enabled use interrupt routine program
else use polling program

if Interrupt Enabled do not write eeprom
else write eeprom

admin's test signature
 

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

Or if your time critical routine needs to disable interrupts temporary but doesn't want to enable them if they weren't turned on in the first place.

admin's test signature
 

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

the main reason for having branch on interrupt enable instruction is that there is a general branch opcode containing sreg bit number field. since global IE happens to be placed in SREG, one of the branches is virtually useless :-)

admin's test signature