Using A/D converter

The  PIC16F887  A/D  converter  is  used  in  this  example.  Is  it  necessary  to  mention  that everything is rather simple?! A variable analog signal is applied to the AN2 pin, while the 10- bit result of conversion  is shown on ports B and D (8 LSBs on port D and 2 MSBs on port B). GND is used as negative voltage reference Vref-, while positive voltage reference is applied to the AN3 pin. It enables voltage measurement scale to 'stretch and shrink'.

In other words, the A/D converter always generates a 10-bit binary result, which means that it detects  a total  of 1024  voltage  levels  (210=1024).  The difference  between  two voltage levels is not always the same. The less the difference between Vref+ and Vref-, the less the difference  between  two of 1024 levels. As seen, the A/D converter  is able to detect slight changes in voltage.


In order to make this example  work properly,  it is necessary  to tick off the ADC library in the Library Manager prior to compiling:



0 komentar: