Part 1: Introduction to PIC16(L)F18855/75 ADC2 Modulec
The PIC16(L)F18855/75 microcontroller features an advanced Analog-to-Digital Converter with Computation (ADC2) module. This module not only converts analog input signals into 10-bit digital representations but also includes additional features for enhanced functionality. This reading material will introduce the key components and configuration options of the ADC2 module.
1. Overview of the ADC2 Module
The ADC2 module is designed to convert analog input signals into 10-bit digital values. It includes a sample and hold circuit, a successive approximation converter, and result registers to store the conversion results.
Key Components:
- Sample and Hold Circuit: Captures and holds the analog input voltage stable during conversion.
- Successive Approximation Converter: Performs the analog-to-digital conversion and generates a 10-bit binary result.
- Result Registers (ADRESH:ADRESL): Store the conversion results for further processing.
2. Advanced Features
The ADC2 module includes several advanced features to enhance its functionality:
2.1 8-bit Acquisition Timer
- Allows precise control of the sampling time.
- Ensures accurate conversion of high-impedance sources.
2.2 Capacitive Voltage Divider (CVD) Support
- 8-bit Precharge Timer: Controls the precharge duration.
- Adjustable Sample and Hold Capacitor Array: Enhances the accuracy of capacitive measurements.
- Guard Ring Digital Output Drive: Reduces noise and interference.
2.3 Automatic Repeat and Sequencing
- Automated Double Sample Conversion for CVD: Facilitates capacitive measurements.
- Two Sets of Result Registers: Stores current and previous results for comparison.
- Auto-Conversion Trigger: Initiates conversions automatically based on predefined conditions.
- Internal Retrigger: Allows continuous sampling without software intervention.
2.4 Computation Features
- Averaging and Low-Pass Filter Functions: Smooths out noise and fluctuations in the input signal.
- Reference Comparison: Compares the conversion result with a reference value.
- 2-Level Threshold Comparison: Triggers actions based on predefined threshold levels.
- Selectable Interrupts: Generates interrupts based on conversion completion or threshold comparison.
3. Voltage Reference Options
The ADC voltage reference is software-selectable and can be either internally generated or externally supplied. The positive and negative voltage references are controlled by the ADREF register.
Positive Voltage Reference Options:
- VREF+ Pin: External voltage reference.
- VDD: Supply voltage.
- FVR 1.024V, 2.048V, 4.096V: Fixed Voltage Reference levels.
Negative Voltage Reference Options:
- VREF- Pin: External voltage reference.
- VSS: Ground.
4. Interrupt Capabilities
The ADC2 module can generate interrupts upon:
- Completion of a conversion.
- Threshold comparison results.
These interrupts can wake the device from Sleep mode, enabling power-efficient operation in battery-powered applications.
5. Configuration Considerations
When configuring and using the ADC2 module, several factors must be considered:
5.1 Port Configuration
- Configure the I/O pin for analog input by setting the appropriate TRIS and ANSEL bits.
5.2 Channel Selection
- Select the desired analog input channel using the ADPCH register.
- Available channels include PORTA, PORTB, PORTC, PORTD (PIC16(L)F18875 only), PORTE (PIC16(L)F18875 only), Temperature Indicator, DAC output, and Fixed Voltage Reference.
5.3 Conversion Clock Source
- Select the conversion clock source via the ADCLK register and the ADCS bit of the ADCON0 register.
- Options include FOSC/(2*(n+1)) and FRC (dedicated RC oscillator).
5.4 Result Formatting
- The 10-bit conversion result can be left or right justified, controlled by the ADFRM0 bit of the ADCON0 register.
6. Starting and Completing a Conversion
6.1 Starting a Conversion
- Enable the ADC module by setting the ADON bit of the ADCON0 register.
- Start a conversion by setting the ADGO bit of the ADCON0 register, using an external trigger, or enabling continuous-mode retrigger.
6.2 Completing a Conversion
- Upon completion, the ADC module:
- Clears the ADGO bit.
- Sets the ADIF interrupt flag bit.
- Updates the ADRESH:ADRESL result registers.
Summary
The ADC2 module in the PIC16(L)F18855/75 microcontroller provides advanced features for precise and efficient analog-to-digital conversion. Understanding its key components, configuration options, and advanced features is important for effectively utilizing its capabilities in analog signal processing and embedded system design.In the next part, we will delve into the detailed configuration and operation procedures of the ADC2 module, including practical examples and best practices for achieving accurate and reliable conversions.