Content originally posted in LPCWare by williamjsell on Mon Dec 30 16:52:14 MST 2013
I am trying to get some signs of life out of the ADC. I have this init seqeunce, but I just get either 0x0000FFF or 0. Am i missing something here? If I run this code init on my embedded artists board (albeit one channel only), the ADC works fine. On my custom board there is no sign of life. Any ideas?
void Init_LPC_ADC(void)
{
//init the ADC to the 400K samples per second
ADC_Init(LPC_ADC, 400000);
//set the function up for the pin
PINSEL_ConfigPin (0, 12, 3); //ADC0 channel 6
PINSEL_ConfigPin (0, 13, 3); //ADC0 channel 7
PINSEL_ConfigPin (0, 23, 1); //ADC0 channel 0
PINSEL_ConfigPin (0, 24, 1); //ADC0 channel 1
PINSEL_ConfigPin (0, 26, 1); //ADC0 channel 3
PINSEL_ConfigPin (1, 31, 3); //ADC0 channel 5
//disable the digital pin mode on the chip
PINSEL_SetAnalogPinMode (0, 12, ENABLE);
PINSEL_SetAnalogPinMode (0, 13, ENABLE);
PINSEL_SetAnalogPinMode (0, 23, ENABLE);
PINSEL_SetAnalogPinMode (0, 24, ENABLE);
PINSEL_SetAnalogPinMode (0, 26, ENABLE);
PINSEL_SetAnalogPinMode (1, 31, ENABLE);
//disable the interrupts on the channel
ADC_IntConfig(LPC_ADC, MHI, DISABLE);
ADC_IntConfig(LPC_ADC, MLO, DISABLE);
ADC_IntConfig(LPC_ADC, RTD, DISABLE);
ADC_IntConfig(LPC_ADC, BDTEMP, DISABLE);
ADC_IntConfig(LPC_ADC, PWR1, DISABLE);
ADC_IntConfig(LPC_ADC, PWR2, DISABLE);
//set the channel to enable
ADC_ChannelCmd(LPC_ADC, MHI, ENABLE);
ADC_ChannelCmd(LPC_ADC, MLO, ENABLE);
ADC_ChannelCmd(LPC_ADC, RTD, ENABLE);
ADC_ChannelCmd(LPC_ADC, BDTEMP, ENABLE);
ADC_ChannelCmd(LPC_ADC, PWR1, ENABLE);
ADC_ChannelCmd(LPC_ADC, PWR2, ENABLE);
//set to burst mode
ADC_BurstCmd(LPC_ADC, SET);
}