Professional Documents
Culture Documents
IN ATMEGA16
What is an INTERRUPT???
A signal that temporarily stops the execution of a process so that another procedure can be carried out In general sense means "breaking the flow of some process A classroom is the best example of Interrupts Interrupts are nothing more than subroutines or functions that put on hold normal program flow while they are executed.
Applications
RESET is an INTERRUPT!!!!!! In Computer Games and Robotics In many Hardware applications, like RTC(Real Time Clock), Watch Dog Timer etc.. Interrupts are used in almost all complex embedded applications Line follower, Maze Solver
Hardware Interrupts: If the interrupt occurred is due to a change in an external signal i.e. a hardware signal external to code written, then it is called an hardware or external interrupt. Software Interrupt: If an interrupt occurs inside the software like finishing the execution of a process etc. then it is called an software or internal interrupt. ATMEGA16 has 3 external interrupts and more than 17 software interrupts designed for specific functions.
External Interrupts
INT0, INT1, INT2 are the three external interrupts. These External Interrupts are triggered by the INT0, INT1, and INT2 pins.(PINS 16, 17 and 3) The external interrupt can occur in any of the following conditions: (Only for INT0 and INT1) 1. The low level signal on the Interrupt pins can generate an interrupt request. 2.Any logical change in the signal on the Interrupt pins can generate an interrupt request. 3.The falling edge of the signal on the Interrupt pins can generate an interrupt request. 4.The rising edge of the signal on the Interrupt pins can generate an interrupt request.
For INT2??
For interrupt at INT2 pin, the interrupt can occur only if the signal is either at falling edge the signal is at rising edge.
Rising Edge
LOW LEVEL
But the I-bit in SREG(Status Register) must also be set 1 i.e. Logic High to enable the interrupts.
Only enabling the bits INT2, INT1 and INT0 in GICR doesnt enable the interrupts.
Bits 3,2 are used to configure for INT1 pin Bits 1,0 are used to configure for INT0 pin INT2 is configured using another register(MCUCSR)