I done this code for ADC its doing the conversion well ., Now I want to sample the ADC values , This is my code . In this code where I want to sample . In which place I want do sample. How to sample the coversion of ADC.
AD1CR&=0X00000000;// clear AD1CR AD1CR|=0X00000003;// select AD1.0....ad1.1as Ain AD1CR|=0X00010000;// select BURST mode (11clk/10bit) AD1CR|=0X00200000;// PDN in operational mode AD1CR|=0X00000400;// CLKDIV=4,to set adclk<4mhz
void adc0() { adcdata=AD1DR0; // move the RESULT0(Vin/Vref) to adcdata while((AD1DR0&0X80000000)==0);//check for the done bit
adcdata=((adcdata>>6)&0x03FF);
stepsize=3.22; // stepsize = Vref/resolution //(3.3/1024=0.00322 (or)3.22x10^-3) (for 10 bit adc) dout=((adcdata*1000000)/stepsize); // dout=((adcdata)*0.00322); c=c+1; if(c==15) { calculate0(dout); c=0; } }
Are you in the same class as this guy: http://www.keil.com/forum/63436 ?
Please read & follow the instructions for posting source code; they are not hard, and are clearly stated immediately above where you type your message.
See this picture: www.danlhenry.com/.../keil_code.png