int pr = SystemCoreClock / (4 * 1000000) - 1;
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_6, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); //MAT0
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_7, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); //MAT1
//Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_11, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); //MAT3
Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_1, (IOCON_FUNC2 | IOCON_MODE_PULLUP)); //MAT2
// Initialize timers.
Chip_TIMER_Init(LPC_TIMER32_0);
// Configure Prescale
Chip_TIMER_PrescaleSet(LPC_TIMER32_0, pr); //PR = 11
Chip_TIMER_ResetOnMatchEnable(LPC_TIMER32_0, 3); //MCR = Reset on MR3
Chip_TIMER_SetMatch(LPC_TIMER32_0, 3, 255); //MR3 = Period 255uS
Chip_TIMER_SetMatch(LPC_TIMER32_0, 0, 1); //MR0 = Duty cycles set on 1
Chip_TIMER_SetMatch(LPC_TIMER32_0, 1, 1); //MR1 = Duty cycles set on 1
Chip_TIMER_SetMatch(LPC_TIMER32_0, 2, 1); //MR3 = Duty cycles set on 1
Chip_TIMER_CountWrite(LPC_TIMER32_0, (1<<0)|(1<<1)|(1<<2)); //PWMC - enable PWM signal on MAT0, MAT1, MAT2
Chip_TIMER_Enable(LPC_TIMER32_0); //TCR - and run...
|