int main(void) { SystemCoreClockUpdate();// Read clock settings and update SystemCoreClock variable LPC_SYSCON->PDRUNCFG &= ~(1<<4);//power the ADC LPC_SYSCON->SYSAHBCLKCTRL |= (1<<24); //enable clock for ADC /* Need to do a calibration after initialization and trim */ Chip_ADC_StartCalibration(LPC_ADC); while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {} Chip_SWM_EnableFixedPin(SWM_FIXED_ADC2); LPC_IOCON->PIO0[IOCON_PIO14] |= (1<<1);//set to ADC mode for pin PIO0_14 (ADC_2) LPC_ADC->SEQ_CTRL[ADC_SEQA_IDX] |= 0x4;//Select ADC CH2 (Bit 3) to perform the conversion in the SEQA_CTL register. while(1) { } return 0 ; } |