Now I am more interested regarding the formulas used for measuring voltage across different ranges using an ADC in a program. I am not more focused on hardware. I am being confused by reference voltage and maximum voltagehi M,
Your original question was.
I want to measure the voltage of a 5V supply with a PIC18F45K22 ADC and a 10K PO