12.07.2015 Views

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ATmega32A</strong>When the Atmel ® AVR ® exits from an interrupt, it will always return to the main program and executeone more instruction before any pending interrupt is served.Note that the Status Register is not automatically stored when entering an interrupt routine, norrestored when returning from an interrupt routine. This must be handled by software.When using the CLI instruction to disable interrupts, the interrupts will be immediately disabled.No interrupt will be executed after the CLI instruction, even if it occurs simultaneously with theCLI instruction. The following example shows how this can be used to avoid interrupts during thetimed EEPROM write sequence.Assembly Code Examplein r16, SREG ; store SREG valuecli ; disable interrupts during timed sequencesbi EECR, EEMWE ; start EEPROM writesbi EECR, EEWEout SREG, r16 ; restore SREG value (I-bit)C Code Examplechar cSREG;cSREG = SREG; /* store SREG value *//* disable interrupts during timed sequence */_CLI();EECR |= (1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!