Section 44. High-Speed 10-Bit ADC HIGHLIGHTS This section of the manual contains the following major topics: 44.1 Introduction..................................................................................................................44-2 44.2 Control Registers.........................................................................................................44-5 44.3 ADC Configuration.....................................................................................................44-31 44.4 ADC Conversion........................................................................................................44-35 44.5 Sample and Conversion Sequence for Single SAR ADC..........................................44-40 44.6 Sample and Conversion Sequence for Dual SAR ADC.............................................44-49 44.7 ADC Interrupt.............................................................................................................44-51 44.8 Common ADC Interrupt.............................................................................................44-52 44.9 Operation During Sleep and Idle Modes....................................................................44-54 44.10ADC Sampling Requirements....................................................................................44-55 44.11 Transfer Function for 10-Bit ADC...............................................................................44-56 44.12Register Map..............................................................................................................44-57 44.13Related Application Notes..........................................................................................44-59 44.14Revision History.........................................................................................................44-60 44 1H 0i g - Bh it-S Ap De e C d © 2008-2013 Microchip Technology Inc. DS70000321G-page 44-1 dsPIC33F/PIC24H 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 dsPIC33F/PIC24H devices. Please consult the note at the beginning of the “High-Speed 10-Bit ADC” chapter in the current device data sheet to check whether this document supports the device you are using. Device data sheets and family reference manual sections are available for download from the Microchip Worldwide Web site at: http://www.microchip.com 44.1 INTRODUCTION This section describes the features and associated operational modes of the High-Speed 10-Bit Analog-to-Digital Converter (ADC) available on the dsPIC33F/PIC24H family of devices. The High-Speed 10-Bit ADC module has the following key features: • 10-bit resolution • 4 Msps conversion rate at 3.3V (devices with two Successive Approximation Registers (SARs)) • 2 Msps conversion rate at 3.3V (devices with one SAR) • Independent Start of Conversion (SOC) trigger selection for each analog input pair • Up to six dedicated Sample-and-Hold (S&H) circuits with asynchronous sampling option • Two shared S&H circuits on devices with two SARs • One shared S&H circuit on devices with one SAR • Dedicated result register for each analog input • Unipolar inputs Power conversion applications often require voltage and current measurements for each control loop. Therefore, the 26 analog inputs of the High-Speed 10-Bit ADC module are grouped in 13pairs. A pair is a combination of even and odd numbered analog inputs, such as AN0 and AN1, AN2 and AN3, and so on. The ADC always converts a single pair of analog inputs at a time. Whether the conversion happens in parallel or sequential manner depends on the number of SAR converters available on the device. Note: The available analog inputs and SAR converters may vary depending on the device variant. Refer to the specific device data sheet for details. Each analog input pair (for example, Pair 0 (AN0, AN1), Pair 1 (AN2, AN3)) receives a separate conversion request. The conversion request can be selected from a variety of sources (seeFigure44-7). If multiple analog input pairs receive a conversion request at the same time, the conversion requests are prioritized. Analog input Pair 0 has the highest priority, and analog input Pair 12 has the lowest priority. Figure44-1 illustrates a block diagram of the High-Speed 10-Bit ADC with a dual SAR converter. In the High-Speed 10-Bit ADC module, the even and odd numbered analog inputs are converted in parallel, thereby providing 4 Msps throughput using two 2 Msps SAR converters. The even numbered analog inputs are converted by one SAR, and the odd numbered analog inputs are converted by another SAR. The dual SAR device has a separate shared S&H circuit for even and odd numbered analog inputs to keep the analog input constant for the respective SAR during conversion. The separate shared S&H circuit for even and odd numbered analog inputs also provides the option to sample both the inputs (the even and odd input) in a pair simultaneously, thus preserving the relative phase information between the signals on both analog inputs. Figure44-2 illustrates a block diagram of the High-Speed 10-Bit ADC with a single SAR converter. In the High-Speed 10-Bit ADC module, the even and odd numbered analog inputs are converted sequentially. Unlike a dual SAR device, it has a single shared S&H circuit for even and odd numbered analog inputs. Therefore, the analog input pairs that use the shared S&H circuit for both inputs are sampled sequentially. Each of the first four analog input pairs in both the single and dual SAR device has a dedicated S&H circuit for even numbered analog inputs (AN0, AN2, AN4 and AN6). The dedicated S&H circuit allows the respective analog input to be sampled on a conversion request without any latency (zero latency). DS70000321G-page 44-2 © 2008-2013 Microchip Technology Inc. Section 44. High-Speed 10-Bit ADC Figure 44-1: High-Speed 10-Bit ADC with Two SAR Converters(2) Dedicated S&H AN0 SH0 AN2 SH1 AN4 SAR ADCBUF0 (Even) SH2 AN6 SH3 AN8 Shared (Even) S&H AN10 AN12(1) AN24(1) Even Inputs 44 AN1 AN3 AN5 Shared (Odd) S&H 1H 0i g AN7 SAR -Bh ADCBUF25 AN9 (Odd) it -S Ap AN11 De e C AN13(1) d AN25(1) Odd Inputs Note 1: Depending on the device variant, these inputs may be connected to EXTREF or the internal voltage reference. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for more information. 2: The available analog inputs and the dedicated S&H circuit may vary depending on the device variant. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for more information. © 2008-2013 Microchip Technology Inc. DS70000321G-page 44-3 dsPIC33F/PIC24H Family Reference Manual Figure 44-2: High-Speed 10-Bit ADC with One SAR Converter(2) Dedicated S&H AN0 ADCBUF0 SH0 AN2 SH1 AN4 SAR SH2 AN6 SH3 AN8 AN10 AN12(1) ADCBUF25 AN14 Shared S&H AN24(1) AN1 AN3 AN13(1) AN25(1) Note 1: Depending on the device variant, these inputs may be connected to EXTREF or the internal voltage reference. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for more information. 2: The available analog inputs and the dedicated S&H circuit may vary depending on the device variant. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for more information. DS70000321G-page 44-4 © 2008-2013 Microchip Technology Inc. Section 44. High-Speed 10-Bit ADC 44.2 CONTROL REGISTERS This section outlines the specific functions of each register that controls the operation of the High-Speed 10-Bit ADC module. Note: Not all control registers are available on all devices. Refer to the specific device data sheet for more information. • ADCON: ADC Control Register This register configures the sample conversion sequence, enables the ADC module, and is used to set up the clock divider for the ADC clock. • ADSTAT: ADC Status Register This register contains the Pair Data Ready (PxRDY) flag to indicate the analog input pair that caused the common ADC interrupt. The Pair Data Ready flag is cleared in the specific pair handler. • ADBASE: ADC Base Register(1,2) This register contains a unique offset value based on the analog input pair that caused the common ADC interrupt. It is read in the common ADC interrupt to branch to the specific analog pair handler. • ADPCFG: ADC Port Configuration Register This register configures the analog input pins as analog inputs or digital I/O. • ADPCFG2: ADC Port Configuration Register2 This register configures the analog input pins as analog inputs or digital I/O. • ADCPC0: ADC Convert Pair Control Register 0 This register selects the trigger source, enables the common ADC interrupt, and allows software trigger generation for Analog Input Pair 0 and Pair 1. • ADCPC1: ADC Convert Pair Control Register 1 This register selects the trigger source, enables the common ADC interrupt, and allows software trigger generation for Analog Input Pair 2 and Pair 3. • ADCPC2: ADC Convert Pair Control Register 2 This register selects the trigger source, enables the common ADC interrupt, and allows software trigger generation for Analog Input Pair 4 and Pair 5. • ADCPC3: ADC Convert Pair Control Register 3 44 This register selects the trigger source, enables the common ADC interrupt, and allows software trigger generation for Analog Input Pair 6 and Pair 7. • ADCPC4: ADC Convert Pair Control Register 4 1H 0i This register selects the trigger source, enables the common ADC interrupt, and allows -g Bh software trigger generation for Analog Input Pair 8 and Pair 9. it-S • ADCPC5: ADC Convert Pair Control Register 5 Ap De This register selects the trigger source, enables the common ADC interrupt, and allows Ce d software trigger generation for Analog Input Pair 10 and Pair 11. • ADCPC6: ADC Convert Pair Control Register 6 This register selects the trigger source, enables the common ADC interrupt, and allows software trigger generation for Analog Input Pair 12. © 2008-2013 Microchip Technology Inc. DS70000321G-page 44-5 dsPIC33F/PIC24H Family Reference Manual Register 44-1: ADCON: ADC Control Register R/W-0 U-0 R/W-0 R/W-0 U-0 R/W, HC-0 U-0 R/W-0 ADON — ADSIDL SLOWCLK(1) — GSWTRG — FORM(1) bit 15 bit 8 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0 R/W-1 R/W-1 EIE(1) ORDER(1,2) SEQSAMP(1,2) ASYNCSAMP(1) — ADCS<2:0>(1) bit 7 bit 0 Legend: HC = Cleared by Hardware R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15 ADON: ADC Operating Mode bit 1 = ADC module is operating 0 = ADC module is off bit 14 Unimplemented: Read as ‘0’ bit 13 ADSIDL: ADC Stop in Idle Mode bit 1 = Discontinues module operation when device enters Idle mode 0 = Continues module operation in Idle mode bit 12 SLOWCLK: Enable Slow Clock Divider bit(1) 1 = ADC is clocked by the auxiliary PLL (ACLK) 0 = ADC is clock by the primary PLL (FVCO) bit 11 Unimplemented: Read as ‘0’ bit 10 GSWTRG: Global Software Trigger bit When this bit is set, it triggers conversions if selected by the TRGSRC<4:0> bits in the ADCPCx registers. This bit is automatically cleared in hardware. bit 9 Unimplemented: Read as ‘0’ bit 8 FORM: Data Output Format bit(1) 1 = Fractional (DOUT = dddd dddd dd00 0000) 0 = Integer (DOUT = 0000 00dd dddd dddd) bit 7 EIE: Early Interrupt Enable bit(1) 1 = Interrupt is generated after first conversion is completed 0 = Interrupt is generated after second conversion is completed bit 6 ORDER: Conversion Order bit(1,2) 1 = Odd numbered analog input is converted first, followed by conversion of even numbered input 0 = Even numbered analog input is converted first, followed by conversion of odd numbered input bit 5 SEQSAMP: Sequential Sample Enable bit(1,2) 1 = Shared S&H circuit is sampled at the start of the second conversion if ORDER = 0. If ORDER = 1, the shared S&H circuit is sampled at the start of the first conversion 0 = Shared S&H circuit and dedicated S&H circuit are sampled simultaneously, if the shared S&H circuit is not currently busy with an existing conversion process. If the shared S&H circuit is busy at the time the dedicated S&H circuit is sampled, the shared S&H circuit will sample at the start of the new conversion cycle. bit 4 ASYNCSAMP: Asynchronous Dedicated S&H Sampling Enable bit(1) 1 = The dedicated S&H circuit is constantly sampling and terminates the sampling as soon as the trigger pulse is detected 0 = The dedicated S&H circuit starts sampling when the trigger event is detected and completes the sampling process in two ADC clock cycles Note 1: This control bit can only be changed while the ADC module is disabled (ADON = 0). 2: This control bit is active on devices that have one SAR. DS70000321G-page 44-6 © 2008-2013 Microchip Technology Inc. Section 44. High-Speed 10-Bit ADC Register 44-1: ADCON: ADC Control Register (Continued) bit 3 Unimplemented: Read as ‘0’ bit 2-0 ADCS<2:0>: ADC Conversion Clock Divider Select bits(1) 111 = FADC/8 110 = FADC/7 101 = FADC/6 100 = FADC/5 011 = FADC/4 (default) 010 = FADC/3 001 = FADC/2 000 = FADC/1 Note 1: This control bit can only be changed while the ADC module is disabled (ADON = 0). 2: This control bit is active on devices that have one SAR. 44 1H 0i g - Bh it-S Ap De e C d © 2008-2013 Microchip Technology Inc. DS70000321G-page 44-7 dsPIC33F/PIC24H Family Reference Manual Register 44-2: ADS T A T: ADC Status Register U-0 U-0 U-0 R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS — — — P12RDY P11RDY P10RDY P9RDY P8RDY bit 15 bit 8 R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS R/C-0, HS P7RDY P6RDY P5RDY P4RDY P3RDY P2RDY P1RDY P0RDY bit 7 bit 0 Legend: C = Clearable bit HS = Hardware Settable bit R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-13 Unimplemented: Read as ‘0’ bit 12 P12RDY: Conversion Data for Pair 12 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 11 P11RDY: Conversion Data for Pair 11 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 10 P10RDY: Conversion Data for Pair 10 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 9 P9RDY: Conversion Data for Pair 9 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 8 P8RDY: Conversion Data for Pair 8 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 7 P7RDY: Conversion Data for Pair 7 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 6 P6RDY: Conversion Data for Pair 6 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 5 P5RDY: Conversion Data for Pair 5 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 4 P4RDY: Conversion Data for Pair 4 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 3 P3RDY: Conversion Data for Pair 3 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 2 P2RDY: Conversion Data for Pair 2 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 1 P1RDY: Conversion Data for Pair 1 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. bit 0 P0RDY: Conversion Data for Pair 0 Ready bit Bit is set when data is ready in buffer, cleared when a ‘0’ is written to this bit. Note: Not all PxRDY bits are available on all devices. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for information on available analog inputs. DS70000321G-page 44-8 © 2008-2013 Microchip Technology Inc. Section 44. High-Speed 10-Bit ADC Register 44-3: ADB ASE: ADC Base Register(1,2) R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 ADBASE<14:7> bit 15 bit 8 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 ADBASE<6:0> — bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-1 ADBASE<14:0>: ADC Base Register bits This register contains the base address of the user’s ADC Interrupt Service Routine jump table. This register, when read, contains the sum of the ADBASE register contents and the encoded value of the PxRDY Status bits. The encoder logic provides the bit number of the highest priority PxRDY bits where P0RDY is the highest priority and P12RDY is the lowest priority. bit 0 Unimplemented: Read as ‘0’ Note 1: The encoding results are shifted left two bits. Therefore, bits<1:0> of the result are always zero. 2: As an alternative to using the ADBASE register, the ADCP0-12 ADC pair conversion complete interrupts can be used to invoke ADC conversion completion routines for individual ADC input pairs. Register 44-4: ADPCFG: ADC Port Configuration Register R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 PCFG15 PCFG14 PCFG13 PCFG12 PCFG11 PCFG10 PCFG9 PCFG8 bit 15 bit 8 44 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 PCFG7 PCFG6 PCFG5 PCFG4 PCFG3 PCFG2 PCFG1 PCFG0 bit 7 bit 0 1H 0i g - Bh Legend: it-S Ap R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ De e -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown Cd bit 15-0 PCFG<15:0>: ADC Port Configuration Control bits 1 = Port pin in Digital mode, port read input enabled, ADC input multiplexer connected to AVSS 0 = Port pin in Analog mode, port read input disabled, ADC samples pin voltage Note: Not all bits are available on all devices. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for information on available analog inputs. © 2008-2013 Microchip Technology Inc. DS70000321G-page 44-9 dsPIC33F/PIC24H Family Reference Manual Register 44-5: ADPCFG2: ADC Port Configuration Register2 U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0 — — — — — — — — bit 15 bit 8 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 PCFG23 PCFG22 PCFG21 PCFG20 PCFG19 PCFG18 PCFG17 PCFG16 bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown bit 15-8 Unimplemented: Read as ‘0’ bit 7-0 PCFG<23:16>: ADC Port Configuration Control bits 1 = Port pin in Digital mode, port read input enabled, ADC input multiplexer connected to AVSS 0 = Port pin in Analog mode, port read input disabled, ADC samples pin voltage Note: Not all bits are available on all devices. Refer to the “High-Speed 10-Bit Analog-to-Digital Converter (ADC)” chapter in the specific device data sheet for information on available analog inputs. DS70000321G-page 44-10 © 2008-2013 Microchip Technology Inc.
Description: