uint16 myApp_ReadLightLevel( void )
{
uint16 reading = 0;
/* Enable channel */
ADCCFG |= 0x40;
/* writing to this register starts the extra conversion */
ADCCON3 = 0x86;
/* Wait for the conversion to be done */
while (!(ADCCON1 & 0x80));
/* Disable channel after done conversion */
ADCCFG &= (0x40 ^ 0xFF);
/* Read the result */
reading = ADCH;
reading |= (int16) (ADCH << 8);
reading >>= 8;
return (reading);
}