LPC2378 - ADC module

Started by DeV February 28, 2012
hello all...i have made a function for the adc module in lpc2378 which
takes the channel number as the argument and returns the corresponding adc
output (i.e. a SINGLE CONVERSION)...now in my main program, i need the adc
to keep on running and hence, i use a while (1) loop to keep calling the
adc function to keep adc conversion ON...
1. however, my doubt is switching off the adc module...in the lpc2378
manual, to disable the adc, we need to first clear the PDN bit and then
clear the PCADC bit...i thought of disabling the adc in the function itself
after the conversion..but then is it ok to do this as while (1) loop will
keep on switching adc on and off continuously after every conversion...so
is this ok?? or every time i need to separately switch off the adc??....

2. i was also thinking that is there any option which allows us to keep
a function running continuously in background and the rest of the main
program goes running undisturbed??
Thanks in advance guys..

--

Dev


An Engineer's Guide to the LPC2100 Series

It is impossible to have to have multiple functions running continuously on a single core. They will need to share the core, to make this process simpler you could use an RTOS.

However if your talking about keeping the ADC running alongside you code then you do not need the RTOS, because the you can give the ADC a start and than continue with your normal operation. The ADC can than give an interrupt when ready. Using this you will reduce the time that you wait needlessly.

--
Kevin
--- In l..., DeV wrote:
>
> hello all...i have made a function for the adc module in lpc2378 which
> takes the channel number as the argument and returns the corresponding adc
> output (i.e. a SINGLE CONVERSION)...now in my main program, i need the adc
> to keep on running and hence, i use a while (1) loop to keep calling the
> adc function to keep adc conversion ON...
> 1. however, my doubt is switching off the adc module...in the lpc2378
> manual, to disable the adc, we need to first clear the PDN bit and then
> clear the PCADC bit...i thought of disabling the adc in the function itself
> after the conversion..but then is it ok to do this as while (1) loop will
> keep on switching adc on and off continuously after every conversion...so
> is this ok?? or every time i need to separately switch off the adc??....
>
> 2. i was also thinking that is there any option which allows us to keep
> a function running continuously in background and the rest of the main
> program goes running undisturbed??
> Thanks in advance guys..
>
> --
>
> Dev
>
>