Whenever a timer overflow occurs, Timer ISR will surely launch. The Timer ISR always launches whatever your microcontroller may be doing, or whichever functions it might be executing. Similarly for a 16 bit timer, Timer ISR launches whenever the value of timer exceeds 65,535. Every time a timer register overflows, a special function know as Timer interrupt service routine starts executing. For us this event has serious importance. When a 8 bit timer register’s value exceeds 256, it again starts from zero. That’s far from the 4,000,000 ticks per second Generated from a 4Mhz crystal. However, the timer can only count up to either 255(8-bit timer register), or 65535 (16-bit timer register). The timer and counter functions in the microcontroller simply count in sync with the microcontroller clock. Microcontrollers with timers functionality have an internal register, the value of which increments automatically with the passage of time. A basic instruction is processed when a tick from the clock passes. This is the basic function of microcontrollers. Microcontrollers need clocks so that our programs can be executed in rhythm with the clock. In our case we use crystals that resonate on high frequency to produce a consistent clock signal required by the Microcontrollers. Sources of Interrupts in pic microocntrollerīut first, it’s important to know that there is a clock inside (or outside) the microcontrollers. you may also like to check complete list of pic microcontroller tutorials. In such a way CPU does not skipped any instruction. As soon as the ISR ends, the CPU restores its saved state and resumes where it left. The ISR is usually very small in microcontrollers and works very fast. The CPU will store its current process and go to interrupt service routine where we can process the command or put it in a FIFO (First in First Out) queue (to process latter). The CPU will start on doing the current job but as soon as the interrupt occurs presses the button it informs the CPU using an interrupt. So the CPU keeps on doing its normal job, which may be for example read temperature using LM35 sensor and display on LCD. For example the microcontroller does not know when a user will press a button, so the microcontroller will continue its operation until a interrupt is received. CPU does not know when these interrupt will happen, so CPU will keep doing its normal execution until interrupt occurs. Interrupts stops the CPU program from normal execution and ask it to serve first what appear as a interrupt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |