An oA2D Object uses the PIC's A2D Converter Module (PICA2DCM) by first setting the channel select so that it is selecting the I/O Line specified by the IOLine property. Once selected the PICA2DCM's charge holding capacitor is allowed to fully charge to the input voltage and the conversion is initiated. The oA2D Object then waits until the PICA2DCM indicates that the conversion is done at which time the oA2D Object will copy the values from the result registers and place them into Result and ResultL. The Result property holds the upper 8-Bits of the conversion and the ResultL property holds the lower 2-Bits. Together these properties can yield an 8-Bit or 10-Bit analog conversion. Each dimensioned instance of an oA2D Object shares the PICA2DCM and therefore must take turns doing conversions. To do this, each dimensioned instance of the oA2D Object with an Operate property set to 1 will in turn request an analog-to-digital conversion be done on its specified I/O Line. The analog-to-digital conversion process takes approximately 14µs and when the conversion is completed the results will be copied to that Object's properties. The next oA2D Object instance will follow the same until all active oA2D Object instances have been addressed. After the last Analog to Digital Object instance has been addressed the process begins again with the first instance. With 7 oA2D Object instances dimensioned (one for each analog IOLine) and all 7 Operate properties set to 1 the entire conversion process takes 98µs. The IOLine property specifies the channel that the PICA2DCM will use. The PICA2DCM has eight possible analog inputs, but one is dedicated to the ooPIC Operating system. Therefore, the IOLine property can specify one of 7 channels while the value of 0 will set the oA2D Object instance into a dormant state. Firmware versions A1 to B1 can only access the first four A2D channels (I/O Lines 1-4). See the IOLine property for more detail. An Operate property is provided to activate the oA2D Object. When set to 1 the oA2D Object continuously performs an analog-to-digital conversion which maintains the Result values at current conversion levels. When the Operate property is cleared to 0 the oA2D Object enters a dormant state thus leaving the Result values at the value of the last conversion. The ExtVRef and ExtVRef2 properties determines the analog reference voltages. The positive reference voltage is selectable between +5 volts or the voltage level supplied on I/O line 4 and the negative reference voltage is selectable between 0 volts and the voltage level supplied on I/O line 3. Depending on the IOLine used, its actual usage can vary. Refer to Microchip PIC16F877 PCFG3:PCFG0: A/D Port Configuration Control register for more detail. Caution: the maximum voltage allowed on any I/O Line is 5 Volts DC. Voltages above 5 Volts can damage the input circuitry. |