Analog Digital Conversion

In order to determine the status of the lights as accurately as possible, analog to digital conversion was used. ADCON1 was configured to make the 10 bit binary conversion value right aligned, using only RA0 as an analog input. Vref+ was Vdd, 5V and Vref- was Vss, 0V, so that was the range of the conversion. The value calculated by the ADC was equal to the following value: \[\mathrm{ADC~value} = \frac{\mathrm{incoming~voltage} \times 1024}{5}\]