Hi,
I have connected a 10K multi turn pot to FRDM-KL25Z platform, I'm using keil and tried this code to read the Pot voltage, But my readings are not stable enough, they will jump around 10% of the value, How can I achieve the 14.5 ENOB from the ADC?
Here is my main code
int analog_in; char txt_buff[20]; SystemCoreClockUpdate(); /* Get Core Clock Frequency */ uart0_init(); ADC_Init(); Calibrate_ADC(); while(1) { analog_in=0; for(int i=0;i<16;i++) { analog_in+=adc_read(0); } analog_in=analog_in/16; sprintf(txt_buff,"analog = %d\r\n",analog_in); uart0_puts(txt_buff); }
The code for ADC driver is attached,
Original Attachment has been moved to: ADC.h.txt.zip
Original Attachment has been moved to: ADC.c.txt.zip