I have a project that I am working on where I need to program a Microchip Pickit2 with an inverting op-amp circuit, using a digital potentiometer.
The program is required to take a voltage reading and adjust the gain of the digital pot to maintain the same voltage output.

I am wondering how I would go about taking these voltage readings off of a specific pin on the chip using c programming?

Any help at all would be useful

Thank you,
Devin