My question is regarding the Tutorial 5 in Nick Gammon's forum on Arduino.
I don't quite understand the ISR function used for ADC reading. Mainly, line 12 in this code snippet.
ISR (ADC_vect)
{
byte low, high;
// we have to read ADCL first; doing so locks both ADCL
// and ADCH until ADCH is read. reading ADCL second would
// cause the results of each conversion to be discarded,
// as ADCL and ADCH would be locked when it completed.
low = ADCL;
high = ADCH;
adcReading = (high << 8) | low;
adcDone = true;
} // end of ADC_vect
"adcReading = (high << 8) | low;". Correct me if I'm wrong, it is collecting the values of both ADCL and ADCH into one int data type. But why is "high" being shifted left by 8 positions and then getting bit-wise OR'd with "low"? Won't we lose the information of the first and last bit as OR operation would output 1 even if one or the other bit of the corresponding positions (of the two Bytes compared) are 0 or 1.
Can someone please explain the "What is it doing?" and "Why is it doing?" of this process. And if possible then "How?" as well, but not as need-to-know right now.
Hope I am not breaking any rules by posting this here