lpcware

LPC2368 low speed adc

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by kookooli on Sun Jul 13 23:09:19 MST 2014
Hi friends,
I have a problem and i was woundering if someone can help me ...
i want to make samples from a signal via 2368 adc.
Here is my code :

while(j<6000){
buf3[j]=read_adc();
j++;
}

and this is my adc function :
//////////////////////////////////////// READ ADC
unsigned short read_adc(void){
AD0CR&=0xFFFFFF00;
AD0CR|=(1<<24)|(1<<4)|(1<<16);   // START=0x01 // BURST=0x01 //
while((AD0DR4&0x80000000)==0);
AD0CR&=0xF8FFFFFF;
return((AD0DR4>>6)&0x03FF);
}
/////////////////////////////////// End of ADC

my problem is here : according to 2368 datasheet every sampling process should last at least 2.44us that means 400ksps
but when i measure conversion time via one of timers , my adc sampling time is about 5.22us that means 191ksps and i dont know why i cant reach 400ksps speed ?????
my cpu clock is 72MHz
adc clock is 72/4=18
my timer clock is 72/4=18
clkdiv is 3 cuz (18)/(3+1)=4.5 and every sampling process should last 11 clock of 4.5 MHz but but mine last 23 clock of 4.5MHz
Please HELP ME

Outcomes