Page 38 - Making PIC Microcontroller Instruments and Controllers
P. 38
PERIPHEBAL FEATUNES 27
{*${tlSitl: A nearly full-size imase of the versalile LAB-xl experl-
usable reading (meaning the vaiue of the two components must be selected to get a read-
ing in a reasonable time with reasonable accuracy).
If the relative position of the wiper on a variable potentiometer is required, the A to
D conversion capabilities of the LAB-XI can be used to read the potettiometer wiper
position (not lhe resistance). The A-to-D converter always measures the voltage across
the device (hat you connect to the analog input port. You have the choice of reading the
value to a resolution ofeither 8 or 10 bits. IJ you are reading an 8 bit A to-D value, the value
across the resistance is divided into 256 divisions and the reading will always be between
0 and 255 (inclusive). If you are doing a 10-bit A{o-D conversion, the value will be
between 0 and 1023 (inclusive), but since 1 byte can hold only 8 bits, the remaining 2 bits
jn
must be read fiom another register. This is explained more detail in the section on
setting up A to D conversions for the IC in socket U6. Here, lefs tate a quick look at
the POT command (used to read a potentiometer) to see how this works.
fhe POf Command The compiler provides the POT command to make it easy to
read the r€sistive load placed on a pin. ln order to use this command, it is necessary to
set up the connection to the LAB-X I as follows: