understanding of interrupt as program point of view

  • Header file used in programming interrupt is   “#include<avr/interrupt.h>” .
  • The total no of interrupt in ATmega32 is depend upon the peripheral provided in it. In this AVR controller there is 21 total interrupt.
  • Programming of interrupt is done using writing ISR (interrupt service routine) which is define externally in program

Registers used in programming interrupt are

 

TIMER INTERRUPT MASK (TIMSK)

 TIMSK

  • OCIE2 – Output compare interrupt enable for Timer 2
  • TOIE2 – Timer 2 overflow IE
  • TICIE1 – Timer 1 input capture IE
  • OCIEA1 – Output compare A interrupt enable for Timer 1
  • OCIEB1 – Output compare B interrupt enable for Timer 1
  • TOIE1 – Timer 1 overflow IE
  • OCIE0 – Output compare interrupt enable for Timer 0
  • TOIE0 – Timer 0 overflow IE
  • 1 mean enable and 0 mean disable in all above bit

 

GENERAL INTERRUPT CONTROL REGISTER (GICR)

 

 GICR

  • INT0  – External interrupt 0, 1 mean enable ,0 mean disable
  • INT1  – External interrupt 1, 1 mean enable ,0 mean disable
  • INT2  – External interrupt 2, 1 mean enable ,0 mean disable

 

STATUS REGISTER (SREG)

 SREG

 

  • I – Global interrupt enable.  Cli() , this instruction is used to clear  ‘I’ bit of SREG. Sei() , this instruction is used to set  ‘I’ bit of SREG.
  • T – Bit copy storage
  • H – half copy
  • S – sign flag
  • V – overflow flag
  • N – negative flag
  • Z – zero flag
  • C – carry flag
  • 1 mena enable and 0 mean disable in all above bits.