Microchip Technology PIC24F Reference Manual
Microchip Technology PIC24F Reference Manual

Microchip Technology PIC24F Reference Manual

Hide thumbs Also See for PIC24F:

Advertisement

Quick Links

Section 66. 16-Bit Sigma-Delta A/D Converter
HIGHLIGHTS
This section of the manual contains the following major topics:
66.1
66.2
66.3
66.4
66.5
66.6
66.7
66.8
66.9
66.10 Design Tips ............................................................................................................... 66-23
66.11 Related Application Notes......................................................................................... 66-24
66.12 Revision History ........................................................................................................ 66-25
© 2013 Microchip Technology Inc.
Introduction ................................................................................................................. 66-2
Registers ..................................................................................................................... 66-4
SD A/D Module Configuration ..................................................................................... 66-8
Interrupt Modes ......................................................................................................... 66-14
Offset Calibration ...................................................................................................... 66-14
Gain Error Calibration ............................................................................................... 66-15
Operation During Sleep and Idle Modes ................................................................... 66-21
Effects of a Reset...................................................................................................... 66-21
Register Map............................................................................................................. 66-22
66
DS30687A-page 66-1

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Summary of Contents for Microchip Technology PIC24F

  • Page 1: Table Of Contents

    Operation During Sleep and Idle Modes ..............66-21 66.8 Effects of a Reset...................... 66-21 66.9 Register Map......................66-22 66.10 Design Tips ....................... 66-23 66.11 Related Application Notes..................66-24 66.12 Revision History ......................66-25 © 2013 Microchip Technology Inc. DS30687A-page 66-1...
  • Page 2: Introduction

    PIC24F Family Reference Manual 66.1 INTRODUCTION The PIC24F 16-bit Sigma-Delta Analog-to-Digital (SD A/D) Converter has the following key features: • Sigma-Delta Conversion • Programmable Data Rate up to 62.5 ksps • Differential inputs with Gain Settings • Dithering Option and Adjustable Oversampling Ratios •...
  • Page 3 Filter CH0- CH1- — CHn- Primary OSC SDDIV<2:0> Clock SDREFN Generation SDCS<1:0> Note 1: Refer to the specific device data sheet for more information on the actual number and type of channels available. © 2013 Microchip Technology Inc. DS30687A-page 66-3...
  • Page 4: Registers

    PIC24F Family Reference Manual 66.2 REGISTERS The 16-bit SD A/D Converter uses five registers for its operation: • SDxCON1: SD A/Dx Control Register 1 • SDxCON2: SD A/Dx Control Register 2 • SDxCON3: SD A/Dx Control Register 3 • SDxRESH: SD A/Dx Result Register High Word •...
  • Page 5 SDREFP: SD A/D Positive Voltage Reference Configuration bit 1 = SV + pin 0 = SV bit 0 PWRLVL: Analog Amplifier Bandwidth Select bit 1 = 2x bandwidth (higher power consumption compared to normal bandwidth) 0 = Normal bandwidth © 2013 Microchip Technology Inc. DS30687A-page 66-5...
  • Page 6 PIC24F Family Reference Manual Register 66-2: SDxCON2: SD A/Dx Control Register 2 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 CHOP1 CHOP0 SDINT1 SDINT0 — — SDWM1 SDWM0 bit 15 bit 8 R/W-0 R/W-0 HS/C-0 — — — RNDRES1 RNDRES0 — —...
  • Page 7 4 MHz. The 8 MHz FRC output is used directly, prior to the FRCDIV<2:0> postscaler. Refer to the specific device data sheet for more information on the actual number and type of channels available. © 2013 Microchip Technology Inc. DS30687A-page 66-7...
  • Page 8: Sd A/D Module Configuration

    PIC24F Family Reference Manual 66.3 SD A/D MODULE CONFIGURATION All of the registers described in the previous section must be configured for the module operation. The various configuration and control functions of the module are distributed throughout the module’s three control registers. Control functions can be sorted into four groups: input, timing, conversion and output.
  • Page 9: Selecting The Voltage Reference Source

    (SDxCON1<2:1>). The upper voltage reference (V +) can be SV or the voltage applied on the SV + pin. The lower voltage reference (V -) can be SV or the voltage applied on the SV - pin. © 2013 Microchip Technology Inc. DS30687A-page 66-9...
  • Page 10 PIC24F Family Reference Manual 66.3.2 Gain Control The Programmable Gain Amplifier (PGA) block can be used to amplify very low signals, but the differential input range of the SD A/D module should not be exceeded to avoid a saturated output result code.
  • Page 11 SDOSR<2:0> setting for the required output data rate, see Table 66-3. Table 66-3: Data Rate Settings Data Rate A/D Clock Frequency (MHz) SDOSR<2:0> (ksps) 62.500 31.2500 15.6250 7.8125 3.90625 1.953125 0.9765625 0.4883 0.2441 © 2013 Microchip Technology Inc. DS30687A-page 66-11...
  • Page 12 PIC24F Family Reference Manual 66.3.4 Selection of Dither Dithering helps in suppressing the Idle tones present in the SD A/D module. Dithering is the pro- cess of intentionally adding a small error to the SD A/D feedback loop in order to “decorrelate”...
  • Page 13 When the module is enabled (SDON = 1), the firmware may change the channel selection (SDCH<2:0> or VOSCAL bit settings). If other A/D module settings must be changed, the module should be disabled first (SDON = 0). © 2013 Microchip Technology Inc. DS30687A-page 66-13...
  • Page 14: Interrupt Modes

    PIC24F Family Reference Manual 66.4 INTERRUPT MODES There are four Interrupt modes: • Interrupt on Every Data Ready mode • Interrupt on every Fifth Data Ready mode • Interrupt on Threshold Current Value Lesser than the Previous Value mode • Interrupt on Threshold Current Value Greater than the Previous Value mode The four modes are controlled by the SDINT<1:0>...
  • Page 15: Gain Error Calibration

    A/D Converter measurements on other channels/input voltage sources, the gain error correction factor can be multiplied by the raw result (after offset correction through VOSCAL) to compensate for the A/D Converter gain error. © 2013 Microchip Technology Inc. DS30687A-page 66-15...
  • Page 16 PIC24F Family Reference Manual Example 66-2: Channel Conversion with Offset and Gain Correction unsigned char count; signed short int offset; signed long int maxValue; const double expectedMaxValue = 32767; // 0x7FFF double gain; signed long int channelValue; double calibratedResult; // ADC initialization.
  • Page 17 // Wait for the result ready. while(IFS6bits.SDA1IF == 0); // Not corrected channel #0 result. channelValue = (signed short int) SD1RESH; // Correct offset. channelValue -= offset; // Correct gain. calibratedResult = gain*channelValue; © 2013 Microchip Technology Inc. DS30687A-page 66-17...
  • Page 18 PIC24F Family Reference Manual 66.6.2 Gain Error Correction Using Integer Math Floating-point math is easy and convenient to use, but is often undesirable during actual execution because it generally consumes a large amount of CPU execution time and code space to perform.
  • Page 19 // Correct offset. maxValue -= offset; // Calculate gain. expectedMaxValue = ((signed long int)32767)<<FIXED_POINT_POS; gain = expectedMaxValue/maxValue; // Select channel #0 for the measurement. // (see the specific device data sheet). SD1CON3bits.SDCH = 0; © 2013 Microchip Technology Inc. DS30687A-page 66-19...
  • Page 20 PIC24F Family Reference Manual Example 66-3: Channel Conversion with Offset and Gain Correction Using Integer Math (Continued) // Adjust loop end value for desired settling time (value must be >= 5). for(count=0; count<8; count++) // Clear interrupt flag. IFS6bits.SDA1IF = 0;...
  • Page 21: Operation During Sleep And Idle Modes

    Use of SDRST With the SDON bit set, the SDRST bit can be used for the module to switch between active and inactive modes quickly, without any delay that is associated with the SDON bit. © 2013 Microchip Technology Inc. DS30687A-page 66-21...
  • Page 22: Register Map

    66.9 REGISTER MAP Table 66-4: SD A/D Converter 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 Resets...
  • Page 23: Design Tips

    DESIGN TIPS Question 1: Can we scan more than one channel? Answer: Yes. However, it is recommended that you “flush” the pipeline before moving to the next channel or the result will be erroneous. © 2013 Microchip Technology Inc. DS30687A-page 66-23...
  • Page 24: Related Application Notes

    This section lists application notes that are related to this section of the manual. These application notes may not be written specifically for the PIC24F device family, but the concepts are pertinent and could be used with modification and possible limitations. The current...
  • Page 25: Revision History

    Section 66. 16-Bit Sigma-Delta A/D Converter 66.12 REVISION HISTORY Revision A (April 2013) This is the initial released revision of this document. © 2013 Microchip Technology Inc. DS30687A-page 66-25...
  • Page 26 PIC24F Family Reference Manual NOTES: DS30687A-page 66-26 © 2013 Microchip Technology Inc.
  • Page 27 Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA and Z-Scale 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. GestIC and ULPP are registered trademarks of Microchip Technology Germany II GmbH &...
  • Page 28 Thailand - Bangkok Tel: 86-29-8833-7252 Tel: 66-2-694-1351 Toronto Fax: 86-29-8833-7256 Fax: 66-2-694-1350 Mississauga, Ontario, Canada China - Xiamen Tel: 905-673-0699 Tel: 86-592-2388138 Fax: 905-673-6509 Fax: 86-592-2388130 China - Zhuhai Tel: 86-756-3210040 11/29/12 Fax: 86-756-3210049  2013 Microchip Technology Inc. DS30687A-page 66-28...

Table of Contents