UNDERSTANDING THE MICROCHIP TECHNOLOGY PIC 16F877A:USING THE A TO D CAPABILITIES OF THE PIC 16F877A

USING THE A TO D CAPABILITIES OF THE PIC 16F877A

A to D conversions will be discussed in more detail in Chapter 5. There are a number of basic measurements that you can make with the LAB-X1 board by using its analog-to-digital and other capabilities. These form the basis for the inputs that you can use to control the motors. The resolution of the A/D conversion can be 8 or 10 bits. Still higher resolutions are available if you use ICs that go in empty socket U6. The measurements that we make can be used to determine the following:

N Resistance N Capacitance N Voltage

N Frequency (not an A to D function, of course)

Resistance is measured by measuring how long it takes a resistor to discharge a capacitor that has just been charged. The measurement is as accurate as the value of the capacitor. The measurement parameters may need to be adjusted in real time to get a usable reading (meaning that the value of the two components has to be selected to get a reading 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-X1 can be used to read the potentiometer wiper position (not the resistance). The A to D converter always measures the voltage across the device that you connect to the analog input port. You have the choice of reading the value to a resolution of either 8 or 10 bits. If 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. If you are doing a 10-bit A to D conversion, the value will be between 0 and 1023, but since one byte can hold only 8 bits, the remaining 2 bits have to be read from another register. This is explained in greater detail in Chapter 5 in the section on setting up A to D conversions for the IC in socket U6.

Leave a comment

Your email address will not be published. Required fields are marked *