EmbeddedRelated.com
Forums
Memfault Beyond the Launch

ADC slow sampling rate problem

Started by heedaf May 13, 2006
I'm using the following code for the ADC with the LPC2148 and
Rowley's CrossWorks:

//configuration//
ADCR = (1 << 0)| //SEL = 1, dummy channel #1
((15000000/4500000)-1)<<8 | //set clk to 4.5M
(0 << 16) | //BURST = 0, SW controlled
(0 << 17) | //CLKS = 0, 11 clocks = 10-bit
(1 << 21) | //PDN = 1, ADC is active
(1 << 24) | //START = 1, start a conversion now
(0 << 27); //EDGE = 0,

//Start ADC//
ADCR=(ADCR & 0xFFFFFF00)|(1 << 1) & (~(1 << 24)); //Sets to channel 1
ADCR=(ADCR & 0xFFFFFF00)|((1 << 24)); //Starts the conversion
while((ADDR & 0x80000000) == 0) //get result - adjust to 10-bit
integer
;
return (ADDR>>6) & 0x3FF;


The LPC2148 manual lists 2.44 microseconds for a conversion time (at
11 clocks) but I'm getting about 44microseconds instead. I'm only
writing to an array so I can calculate the a full wave in order to
calculate the sample rate. Any ideas what might be causing it to
sample so slow?
Thanks,
Dewayne





An Engineer's Guide to the LPC2100 Series

Rowley's CrossWorks doesn't have the LPC2148 as a target. Are you using the
LPC2138 instead?
If so, the PLL is not set correctly and the LPC2148 doesn't run at 60MHz but
rather at your cristal frequency speed.
You'll have to change the header file to set the PLL registers or wait for
Rowley to supply a header file.

Arie

----- Original Message -----
From: "heedaf"
To:
Sent: Saturday, May 13, 2006 8:37 AM
Subject: [lpc2000] ADC slow sampling rate problem
I'm using the following code for the ADC with the LPC2148 and
Rowley's CrossWorks:

//configuration//
ADCR = (1 << 0)| //SEL = 1, dummy channel #1
((15000000/4500000)-1)<<8 | //set clk to 4.5M
(0 << 16) | //BURST = 0, SW controlled
(0 << 17) | //CLKS = 0, 11 clocks = 10-bit
(1 << 21) | //PDN = 1, ADC is active
(1 << 24) | //START = 1, start a conversion now
(0 << 27); //EDGE = 0,

//Start ADC//
ADCR=(ADCR & 0xFFFFFF00)|(1 << 1) & (~(1 << 24)); //Sets to channel 1
ADCR=(ADCR & 0xFFFFFF00)|((1 << 24)); //Starts the conversion
while((ADDR & 0x80000000) == 0) //get result - adjust to 10-bit
integer
;
return (ADDR>>6) & 0x3FF;
The LPC2148 manual lists 2.44 microseconds for a conversion time (at
11 clocks) but I'm getting about 44microseconds instead. I'm only
writing to an array so I can calculate the a full wave in order to
calculate the sample rate. Any ideas what might be causing it to
sample so slow?
Thanks,
Dewayne

--- In l..., "Arie Finkelstein" wrote:
>
> Rowley's CrossWorks doesn't have the LPC2148 as a target. Are you
using the
> LPC2138 instead?
> If so, the PLL is not set correctly and the LPC2148 doesn't run at
60MHz but
> rather at your cristal frequency speed.
> You'll have to change the header file to set the PLL registers or
wait for
> Rowley to supply a header file.
>
> Arie

Well, Rowleys Crosswrok does have the LPC2148 as a target.You must
send an e-mail to get all needed files for LPC214X.

Regards!!






Memfault Beyond the Launch