You don't mention how the variable resistors are connected. If one end goes to 12V and the other end goes to GND, then as the wiper is rotated, the output will be 0-12V. You can divide that down and convert the voltage with the A/D in the PIC.
You can use a pushbutton on one of the other pins.
Set the variable resistor to the 1/4 position and push the button. Take an A/D reading and store the value in an EEPROM location. Advance a counter and set the variable resistor to the 1/2 position. Push the button again to take an A/D reading and write to the EEPROM location set by the counter. Advance the counter. Set the variable resistor to the 3/4 position. Push the button. Save the value.
As a last step, write a known value to an EEPROM location to indicate that the part has been calibrated. On power up read that location. If it has already been calibrated, skip the calibration step and run normally.
Bookmarks