Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] Problem in low speed sampling adc in LPC2368

Status
Not open for further replies.

kookooli

Junior Member level 3
Joined
Jul 10, 2014
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
235
Hi friends...
I have a problem , i was woundering if someone can help me ...

i want to make samples from a signal every 3.5us approximately.
this is my code :
Code:
unsigned short read_adc(void){
AD0CR&=0xFFFFFF00;
AD0CR|=(1<<24)|(1<<4)|(1<<16);
while((AD0DR4&0x80000000)==0);
AD0CR&=0xF8FFFFFF;
return((AD0DR4>>6)&0x03FF);
}

i turn on a timer just before sampling and turn the timer off after sampling is finished.
my problem is here that every sampling process would be approximately 6us
but we know that base on LPC2368 datasheet every sampling process time should be about 2.5us but i dont know why i cant reach that speed ?
 
Last edited by a moderator:

Hello there,

Here I can not help you 100% regarding this concern.. But it may due to the delay occurring inside your CPU. If you come to ADC, Propagation delay, acquisition delay, holding time and sampling time delay, those can vary your total time of adc task. Also it dependents on your system clock and hardware.

I am sorry because i don't know the actual reason.:-(


Best regards,
PAUL
 

thanks for your answer
but you know ... this is my sampling code:


Code C - [expand]
1
2
3
4
5
6
7
8
9
T0TCR=0x02;                              // INITIALIZE TIMER
T0TCR=1;                                 // START TIMER
 
while(T0TC<450000){                      // Sampling
buf3[j]=read_adc();                     // Sampling
j++;                                    // Sampling
}                                       // Sampling
 
T0TCR=0;                                // STOP TIMER



even i dont transform the 10 bit value to decimal while sampling and i do this after sampling is finished
and as you can see there is no delay in my code .
i even tuned my micro with 90MHz cpu clock(overclock) it become faster , but not too much...
i'm really confused
 
Last edited by a moderator:

Hi again,

ADC 10-bit conversion time ≥ 2.44 µs so the minimum value is 2.44 µs and might vary also.I suggest you to refer adc static characters.

I did not get your code fully:
Code:
while(T0TC<450000){                      // Sampling
buf3[j]=read_adc();                     // Sampling
j++;                                    // Sampling
}

Please excuse me, I never work with LPC2368 MCU..

https://www.edaboard.com/threads/210484/

Kindly check below link and verify your ADC configuration.

All the best.
Paul
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top