/*********************************************************************** Function: calc_Vout Parameters: none returns: none overview: Calculates a voltage level based off of the ADC result ************************************************************************/ void calc_Vout(void) { //Using a 5Vdd and the ADC in 12-bit mode, gives us a 3.3/4096 = around 806uV/step Vout = ReadADC1(0)*0.0008056640625; }
int main(void) { GPIOInit(); ADCInit(); while(1) { value = ReadADC1(1) * 0.0822 * 2.54; } }