void OSTIMER_IRQHandler(void) { /* Clearn interrupt */ LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) | (BIT_0); /* clear int flag */ } main() { LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) & (~(BIT_3)); /* disable timer */ LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) | (BIT_0); /* clear any int flag */ LPC_RITIMER->COMPVAL = 72000000; /* 1 sec delay */ LPC_RITIMER->COMPVAL_H = 0; LPC_RITIMER->MASK = 0; LPC_RITIMER->MASK_H = 0; LPC_RITIMER->COUNTER = 0; LPC_RITIMER->COUNTER_H = 0; LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) & (~(BIT_2)); /* debug has no effect */ LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) | (BIT_1); /* timer will be cleared to zero on int */ LPC_RITIMER->CTRL = ( LPC_RITIMER->CTRL & 0x0000000F) | (BIT_3); /* enable timer */ NVIC_EnableIRQ(RIT_IRQn); while(1); } |
void RIT_IRQHandler(void) { /* Clearn interrupt */ Chip_RIT_ClearInt(LPC_RITIMER); } |