BTW you're missing one hell of a shower down here
I watched it on TV. You guys made the national news. Are you still dry?
The PCB arrived in the afternoon mail! Yes, the regulator holes need to be enlarged. Will work on getting parts mounted in the coming week. The board looks great! Wish I could still do this kind of work. <sigh>
Why are we multiplying ADRESH by 256?
The two bits stored in bit positions 0 and 1 of the 8-bit register ADRESH must represent the two most significant bits of a 10-bit result stored in a 16-bit unsigned integer variable, AD_IN. You need to get those two bits to transfer over to bit positions 8 and 9 in AD_IN.
There are (at least) two ways to do this: (1) multiply the 8-bit register ADRESH by 256 (weight of bit 8) and store the result in unsigned 16-bit variable AD_IN or (2) copy ADRESH into AD_IN and then left-shit AD_IN by 8, thereby moving bit 1 of ADRESH into bit 9 position of AD_IN and moving bit 0 of ADRESH into bit 8 position of AD_IN. After you have the two bits of ADRESH in the correct bit positions of AD_IN you can either add ADRESL to the AD_IN or logically OR the contents of ADRESL with the contents of AD_IN.
Why does multiplying by 256 result in a left-shift of ADRESH? Well, multiplying by 1 doesn't do anything. Multiplying by 2 is the same as a left-shift of all the bits by one bit position. Multiply by 4, left shift everything two bit positions. Multiple by 8, left shift three bit positions. X16 --> shift left 4 bit positions. X32 --> shift left 5 bit positions. X64 --> shift left 6 bit positions. X128 --> shift left 7 bit positions. X256 --> shift left 8 bit positions. If you haven't extended the 8-bit register to 16 bits, then shifting left by 8 or multiplying by 256 will yield a zero result, assuming zeroes are shifted in from the right and arithmetic overflow during multiplication isn't flagged as a run-time error.
So bit 1 in ADRESH shifts over to bit 9 in AD_IN and bit 0 in ADRESH shifts over to bit 8 in AD_IN. After adding or ORing ADRESL with AD_IN, bits 0 through 9 of AD_IN contain the 10-bit result of the A/D conversion.
I don't remember all the rules associated with mixed byte and word arithmetic in C, but if you just copy ADRESH into AD_IN first, before doing the multiplication or left-shifting, it should work.
Multiplying an 8-bit byte by 256, or left-shifting that byte by 8 bit positions, without extending the byte to a 16-bit result will result in either zero results or a run-time error. Shifting is usually a faster operation than multiplying. So maybe a construct like this will work:
AD_IN = ADRESL + (ADRESH << 8)
or maybe (to make sure ASRESH is treated as a 16-bit variable):
AD_IN = ADRESH
AD_IN = (AD_IN << 8) + ADRESL