PIC32 Family Reference Manual Note: This family reference manual section is meant to serve as a complement to device data sheets. Depending on the device variant, this manual section may not apply to all PIC32 devices. Please consult the note at the beginning of the “10-bit Analog-to-Digital Converter (ADC)”...
PIC32 Family Reference Manual 17.2 CONTROL REGISTERS The ADC module has the following Special Function Registers (SFRs): • AD1CON1: ADC Control Register 1 • AD1CON2: ADC Control Register 2 • AD1CON3: ADC Control Register 3 The AD1CON1, AD1CON2 and AD1CON3 registers control the operation of the ADC module.
PIC32 Family Reference Manual 17.3 ADC OPERATION, TERMINOLOGY AND CONVERSION SEQUENCE This section describes the operation of the ADC, the steps required to configure the converter, special features of the module, and provides examples of ADC configuration with timing diagrams and charts showing the expected output of the converter.
PIC32 Family Reference Manual 17.4 ADC MODULE CONFIGURATION Operation of the ADC module is directed through bit settings in the appropriate registers. The following instructions summarize the actions and the settings. Options and details for each configuration step are provided in subsequent sections.
Page 18
PIC32 Family Reference Manual Table 17-2: Numerical Equivalents of Select Result Codes for FORM<2> (AD1CON1<10>) = 1, 32-bit Result 10-bit 32-bit Signed 32-bit Fractional 32-bit Signed 32-bit Integer Format Output Code Integer Format Format Fractional Format 1023/1024 11 1111 1111 0000 0000 0000 0000...
PIC32 Family Reference Manual 17.4.7 Selecting the Voltage Reference Source The user can select the voltage reference for the ADC module. The reference can be internal or external. The VCFG<2:0> bits (AD1CON2<15:13>) select the voltage reference for analog-to-digital conversions. The upper voltage reference (V...
Page 22
PIC32 Family Reference Manual 17.4.10 Buffer Fill Mode The Buffer Fill mode allows the output buffer to be used as a single 16-word buffer or two 8-word buffers. When the Dual Buffer Mode bit, BUFM (AD1CON2<1>), is ‘0’, the complete 16-word buffer is used for all conversion sequences.
Page 24
PIC32 Family Reference Manual 17.4.12.1 CONFIGURING THE ADC FOR 1000 KSPS OPERATION Calculate the parameters for 1 Msps for a system clock of 60 MHz and Peripheral Clock Divider = 2. The calculation is performed as follows: Calculate the Peripheral Bus clock time period (T ) and the sample plus convert period.
PIC32 Family Reference Manual 17.4.14 Turning ON the ADC When the ON bit (AD1CON1<15>) is ‘1’, the ADC module is in Active mode and is fully powered and functional. When ON is ‘0’, the ADC module is disabled. The digital and analog portions of the circuit are turned off for maximum current savings.
Page 32
PIC32 Family Reference Manual 17.5.9 Automatic Acquisition Figure 17-9 is an example in which setting the ASAM bit (AD1CON1<2>) initiates automatic acquisition, and clearing the SAMP bit (AD1CON1<1>) terminates sampling and starts conversion. After the conversion completes, the module will automatically return to a acquisition state.
Page 34
PIC32 Family Reference Manual 17.5.11 Free Running Sample Conversion Sequence shown Figure 17-11, using Auto-Convert Conversion Trigger mode (SSRC<2:0> = 111) in combination with the Automatic Sampling Start mode (ASAM = 1), allows the ADC module to schedule acquisition/conversion sequences with no intervention by the user or other device resources.
Page 42
PIC32 Family Reference Manual Table 17-6: Converting Three Inputs, Three Samples/Interrupt Using Dual 8-Word Buffers OPERATION SEQUENCE CONTROL BITS Sequence Select Sample MUX A Inputs: AN0 SMPI<2:0> = 0010 Convert AN0, Write Buffer 0x0 Interrupt after every third sample Sample MUX A Inputs: AN1 —...
Page 48
PIC32 Family Reference Manual 17.5.18 Transfer Function The ideal transfer function of the ADC is shown in Figure 17-20. The difference of the input voltages, (V – V ), is compared to the reference, (V + – V • The first code transition occurs when the input voltage is (V + –...
PIC32 Family Reference Manual 17.5.20 ADC Sampling Requirements The analog input model of the 10-bit ADC module is shown in Figure 17-22. The total acquisition time for the analog-to-digital conversion is a function of the internal amplifier settling time and the holding capacitor charge time.
Page 52
PIC32 Family Reference Manual Example 17-7: Converting 1 Channel at 400 ksps, Auto-Sample Start, 2 T Sampling Time Code Example AD1PCFG = 0xFFFB; all PORTB = Digital; RB2 = analog AD1CON1 = 0x00E0; SSRC bit = 111 implies internal counter ends sampling and starts converting.
PIC32 Family Reference Manual 17.8 OPERATION DURING SLEEP AND IDLE MODES Sleep and Idle modes are useful for minimizing conversion noise because the digital activity of the CPU, buses and other peripherals is minimized. 17.8.1 CPU Sleep Mode Without RC ADC Clock When the device enters Sleep mode, all clock sources to the module are shut down and stay at logic ‘0’.
Page 59
Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies.
Need help?
Do you have a question about the PIC32 Family and is the answer not in the manual?
Questions and answers