Content originally posted in LPCWare by sreynoso on Wed Nov 10 15:53:40 MST 2010
[SIZE=2]Hello, I´m trying to configure the A/D converter to start conversion when the edge occurs on MAT0.1 or by [SIZE=1][SIZE=1][SIZE=2]EINT0 pin and have this example from NXP´s CMSIS driver library:[/SIZE][/SIZE][/SIZE][/SIZE]
[SIZE=2][SIZE=1][SIZE=1][SIZE=2][/SIZE][/SIZE][/SIZE][/SIZE]
[SIZE=2][SIZE=1][SIZE=1][SIZE=2][LEFT]ADC_EdgeStartConfig(LPC_ADC,[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ADC_START_ON_FALLING[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/LEFT]
[/SIZE][SIZE=2][LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][/COLOR][/SIZE][/B]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](1) // [COLOR=seagreen]Main loop[/COLOR]
{
adc_value = 0;
ADC_StartCmd(LPC_ADC, [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ADC_START_ON_EINT0[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Start conversion on EINT0 falling edge[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT] NVIC_EnableIRQ(ADC_IRQn); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* Enable ADC in NVIC */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT] }
ADC_DeInit(LPC_ADC);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (0);[/LEFT]
My question is why is necesary to refreshing the start bits [I][COLOR=#0000c0]ADC_START_ON_EINT0[/COLOR][/I] continuosly in the main loop ? I tried to put the converter start bits before the "while(1)" loop but the A/D converter does not work.
Any idea ?
Best regards
[/SIZE][/SIZE][/SIZE][/SIZE]