Microchip Technology dsPIC33F Family Reference Manual

Microchip Technology dsPIC33F Family Reference Manual

Analog-to-digital converter
Hide thumbs Also See for dsPIC33F Family:

Advertisement

Quick Links

16
Section 16. Analog-to-Digital Converter (ADC)
HIGHLIGHTS
This section of the manual contains the following major topics:
16.1 Introduction .................................................................................................................. 16-2
16.2 Control Registers ......................................................................................................... 16-4
16.3 A/D Terminology and Conversion Sequence ............................................................. 16-14
16.4 ADC Module Configuration ........................................................................................ 16-16
16.5 Selecting the Voltage Reference Source ................................................................... 16-16
16.6 Selecting the A/D Conversion Clock .......................................................................... 16-17
16.7 Selecting Analog Inputs for Sampling ........................................................................ 16-18
16.8 Enabling the Module .................................................................................................. 16-20
16.9 Specifying Sample/Conversion Control ..................................................................... 16-20
16.10 How to Start Sampling ............................................................................................... 16-21
16.11 How to Stop Sampling and Start Conversions ........................................................... 16-22
16.12 Controlling Sample/Conversion Operation................................................................. 16-32
16.13 Specifying Conversion Results Buffering ................................................................... 16-33
16.14 Conversion Sequence Examples............................................................................... 16-37
16.15 A/D Sampling Requirements...................................................................................... 16-49
16.16 Reading the ADC Result Buffer ................................................................................. 16-50
16.17 Transfer Function (10-bit Mode)................................................................................. 16-52
16.18 Transfer Function (12-bit Mode)................................................................................. 16-53
16.19 ADC Accuracy/Error................................................................................................... 16-54
16.20 Connection Considerations........................................................................................ 16-54
16.21 Code Examples.......................................................................................................... 16-54
16.22 Operation During Sleep and Idle Modes.................................................................... 16-61
16.23 Effects of a Reset....................................................................................................... 16-62
16.24 Special Function Registers Associated with the ADC................................................ 16-62
16.25 Design Tips ................................................................................................................ 16-64
16.26 Related Application Notes.......................................................................................... 16-65
16.27 Revision History ......................................................................................................... 16-66
© 2006 Microchip Technology Inc.
DS70183A-page 16-1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the dsPIC33F Family and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Microchip Technology dsPIC33F Family

  • Page 1: Table Of Contents

    16.22 Operation During Sleep and Idle Modes..............16-61 16.23 Effects of a Reset....................... 16-62 16.24 Special Function Registers Associated with the ADC..........16-62 16.25 Design Tips ........................ 16-64 16.26 Related Application Notes..................16-65 16.27 Revision History ......................16-66 © 2006 Microchip Technology Inc. DS70183A-page 16-1...
  • Page 2: Introduction

    Family Reference Manual 16.1 INTRODUCTION The dsPIC33F family devices have up to 32 A/D input channels. These devices also have up to two ADC modules (ADCx, where x = 1 or 2), each with its own set of Special Function Registers (SFRs).
  • Page 3 2: Channels 1, 2 and 3 are not applicable for the 12-bit mode of operation. 3: The ADC1 module can use all 32 analog input pins (AN0-AN31), whereas ADC2 can use only 16 analog input pins (AN0-AN15). © 2006 Microchip Technology Inc. DS70183A-page 16-3...
  • Page 4: Control Registers

    Family Reference Manual 16.2 CONTROL REGISTERS The ADC module has ten Control and Status registers. These registers are: • ADxCON1: ADCx Control Register 1(1) • ADxCON2: ADCx Control Register 2(1) • ADxCON3: ADCx Control Register 3(1) • ADxCON4: ADCx Control Register 4(1) •...
  • Page 5 001 = Active transition on INTx pin ends sampling and starts conversion 000 = Clearing sample bit ends sampling and starts conversion bit 4 Unimplemented: Read as ‘0’ Note 1: The ‘x’ in ADxCON1 and ADCx refers to ADC 1 or ADC 2. © 2006 Microchip Technology Inc. DS70183A-page 16-5...
  • Page 6 Family Reference Manual Register 16-1: ADxCON1: ADCx Control Register 1 (Continued) bit 3 SIMSAM: Simultaneous Sample Select bit (only applicable when CHPS<1:0> = 01 or 1x) When AD12B = 1, SIMSAM is: U-0, Unimplemented, Read as ‘0’ 1 = Samples CH0, CH1, CH2, CH3 simultaneously (when CHPS<1:0> = 1x); or Samples CH0 and CH1 simultaneously (when CHPS<1:0>...
  • Page 7 1 = Uses channel input selects for Sample A on first sample and Sample B on next sample 0 = Always uses channel input selects for Sample A Note 1: The ‘x’ in ADxCON2 and ADCx refers to ADC 1 or ADC 2. © 2006 Microchip Technology Inc. DS70183A-page 16-7...
  • Page 8 Family Reference Manual Register 16-3: ADxCON3: ADCx Control Register 3 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 ADRC — — SAMC<4: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 ADCS<7:0> bit 7 bit 0 Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’...
  • Page 9 001 =Allocates 2 words of buffer to each analog input 000 =Allocates 1 word of buffer to each analog input Note 1: The ‘x’ in ADxCON4 and ADCx refers to ADC 1 or ADC 2. © 2006 Microchip Technology Inc. DS70183A-page 16-9...
  • Page 10 Family Reference Manual Register 16-5: ADxCHS123: ADCx Input Channel 1, 2, 3 Select Register R/W-0 R/W-0 R/W-0 — — — — — CH123NB<1:0> CH123SB bit 15 bit 8 R/W-0 R/W-0 R/W-0 — — — — — CH123NA<1:0> CH123SA bit 7...
  • Page 11 00000 = Channel 0 positive input is AN0 Note 1: The AN16 – AN31 pins are not available for ADC 2. 2: The ‘x’ in ADxCHS0 and ADCx refers to ADC 1 or ADC 2 © 2006 Microchip Technology Inc. DS70183A-page 16-11...
  • Page 12 Family Reference Manual Register 16-7: AD1CSSH: ADC1 Input Scan Select Register High R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 CSS31 CSS30 CSS29 CSS28 CSS27 CSS26 CSS25 CSS24 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...
  • Page 13 2: On devices with two analog-to-digital modules, both AD1PCFGL and AD2PCFGL affect the configuration of port pins multiplexed with AN0-AN15. 3: The ‘x’ in ADxPCFGL and ADx refers to ADC 1 or ADC 2 © 2006 Microchip Technology Inc. DS70183A-page 16-13...
  • Page 14: A/D Terminology And Conversion Sequence

    Family Reference Manual 16.3 A/D TERMINOLOGY AND CONVERSION SEQUENCE Figure 16-2 shows a basic conversion sequence and the terms that are used. A sampling of the analog input pin voltage is performed by Sample/Hold amplifiers (also called Sample/Hold chan- nels).
  • Page 15 In this case, the SMPI<3:0> bits are used to select how often the DMA RAM buffer pointer is incremented. The frequency of incrementing the DMA RAM buffer pointer should not exceed the DMA RAM buffer length. © 2006 Microchip Technology Inc. DS70183A-page 16-15...
  • Page 16: Adc Module Configuration

    Family Reference Manual 16.4 ADC MODULE CONFIGURATION The following steps should be followed for performing an A/D conversion: Select 10-bit or 12-bit mode (ADxCON1<10>) Select voltage reference source to match expected range on analog inputs (ADxCON2<15:13>) Select the analog conversion clock to match desired data rate with processor clock (ADxCON3<7:0>)
  • Page 17: Selecting The A/D Conversion Clock

    Clock Source (ADRC) bit (ADxCON3<15>). When the ADRC bit is set, the ADCS<7:0> bits have no effect on the A/D operation. Figure 16-4: A/D Conversion Clock Period Block Diagram ADxCON3<15> ADC Internal RC Clock ADxCON3<7:0> A/D Conversion Clock Multiplier 1, 2, 3, 4, 5,..., 256 © 2006 Microchip Technology Inc. DS70183A-page 16-17...
  • Page 18: Selecting Analog Inputs For Sampling

    Family Reference Manual 16.7 SELECTING ANALOG INPUTS FOR SAMPLING All Sample/Hold Amplifiers have analog multiplexers (see Figure 16-1) on both their non-invert- ing and inverting inputs to select which analog input(s) are sampled. Once the sample/convert sequence is specified, the ADxCHS0 and ADxCHS123 registers determine which analog inputs are selected for each sample.
  • Page 19 1, 2 and 3. Programming CH123NA = 10 selects AN6, AN7 and AN8 as the analog source to the negative inputs of channels 1, 2 and 3 respectively. Programming CH123NA = 11 selects AN9, AN10 and AN11 as the analog source. © 2006 Microchip Technology Inc. DS70183A-page 16-19...
  • Page 20: Enabling The Module

    Family Reference Manual 16.7.3.1 SELECTING MULTIPLE CHANNELS FOR A SINGLE ANALOG INPUT The analog input multiplexer can be configured so that the same input pin is connected to two or more Sample/Hold channels. The ADC converts the value held on one Sample/Hold channel, while the second Sample/Hold channel acquires a new input sample.
  • Page 21: How To Start Sampling

    If the SIMSAM bit specifies simultaneous sampling, sampling on a channel resumes after the conversion of all channels completes. For an example, see Figure 16-6. © 2006 Microchip Technology Inc. DS70183A-page 16-21...
  • Page 22: How To Stop Sampling And Start Conversions

    Family Reference Manual 16.11 HOW TO STOP SAMPLING AND START CONVERSIONS The conversion trigger source terminates sampling and starts a selected sequence of conversions. The Sample Clock Source Select (SSRC<2:0>) bits (ADxCON1<7:5>) select the source of the conversion trigger.
  • Page 23 SAMP bit includes the conversion time as well as the sampling time. See Example 16-2 for code example. Figure 16-6: Converting 1 Channel, Automatic Sample Start, Manual Conversion Start ADC Clock CONV SAMP CONV SAMP SAMP DONE ADC1BUF0 BSET AD1CON1,ASAM BCLR AD1CON1,SAMP BCLR AD1CON1,SAMP Instruction Execution © 2006 Microchip Technology Inc. DS70183A-page 16-23...
  • Page 24 Family Reference Manual Example 16-2: Converting 1 Channel, Automatic Sample Start, Manual Conversion Start Code AD1PCFGL = 0xFF7F; // all PORTB = Digital but RB7 = analog AD1CON1 = 0x0004; // ASAM bit = 1 implies sampling .. // starts immediately after last // conversion is done AD1CHS0= 0x0007;...
  • Page 25 This A/D configuration must be enabled for the conversion rate of 750 ksps. Figure 16-8: Converting One Channel, Auto-Sample Start, T Based Conversion Start ADC Clock SAMP SAMP CONV CONV = 16 T = 16 T SAMP DONE Buffer[0] Buffer[1] Instruction Execution BSET AD1CON1,ASAM © 2006 Microchip Technology Inc. DS70183A-page 16-25...
  • Page 26 Family Reference Manual 16.11.2.2 MULTIPLE CHANNELS WITH SIMULTANEOUS SAMPLING As shown in Figure 16-9 when using simultaneous sampling, the SAMC value specifies the sam- pling time. In the example, SAMC specifies a sample time of 3 T . Because automatic sample start is active, sampling starts on all channels after the last conversion ends and continues for three A/D clocks.
  • Page 27 A/D conversion results are acquired and the time when the duty cycle value is updated. Refer to Section 14. “Motor Control PWM” for more details. Check for the most recent documentation on the Microchip website at www.microchip.com. © 2006 Microchip Technology Inc. DS70183A-page 16-27...
  • Page 28 Family Reference Manual 16.11.3.4 SYNCHRONIZING A/D OPERATIONS TO INTERNAL OR EXTERNAL EVENTS Modes where an external event trigger pulse ends sampling and starts conversion (SSRC<2:0> = 001, 10, 011) can be used in combination with auto-sampling (ASAM = 1) to cause the ADC module to synchronize the sample conversion events to the trigger pulse source.
  • Page 29 Figure 16-13: Converting Four Channels, Auto-Sample Start, Trigger Conversion Start, Simultaneous Sampling Conversion Trigger ADCLK CONV CONV CONV CONV SAMP SAMP ch0_samp ch1_samp ch2_samp ch3_samp Buffer[0] Buffer[1] Buffer[2] Buffer[3] Cleared in software DONE SAMP © 2006 Microchip Technology Inc. DS70183A-page 16-29...
  • Page 30 Family Reference Manual 16.11.3.6 MULTIPLE CHANNELS WITH SEQUENTIAL SAMPLING As shown in Figure 16-14 when sequential sampling is used, sampling for a particular channel stops just prior to converting that channel and resumes after the conversion has stopped. Figure 16-14: Converting Four Channels, Auto-Sample Start, Trigger Conversion Start, Sequential Sampling...
  • Page 31 Equation 16-6: Available Sampling Time, Sequential Sampling = Trigger Pulse Interval (T ) - Conversion Time (T CONV CONV Note: is the trigger pulse interval time © 2006 Microchip Technology Inc. DS70183A-page 16-31...
  • Page 32: Controlling Sample/Conversion Operation

    Family Reference Manual 16.12 CONTROLLING SAMPLE/CONVERSION OPERATION The application software can poll the SAMP (AD1CON1<1>) and DONE (AD1CON1<0>) bits to keep track of A/D operations or the ADC module can interrupt the CPU when conversions are complete. The application software can also abort A/D operations, if necessary.
  • Page 33: Specifying Conversion Results Buffering

    CH0, the first location in the AN5 block, the first two locations in the AN6 block and the first three locations in the AN7 block are unused, resulting in a relatively inefficient arrange- ment of data in the DMA buffer. © 2006 Microchip Technology Inc. DS70183A-page 16-33...
  • Page 34 Family Reference Manual When scanning is used, and no simultaneous sampling is performed (SIMSAM = 0), SMPI<3:0> should be set to one less than the number of inputs being scanned. For example, if CHPS<1:0> = 00 (only one Sample/Hold channel is used), and AD1CSSL = 0xFFFF, indicating that AN0-AN15 are being scanned, then set SMPI<3:0>...
  • Page 35 Unused Buffer Locations — — AN7 – SAMPLE 4 AN7 BLOCK — — Unused Buffer Locations — AN7 – SAMPLE 8 — — — — — — — — AN31 BLOCK — — — — © 2006 Microchip Technology Inc. DS70183A-page 16-35...
  • Page 36 Family Reference Manual 16.13.2 USING DMA IN THE CONVERSION ORDER MODE When the AADMABM bit (ADCON1<12>) = 1, the Conversion Order mode is enabled. In this mode, the DMA channel can be configured for Register Indirect or Peripheral Indirect Address- ing.
  • Page 37: Conversion Sequence Examples

    Figure 16-17: Converting One Channel 16 Times/Interrupt Conversion Trigger SAMP SAMP SAMP SAMP ADC Clock CONV CONV CONV CONV Input to CH0 ASAM SAMP DONE Buffer[0] Buffer[1] Buffer[2] Buffer[15] AD1IF Instruction Execution BSET AD1CON1,ASAM © 2006 Microchip Technology Inc. DS70183A-page 16-37...
  • Page 38 Family Reference Manual Table 16-2: Converting One Channel 16 Times per DMA Interrupt CONTROL BITS OPERATION SEQUENCE Sequence Select Sample MUX A Inputs: AN0 -> CH0, convert CH0, SMPI<3:0> = 0000, AMODE = 00, DMAxCNT = 15 write ADC1BUF0 and generate DMA Request DMA Interrupt on 16th conversion Sample MUX A Inputs: AN0 ->...
  • Page 39 Figure 16-18: Scanning Through 16 Inputs/Interrupt Conversion Trigger SAMP SAMP SAMP SAMP ADC Clock CONV CONV CONV CONV Input to CH0 AN14 AN15 ASAM SAMP DONE Buffer[0] Buffer[1] Buffer[2] Buffer[15] AD1IF Instruction Execution BSET AD1CON1,#ASAM © 2006 Microchip Technology Inc. DS70183A-page 16-39...
  • Page 40 Family Reference Manual Table 16-3: Scanning Through 16 Inputs per DMA Interrupt CONTROL BITS OPERATION SEQUENCE Sequence Select Sample MUX A Inputs: AN0 -> CH0, convert CH0, SMPI<3:0> = 1111, AMODE = 00, DMAxCNT = 15 write ADC1BUF0,and generate DMA Request DMA Interrupt on 16th conversion Sample MUX A Inputs: AN1 ->...
  • Page 41 CONV CONV CONV CONV CONV CONV CONV CONV CONV Input to CH0 Input to CH1 Input to CH2 Input to CH3 ASAM SAMP DONE Buffer[0] Buffer[1] Buffer[2] Buffer[3] Buffer[12] Buffer[13] Buffer[14] Buffer[15] AD1IF © 2006 Microchip Technology Inc. DS70183A-page 16-41...
  • Page 42 Family Reference Manual Table 16-4: Converting Three Inputs, Four Times and Four Inputs, One Time per DMA Interrupt CONTROL BITS OPERATION SEQUENCE Sequence Select Sample MUX A Inputs: SMPI<3:0> = 0011, AMODE = 00, DMAxCNT = 15 AN4 -> CH0, AN0 -> CH1, AN1 -> CH2, AN2 -> CH3...
  • Page 43 CONV CONV CONV Input to AN15 AN15 AN15 Input to AN3-AN9 AN3-AN9 AN3-AN9 ASAM SAMP Cleared in software DONE BUFS Buffer[0] Buffer[1] Buffer[2] Buffer[3] Buffer[4] Buffer[5] Buffer[6] Buffer[7] Buffer[8] ADxIF Cleared by Software © 2006 Microchip Technology Inc. DS70183A-page 16-43...
  • Page 44 Family Reference Manual Table 16-5: Converting Two Sets of Two Inputs Using Alternating Input Selections CONTROL BITS OPERATION SEQUENCE Sequence Select Sample MUX A Inputs: AN1 -> CH0, AN0 -> CH1 SMPI<3:0> = 0001, AMODE = 00, DMAxCNT = 7 Convert CH0, write ADC1BUF0, and generate DMA Request Alt.
  • Page 45 AN14 AN14 AN13-AN1 Input to CH0 Input to CH1 AN3-AN6 AN3-AN6 AN4-AN7 AN4-AN7 Input to CH2 Input to CH3 AN5-AN8 AN5-AN8 ASAM SAMP DONE Buffer[0] Buffer[1] Buffer[2] Buffer[3] Buffer[12] Buffer[13] Buffer[14] Buffer[15] AD1IF © 2006 Microchip Technology Inc. DS70183A-page 16-45...
  • Page 46 Family Reference Manual Table 16-6: Sampling Eight Inputs Using Simultaneous Sampling CONTROL BITS OPERATION SEQUENCE Sequence Select Sample MUX A Inputs: SMPI<3:0> = 0001, AMODE = 00, DMAxCNT = 15 (AN13-AN1) -> CH0, AN0 -> CH1, AN1 -> CH2, AN2 -> CH3 Alt.
  • Page 47 AN13-AN1 AN14 AN13-AN1 Input to CH0 AN3-AN6 AN3-AN6 Input to CH1 Input to CH2 AN4-AN7 AN4-AN7 AN5-AN8 Input to CH3 AN5-AN8 ASAM SAMP DONE Buffer[0] Buffer[1] Buffer[2] Buffer[3] Buffer[12] Buffer[13] Buffer[14] Buffer[15] AD1IF © 2006 Microchip Technology Inc. DS70183A-page 16-47...
  • Page 48 Family Reference Manual Table 16-7: Sampling Eight Inputs Using Sequential Sampling CONTROL BITS OPERATION SEQUENCE Sequence Select Sample: (AN13-AN1) -> CH0, convert CH0, SMPI<3:0> = 0001, AMODE = 00, DMAxCNT = 15 write ADC1BUF0, and generate DMA Request Alt. sampling, DMA interrupt on 16th sample Sample: AN0 ->...
  • Page 49: A/D Sampling Requirements

    = interconnect resistance = sampling switch resistance = Sample/Hold capacitance (from DAC) HOLD negligible if Rs ≤ 5 kΩ. Note: C value depends on device package and is not tested. Effect of C © 2006 Microchip Technology Inc. DS70183A-page 16-49...
  • Page 50: Reading The Adc Result Buffer

    Family Reference Manual 16.16 READING THE ADC RESULT BUFFER The RAM is 10-bits or 12-bits wide, but the data is automatically formatted to one of four select- able formats when the buffer is read. The FORM<1:0> bits (ADCON1<9:8>) select the format.
  • Page 51 0000 = -2047 = 0.0002 = -0.9995 0/4096 0000 0000 0000 0000 0000 1111 1000 0000 0000 0000 0000 1000 0000 0000 0000 0000 0000 0000 0000 = -2048 = 0.000 = -1.000 © 2006 Microchip Technology Inc. DS70183A-page 16-51...
  • Page 52: Transfer Function (10-Bit Mode)

    Family Reference Manual 16.17 TRANSFER FUNCTION (10-BIT MODE) The ideal transfer function of the ADC module is shown in Figure 16-27. The difference of the input voltages, (V – V ), is compared to the reference, (V – V...
  • Page 53: Transfer Function (12-Bit Mode)

    0111 1111 1110 (= 2046) 0111 1111 1101 (= 2045) 0000 0000 0001 (= 1) 0000 0000 0000 (= 0) REFL REFH 2048*(V – V REFH REFL – V REFH REFL REFL REFL 4096 4096 – V © 2006 Microchip Technology Inc. DS70183A-page 16-53...
  • Page 54: Adc Accuracy/Error

    Family Reference Manual 16.19 ADC ACCURACY/ERROR Refer to Section 16.26 “Related Application Notes” for a list of documents that discuss ADC accuracy. 16.20 CONNECTION CONSIDERATIONS Since the analog inputs employ ESD protection, they have diodes to V and V .
  • Page 55 MPLAB® C30 v2.01.00 or higher * SOFTWARE LICENSE AGREEMENT: * Microchip Technology Inc. (“Microchip”) licenses this software to you solely for use with * Microchip dsPIC® digital signal controller products. The software is owned by Microchip * and is protected under applicable copyright laws.
  • Page 56 Family Reference Manual Example 16-4: Code for Channel Scanning Using DMA (Continued) //AD1CHS123: A/D Input Select Register AD1CHS123bits.CH123SA = 0; // MUXA +ve input selection (AIN0) for CH1 AD1CHS123bits.CH123NA = 0; // MUXA -ve input selection (Vref-) for CH1 //AD1CSSH/AD1CSSL: A/D Input Scan Selection Register AD1CSSH = 0x0000;...
  • Page 57 == 0) ProcessADCSamples(BufferA.Adc1Ch0); ProcessADCSamples(BufferA.Adc1Ch1); ProcessADCSamples(BufferA.Adc1Ch2); ProcessADCSamples(BufferA.Adc1Ch3); else ProcessADCSamples(BufferB.Adc1Ch0); ProcessADCSamples(BufferB.Adc1Ch1); ProcessADCSamples(BufferB.Adc1Ch2); ProcessADCSamples(BufferB.Adc1Ch3); DmaBuffer ^= 1; IFS0bits.DMA0IF = 0; //Clear the DMA0 Interrupt Flag void ProcessADCSamples(unsigned int * AdcBuffer) /* Do something with ADC Samples */ © 2006 Microchip Technology Inc. DS70183A-page 16-57...
  • Page 58 MPLAB® C30 v2.01.00 or higher * SOFTWARE LICENSE AGREEMENT: * Microchip Technology Inc. (“Microchip”) licenses this software to you solely for use with * Microchip dsPIC® digital signal controller products. The software is owned by Microchip * and is protected under applicable copyright laws.
  • Page 59 // ADC stores results stored alternatively between DMA_BASE[0]/DMA_BASE[16] on every 16th DMA request void initDma0(void) DMA0CONbits.AMODE = 2; // Configure DMA for Peripheral indirect mode DMA0CONbits.MODE = 2; // Configure DMA for Continuous Ping-Pong mode DMA0PAD=(int)&ADC1BUF0; DMA0CNT = (SAMP_BUFF_SIZE*2)-1; © 2006 Microchip Technology Inc. DS70183A-page 16-59...
  • Page 60 Family Reference Manual Example 16-5: Code for Alternate Sampling Using DMA (Continued) DMA0REQ=13; DMA0STA = __builtin_dmaoffset(&BufferA[0][0]); DMA0STB = __builtin_dmaoffset(&BufferB[0][0]); IFS0bits.DMA0IF = 0; //Clear the DMA interrupt flag bit IEC0bits.DMA0IE = 1; //Set the DMA interrupt enable bit DMA0CONbits.CHEN=1; /*======================================================================================= _DMA0Interrupt(): ISR name is chosen from the device linker script.
  • Page 61: Operation During Sleep And Idle Modes

    If ADSIDL = 1, the ADC module stops in Idle. If the device enters Idle mode in the middle of a conversion, the conversion is aborted. The converter does not resume a partially completed conversion on exiting from Idle mode. © 2006 Microchip Technology Inc. DS70183A-page 16-61...
  • Page 62: Effects Of A Reset

    Family Reference Manual 16.23 EFFECTS OF A RESET A device Reset forces all registers to their Reset state. This forces the ADC module to be turned off and any conversion in progress to be aborted. All pins that are multiplexed with analog inputs are configured as analog inputs.
  • Page 63 Table 16-10: ADC Register Map File Name Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset States INTCON1 0080...
  • Page 64: Design Tips

    Family Reference Manual 16.25 DESIGN TIPS Question 1: How can I optimize the system performance of the ADC module? Answer: Make sure you are meeting all of the timing specifications. If you are turning the ADC mod- ule off and on, there is a minimum delay you must wait before taking a sample. If you are changing input channels, there is a minimum delay you must wait for this as well.
  • Page 65: Related Application Notes

    An Introduction to AC Induction Motor Control Using the dsPIC30F MCU AN984 Note: Please visit the Microchip web site (www.microchip.com) for additional Application Notes and code examples for the dsPIC33F family of devices. © 2006 Microchip Technology Inc. DS70183A-page 16-65...
  • Page 66: Revision History

    Family Reference Manual 16.27 REVISION HISTORY Revision A (December 2006) This is the initial release of this document. DS70183A-page 16-66 © 2006 Microchip Technology Inc.

This manual is also suitable for:

Dspic33f series

Table of Contents