Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

ADC Problem

ADC Problem

2005-03-07 by tiogate

Could anyone please post a little working C code for the ADC on 
LPC2124 (or equivalent)? I'm having a hard time reading the data 
register, or interpreting it: the 10 bits where the result of the 
conversion was supposed to be are all ones, all the time, no matter 
what tension is applied to the pin.


Thank you.


Fernando

Re: [lpc2000] ADC Problem

2005-03-07 by Luciano Almeida

tiogate wrote:

>Could anyone please post a little working C code for the ADC on 
>LPC2124 (or equivalent)? I'm having a hard time reading the data 
>register, or interpreting it: the 10 bits where the result of the 
>conversion was supposed to be are all ones, all the time, no matter 
>what tension is applied to the pin.
>
>
>Thank you.
>
>
>Fernando
>
>
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>
Boas.
Aparentemente h\ufffd um problema em algumas vers\ufffdes do silicio em que quando 
existe uma tens\ufffdo > 3.3 V aplicada a um pino de ADC, todos os valores do 
ADC ficam inv\ufffdlidos.
N\ufffdo sei se ser\ufffd isso...

-- 
Luciano Almeida                         Number Seven       
lalmeida@...			Edificio OneWorld
Phone: +351 261860453			Urb. Belo Horizonte
Fax:   +351 261860476			2655-241 Ericeira
http://www.nseven.com			Portugal

Re: [lpc2000] ADC Problem

2005-03-07 by Luciano Almeida

tiogate wrote:

>Could anyone please post a little working C code for the ADC on 
>LPC2124 (or equivalent)? I'm having a hard time reading the data 
>register, or interpreting it: the 10 bits where the result of the 
>conversion was supposed to be are all ones, all the time, no matter 
>what tension is applied to the pin.
>
>
>Thank you.
>
>
>Fernando
>
>
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>
Ups, sorry, no intention in sending a message in portuguese to the 
mailing list.
Just mentioning that if there is a voltage above the working voltage in 
one of the ADC pins there is no assurance that the values read are valid.

-- 
Luciano Almeida                         Number Seven       
lalmeida@...			Edificio OneWorld
Phone: +351 261860453			Urb. Belo Horizonte
Fax:   +351 261860476			2655-241 Ericeira
http://www.nseven.com			Portugal

ADC Problem

2006-05-11 by heedaf

I've got the following code to start the ADC.  If I put in a 
breakpoint somewhere after the code and run to the breakpoint it will 
enter an endless loop.  If I step manually past the while statement 
and than run to the breakpoint it will work fine.  If I put in a delay 
before the while statement it also works but this seriously slows down 
the ADC.  I guess this has something to do with initialization but I'm 
not sure.  Does anyone have any ideas?
Thanks,
Dewayne

	ADCR = (ADCR & 0xFFFFFF00) | (1 << 1) | (1 << 24);

        //wait til done
     
	while((ADDR & 0x80000000) == 0)
	  ;

	//get result
	return (ADDR>>6) & 0x3FF;

Re: [lpc2000] ADC Problem

2006-05-11 by 3gpabko

Hi,
you are trying to configure channel and start ADC at
the same time. I don't know which LPC2xxx you are
using but you should check the corresponding errata
for details.
Assuming that you have declared ADCR volatile I advise
you to use this code:

ADCR = (ADCR & 0xFFFFFF00) | (1 << 1) & (~(1 << 24));
ADCR = (ADCR & 0xFFFFFF00) | (1 << 24);

In order to avoid the bug and to be sure that you will
not start the ADC twice.

Regards
Zdravko Dimitrov

--- heedaf <ruffellfamily@...> wrote:

> I've got the following code to start the ADC.  If I
> put in a 
> breakpoint somewhere after the code and run to the
> breakpoint it will 
> enter an endless loop.  If I step manually past the
> while statement 
> and than run to the breakpoint it will work fine. 
> If I put in a delay 
> before the while statement it also works but this
> seriously slows down 
> the ADC.  I guess this has something to do with
> initialization but I'm 
> not sure.  Does anyone have any ideas?
> Thanks,
> Dewayne
> 
> 	ADCR = (ADCR & 0xFFFFFF00) | (1 << 1) | (1 << 24);
> 
>         //wait til done
>      
> 	while((ADDR & 0x80000000) == 0)
> 	  ;
> 
> 	//get result
> 	return (ADDR>>6) & 0x3FF;
> 
> 
> 
> 


\u0417\u043d\u0430\u043d\u0438\u0435\u0442\u043e \u0435 \u043b\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0436\u0438\u0432\u044f\u043d\u0430 \u0438\u0441\u0442\u0438\u043d\u0430.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.