Change the world

The following example programs are available to demonstrate the basic principles of using the A/D converter on a PIC18F4620:

ex1_analog_leds.c

Example that measures an analog voltage on PORTA RA0 (AN0) and displays the result on 8 LEDs. 

 

ex2_analog_lcd.c

Example that measures an analog voltage on PORTA RA0 (AN0) and displays the result on the LCD as a 10-bit value (0-1023).

 

ex3_analog_multiple.c

The same as ex2_analog_lcd.c, but reads multiple analog inputs from RA0(AN0), RA1(AN1), RA2(AN2), RA3(AN3) 

 

ex4_analog_smooth.c

The same as ex2_analog_lcd.c, but reads 20 samples, calculates the result and displays this "smoothed" out value.  In the previous example the analog value would jump around a bit due to noise.

 

ex5_analog_as_voltage.c

Example that measures an analog voltage on PORTA RA0 (AN0) and displays the result on the LCD as a voltage value (float 0.00 - 5.00).