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 ?
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.:-(
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