Hi,
I'm testing ADC portion of LPC11U24. The example code has AD0 working, and I want to trigger additional AD1 working. I modify the code
int main(void)
{
uint16_t dataADC;
uint16_t dataADC1;
int j;
SystemCoreClockUpdate();
Board_Init();
Init_ADC_PinMux();
DEBUGSTR("ADC Demo\r\n");
/* Setup GPIOs */
//Chip_GPIO_SetPinDIR(LPC_GPIO, 0, 11, FALSE);
/* ADC Init */
Chip_ADC_Init(LPC_ADC, &ADCSetup);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);
Chip_ADC_EnableChannel(LPC_ADC, ADC_CH1, ENABLE);
while (1) {
/* Start A/D conversion */
Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
/* Waiting for A/D conversion complete */
while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH0, ADC_DR_DONE_STAT) != SET) {}
/* Read ADC value */
Chip_ADC_ReadValue(LPC_ADC, ADC_CH0, &dataADC);
/* Print ADC value */
DEBUGOUT("ADC value is 0x%x\r\n", dataADC);
while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) != SET) {}
Chip_ADC_ReadValue(LPC_ADC, ADC_CH1, &dataADC1);
//DEBUGOUT("ADC value is 0x%x\r\n", dataADC1);
/* Delay */
j = 500000;
while (j--) {}
}
/* Should not run to here */
return 0;
}
#endif /* !defined(CHIP_LPC1125) */
When I run the program into debug mode, the program stop at
"while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH1, ADC_DR_DONE_STAT) != SET) {}"
Do you know which step I'm wrong?
Frank