and the code is given below with explanation
Before jump to explanation if you have no idea about LCD interfacing please refer this section there is clear explanation about LCD interface without using any external library . And if you want to Learn LCD interface with library i suggest you Peter Fleury LCD library go to this link and download zip file which is famous and easy to learn with this documentation .
According to oxford Dictionary the meaning of Interrupt is
- Stop the continuous progress of (an activity or process)
- Stop (someone speaking) by saying or doing something.
same meaning goes to microcontroller . In Above example we are going to display something . The microcontroller do as code say , but if something emergency need to display to lcd say number of button pressed then we need to break the flow of our work and do the emergency job which is called interrupt .The thing need to do while interrupt occurs is placed on saperate place called ISR meaning interrupt service routine and To handle interrupt on microcontroller following steps need to follow .
step-1 include interrupt.h file if you are writing code in C language
step-2 enable global interrupt by calling function sei(); on main routine
step-3 set or reset perticular bit inside GICR register for interrupt selection in above example INT0 pin is defined by setting INT0 bit inside GICR register . Note there are 4 external interrupt inside atmega32 microcontroller name INT0,INT1,INT2 AND RESET . BITS are selected accordingly . Please refer data sheet before you start programming there is detail about these register you can follow data sheet by ATmel.
step-4 set or reset perticular bit inside MCUR register . In which you have a choice how you activate interrupt rising edge or falling edge or low level and high level you can select bit accoding to your need . please refer data sheed of the microcontroller you are using .
step-5 write an ISR function . Inside ISR you have to define what to do if an external interrupt occur . In above case count is incremented by one .