c the main point on having interrupts in a program is that they break the normal flow of program and the program jumps to a special function which we have defined it the interrupt is generated.. how it happens is like this:
1. An interrupt is generated (can be an edge triggered or a level triggered)
2. At this event, the system stores the address of current operation it was performing onto the stack and then the system checks which interrupt has occoured. It then checks its interrupt vector table for that particular interrupt.
3. From the table, it gets an address in the code space.
4. The program then jumps to that address.
5. At that address, if the program is too long, we jump to some other address where the entire interrupt service routine is written.
6. After it has processed the entire thing, it pops the address from the stack andthe program returns back to its normal functioning..
thus although in the main, you might not have called ur heartbeat function, but as soon as an interrupt occours, it is automatically called by itself and then the program functions normally...
hope this helps..