I don't have a Padauk, but let me try to help anyway.
At 12 bit resolution, ADCRH will contain the four high bits of the result (value 0..15). ADCRL will contain the low 8 bits of the result (value 0..255). So, logically, the 12-bit ADC sample value (0..4095) is ADCRH<<4 + ADCRL.
The way the Padauk example does it,
WORD sample; // 16-bit result variable
AD_START = 1; // Start ADC conversion
while (!AD_DONE) NULL; // Wait for conversion to complete
sample$1 = ADCRH; // High byte of conversion result
sample$0 = ADCRL; // Low byte of conversion result
is that it stores the high byte of the conversion result to the high byte of the sample word; then the low byte. (The $n suffix selects the byte in a multibyte variable.)
Let's say you want to convert this 12-bit value to four individual digits, 0..9. The simplest option is to use a subtraction loop:
byte thousands, hundreds, tens, ones;
word value;
value = sample;
thousands = 0;
hundreds = 0;
tens = 0;
ones = 0;
while (value >= 1000) {
thousands++;
value -= 1000;
}
while (value >= 100) {
hundreds++;
value -= 100;
}
while (value >= 10) {
tens++;
value -= 10;
}
ones = value;
This, however, produces leading zeroes. To take care of those, you use something like this:
if (sample >= 1000) {
// Display 'thousands' digit
} else {
// Clear 'thousands' digit
}
if (sample >= 100) {
// Display 'hundreds' digit
} else {
// Clear 'hundreds' digit
}
if (sample >= 10) {
// Display 'tens' digit
} else {
// Clear 'tens' digit
}
// Display 'ones' digit
or, if you control the display from least significant digit upwards,
// Display 'ones' digit
if (sample >= 10) {
// Display 'tens' digit
if (sample >= 100) {
// Display 'hundreds' digit
if (sample >= 1000) {
// Display 'thousands' digit
} else {
// Clear one digit (thousands)
}
} else {
// Clear two digits (hundreds and thousands)
}
} else {
// Clear three digits (tens, hundreds, and thousands)
}