#define CT32B1 10 [LEFT]volatile unsigned int timer32_1_val = 0; volatile unsigned char timer_32_event =0;[/LEFT] [LEFT]void TIMER32_1_IRQHandler(void) { LPC_TMR32B1->IR = (1<<4); //reset capture 0 interrupt LPC_TMR32B1->TC = 0; //reset timer timer32_1_val = LPC_TMR32B1->CR0; //get capture value timer_32_event =1; //set flag }[/LEFT] [LEFT]int main(void) { .... LPC_SYSCON->SYSAHBCLKCTRL |= (1<<CT32B1); //power up Timer1/32 LPC_IOCON->R_PIO1_0 &= ~0x07; //clear LPC_IOCON->R_PIO1_0 |= 0x03; //capture 0 & no pullup LPC_TMR32B1->CCR = 0x05; //rising edge & interrupt NVIC_EnableIRQ(TIMER_32_1_IRQn); //enable int LPC_TMR32B1->TCR = 1; //start timer[/LEFT] while(1) //loop { [LEFT] if(timer_32_event) //capture interrupt? { timer_32_event =0; //reset flag LED2_TOG; //scope out }[/LEFT] .... |