Pic Lab, PIC18, Experiment #3, ADC

I was working on a small project where I needed to catch a certain button pressed event. Sounds simple initially, but I have 10 such buttons and it means that I need to have 10 IOs, or port expander, or make a digital matrix button handler (like 3×4 keypad) but these all variants are boring, I wanted something more interesting and make something like a DAC based on these buttons which will be digitazed by the built-in ADC in pic18f14k50. Thus, we will use a single port instead of 10, by cost of the more complicated code.

Let me start as usual – from reading of the datasheet.

Continue reading