int main(void) { init_timer32(0, TIME_INTERVAL); enable_timer32(0); // (bit 1: rising, bit 2: falling, bit 3: Int) LPC_TMR32B0->CCR = 0x07; // Enter an infinite loop while(1) { } return 0 ; } |
volatile uint32_t count_value; void TIMER32_0_IRQHandler(void) { LPC_TMR32B0->IR = 1; /* clear interrupt flag */ /*In the timer interrupt handler, readout the timer capure register (like CR0) and use that value to calculate the frequency. Make sure you reset the TC. */ LPC_TMR32B0->IR = 1<<4; /* clear interrupt flag */ count_value = LPC_TMR32B0->CR0; LPC_TMR32B0->TCR = 1<<1; timer32_0_counter++; return; } |
int main(void) { init_timer32(0, TIME_INTERVAL); enable_timer32(0); // (bit 1: rising, bit 2: falling, bit 3: Int) LPC_TMR32B0->CCR = 0x07; // Enter an infinite loop while(1) { } return 0 ; } |
volatile uint32_t count_value; void TIMER32_0_IRQHandler(void) { LPC_TMR32B0->IR = 1; /* clear interrupt flag */ /*In the timer interrupt handler, readout the timer capure register (like CR0) and use that value to calculate the frequency. Make sure you reset the TC. */ LPC_TMR32B0->IR = 1<<4; /* clear interrupt flag */ count_value = LPC_TMR32B0->CR0; LPC_TMR32B0->TCR = 1<<1; timer32_0_counter++; return; } |
init_timer32(0, TIME_INTERVAL); |
/* Capture on both edges (so the half period) * and enable the interrupt */ LPC_TMR16B0->CCR = 0x07; |
LPC_TMR16B0->IR = 1<<4; /* clear interrupt flag */ count_value = LPC_TMR16B0->CR0; LPC_TMR16B0->TCR = 1<<1; |