Positron Compiler Documentation

ADin Declares.

Source: Positron8 Compiler User Manual, PDF page 423

Declare ADin_Res = 8, 10, or 12. Sets the number of bits in the result.

If this Declare is not used, then the default is the resolution of the microcontroller used. Using the above Declare allows an 8-bit result to be obtained from 10-bit or 12-bit microcontrollers, but not 10-bits or 12-bits from the 8-bit types.

Declare ADin_Tad = 2_FOSC, 8_FOSC, 32_FOSC, 64_FOSC or FRC. Sets the ADC's clock source.

All compatible PICmicros have four options for the clock source used by the ADC; 2_FOSC, 8_FOSC, and 32_FOSC, are ratios of the external oscillator, while FRC is the PICmicro's internal RC oscillator. Instead of using the predefined names for the clock source, values from 0 to 3 may be used. These reflect the settings of bits 0-1 in register ADCON0.

Care must be used when issuing this Declare, as the wrong type of clock source may result in poor resolution, or no conversion at all. If in doubt use FRC which will produce a slight reduction in resolution and conversion speed, but is guaranteed to work first time, every time. FRC is the default setting if the Declare is not issued in the BASIC listing.

Declare ADin_Stime = 0 to 65535 microseconds (us). Allows the internal capacitors to fully charge before a sample is taken. This may be a value from 0 to 65535 microseconds (us).

A value too small may result in a reduction of resolution. While too large a value will result in poor conversion speeds without any extra resolution being attained.

A typical value for ADin_Stime is 50 to 100. This allows adequate charge time without loosing too much conversion speed.

But experimentation will produce the right value for your particular requirement. The default value if the Declare is not used in the BASIC listing is 50.