Chip_Clock_SetPCLKDiv(SYSCTL_PCLK_TIMER2, SYSCTL_CLKDIV_1); Chip_TIMER_Init(LPC_TIMER2); Chip_TIMER_Reset(LPC_TIMER2); Chip_TIMER_PrescaleSet(LPC_TIMER2, 0); Chip_TIMER_SetMatch(LPC_TIMER2, 1, 1600); Chip_TIMER_SetMatch(LPC_TIMER2, 2, 9200000);//zu Testzwecken Chip_TIMER_ClearMatch(LPC_TIMER2, 1); Chip_TIMER_ClearMatch(LPC_TIMER2, 2); Chip_TIMER_ResetOnMatchEnable(LPC_TIMER2, 2); Chip_TIMER_MatchEnableInt(LPC_TIMER2, 1); Chip_TIMER_MatchEnableInt(LPC_TIMER2, 2); NVIC_ClearPendingIRQ(TIMER2_IRQn); NVIC_EnableIRQ(TIMER2_IRQn); |
void TIMER2_IRQHandler(void) { if(Chip_TIMER_MatchPending(LPC_TIMER2, 1)) { UpdatePulsDACValue = true; Chip_TIMER_ClearMatch(LPC_TIMER2, 1); } if(Chip_TIMER_MatchPending(LPC_TIMER2, 2)) { UpdatePulsDACValue = false; Chip_TIMER_ClearMatch(LPC_TIMER2, 2); } NVIC_ClearPendingIRQ(TIMER2_IRQn); } |