static __interrupt__ void _rtc_handler(void){ int iIRQBit = 0; while ((RTCISR & RTCIENR) != 0) { // while enabled interrupts exist if ((0x01 << iIRQBit) & RTCISR & RTCIENR) { RTCISR = (0x01 << iIRQBit); // clear interrupt if (RTC_handler[iIRQBit] != 0) { RTC_handler[iIRQBit](); // call the interrupt handler } } if (++iIRQBit >= 6) { iIRQBit = 0; } }}