AN2688 Freescale Semiconductor / Motorola, AN2688 Datasheet

no-image

AN2688

Manufacturer Part Number
AN2688
Description
Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
AN2688/D
3/2004
Implementing a 10-Bit
Sigma-Delta Analog-to-
Digital Converter Using the
HC9S08Rx MCU Family
Analog Comparator
Motorola and the Stylized M Logo are registered trademarks of Motorola, Inc.
DigitalDNA is a trademark of Motorola, Inc.
This product incorporates SuperFlash® technology licensed from SST.
By: Jefferson Daniel de Barros Soldera
Introduction
Marcus Espindola
Alfredo Olmos
Brazilian Semiconductor Technology Center — BSTC/SPS
Analog-to-digital (AD) converters, based on the Sigma-Delta (Σ∆) modulation trade
resolution in time for resolution in amplitude by combining:
First order Σ∆ AD comparators are the simplest, most robust, and have a stable
modulator architecture. They are especially insensitive to circuit imperfections and
component mismatch since they rely on a simple integrator and a comparator
embedded within a feedback loop; whereas, the digital filter can be easily
implemented with a comb filter.
This application note describes how to implement a 10-bit first-order continuous-
time Σ∆ AD converter using a member of the HC9S08Rx MCU Family of devices
including the analog comparator feature. In spite of this MCU family not having a
built-in AD converter the analog comparator, internal bandgap reference voltage
and timers can be used to convert an analog input signal to the digital domain with
10-bits of resolution. Some members of the HC9S08Rx MCU Family have a rail-to-
rail comparator module and their internal bandgap reference can be selected as
the comparator reference voltage. The HC9S08Rx analog comparator allows
developing a very low-cost first-order continuous-time Σ∆ modulator by adding a
few external components; whereas, the MCU itself emulates the digital decimeter
filter in software using its internal timers. High resolution can be attained by
properly adjusting the input bandwidth and the oversampling ratio.
High sampling rates
Negative feedback
Digital filtering
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
© Motorola, Inc., 2004

Related parts for AN2688

AN2688 Summary of contents

Page 1

... Freescale Semiconductor, Inc. Application Note AN2688/D 3/2004 Implementing a 10-Bit Sigma-Delta Analog-to- Digital Converter Using the HC9S08Rx MCU Family Analog Comparator By: Jefferson Daniel de Barros Soldera Marcus Espindola Alfredo Olmos Brazilian Semiconductor Technology Center — BSTC/SPS Introduction Analog-to-digital (AD) converters, based on the Sigma-Delta (Σ∆) modulation trade resolution in time for resolution in amplitude by combining: • ...

Page 2

... Freescale Semiconductor, Inc. AN2688/D Σ∆ Modulation at a Glance illustrates the basic architecture of a Σ∆ AD converter comprising: Figure 1 • An analog integrator • A quantizer or comparator enclosed in a feedback loop via a single-bit digital-to-analog (DA) converter • A digital low-pass filter. The input signal is fed to the comparator through the integrator and the quantized output is fed back and subtracted from the input ...

Page 3

... Figure 3 allows attaining a 10-bit resolution. Since for DC or slowly Go to: www.freescale.com SD Modulation at a Glance works as a 1-bit circuit also performs low-pass anti FEEDBACK LOOP LATCH DIGITAL FILTER CK Equation Equation 2 AN2688 BITS 3 ...

Page 4

... Freescale Semiconductor, Inc. AN2688/D Implementation with HC9S08Rx MCU Family The HC9S08Rx MCU with the analog comparator function can be configured as a first-order continuous-time Σ∆ AD converter as depicted in by adding: • Two external resistors • One capacitor • Properly programming the internal timers to filter and decimate the comparator digitized output ...

Page 5

... Multiple power management modes including 20 nA power down @ 2 V Optional auto wake-up with internal timer and internal oscillator typically 700 1.8–3.6 V operation 125 ns minimum instruction cycle time down to 1 MHz bus Single wire background debug mode Trace capability with 9 trigger modes and 3 breakpoints Go to: www.freescale.com AN2688/D 5 ...

Page 6

... Freescale Semiconductor, Inc. AN2688/D • Low power oscillator capable of operating from crystal or resonator from MHz • On-chip analog comparator with internal reference (ACMP) – – • Serial communications interface module (SCI) • Serial peripheral interface module (SPI) • 2-channel, 16-bit timer/pulse width modulator (TPM) module with selectable input capture, output compare, and edge-aligned or center-aligned PWM capability on each channel ...

Page 7

... MΩ 16 MHz to: www.freescale.com Application Description Software Description 2.4 V Supply 1 µF 100 PTC0 18 30 PTC1 31 PTC2 32 PTC3 33 PTC4 9S08Rx 38 PTC5 MCU RESULTS L:H 39 PTC6 40 PTC7 46 PTB0 13 PTB1 14 PTB2 15 19 XTAL AN2688/D 7 ...

Page 8

... Freescale Semiconductor, Inc. AN2688/D The MCU oscillator is a traditional Pierce oscillator that can accommodate a crystal or ceramic resonator MHz. Resistor R resistor such as a carbon composition resistor and it’s tolerance is not critical. C and C should be ceramic capacitors being typically in the 5-pF to 25-pF range and 3 are chosen to match the requirements of a specific crystal or resonator. The crystal ...

Page 9

... Figure 7. Σ∆ Modulator Response to a Triangle Input Signal Figure 8. Σ∆ Modulator Response to a Sinusoidal Input Signal MOTOROLA Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator For More Information On This Product, Go to: www.freescale.com AN2688/D Application Description 9 ...

Page 10

... Freescale Semiconductor, Inc. AN2688/D The Σ∆ modulator evaluation is performed by analyzing the single-bit output signal spectrum through the Fast Fourier Transform (FFT). Input power is normalized to the quantization step defined by the comparator supply voltage whereas the sampling rate is set to 128 kHz with the timer interruption feature. ...

Page 11

... Figure 11. Measured Σ∆ Modulator SNR for a 50-kHz Sampling Frequency MOTOROLA Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator For More Information On This Product, -50 -40 -30 -20 Input power [dB] and 125-Hz Input Signal Frequency Go to: www.freescale.com AN2688/D Application Description -10 0 ...

Page 12

... Freescale Semiconductor, Inc. AN2688/D Software Description Two software options are listed in this application note. The first one is intended to implement a first-order continuous-time Σ∆ modulator according to the flowchart in Figure 12. The second one corresponds to the complete first-order continuous- time Σ∆ AD converter in Figure 12. The First-Order Σ∆ Modulator Software Flowchart ...

Page 13

... CLEAR VARIABLES FOR COUNTER AND RESULT WAIT MODE PTE0 = 0 INTERRUPT OCCURS PTE0 = 1 ACMP > PTA1 AND PTA2 = 1 INCREMENT RESULT INCREMENT COUNTER Y COUNTER < 1024? N PTE1 = 0 PTB AND PTC OUTPUT THE RESULT PTE1 = 1 Go to: www.freescale.com AN2688/D Software Description N ? REF PTA1 AND PTA2 = 0 13 ...

Page 14

... Freescale Semiconductor, Inc. AN2688/D The continuous-time Σ∆ modulator software: • Configures the I/O ports and registers • Sets the timer interrupt to a 128-kHz frequency • Clears PTE0 and the MCU stays in wait mode until an interrupt is reached. • After the timer overflows, PTE0 is set high and the comparator output flag (ACO) is verified. – ...

Page 15

... Motorola is a registered trademark of Motorola, Inc. ;******************************************************************************************* ; XDEF Entry,Reset,TPMInt ;******************************************************************************************* ;* Equates and Data Table Includes ;******************************************************************************************* include "9S08RC16.equ" MOTOROLA Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator For More Information On This Product, Comments -------------------------------------------- Initial data entry Go to: www.freescale.com AN2688/D Software Listings 15 ...

Page 16

... Freescale Semiconductor, Inc. AN2688/D ;DEFAULT_RAM SECTION SHORT org RamStart ;******************************************************************************************* ;* Constants and Variables for this file ;******************************************************************************************* include 'SigmaDelta.equ' ;DEFAULT_ROM SECTION ;******************************************************************************************* ;* Code Section ;******************************************************************************************* org FlashStart Entry: Reset: ldhx #RamEndAddress+1 txs lda #setSIMOPT sta SIMOPT lda #setPMCSC1 sta PMCSC1 mov #setACMPSC,ACMPSC clr TPMCNTH clr ...

Page 17

... Timer Overflow Flag ;set bit 0 of port PTE ;clear bit 1 of port PTA ;clear bit 2 of port PTA ;return from interrupt routine ;set bit 1 of port PTA ;set bit 2 of port PTA ;return from interrupt routine Go to: www.freescale.com AN2688/D Software Listings 17 ...

Page 18

... Freescale Semiconductor, Inc. AN2688/D SignmaDeltaF.asm ;******************************************************************************************* ;* Title: SigmaDeltaF.asm (c) MOTOROLA Inc. 2004 All rights reserved. ;******************************************************************************************* ;* Author: Marcus Espindola - Motorola SPS/BSTC ;* ;* Description: Implementing a 10-bit Sigma-Delta Analog to Digital Converter Using the ;* HC9S08Rx MCU Family Analog Comparator - Code for Sigma-Delta A2D Coverter ;* ;* Documentation: 9S08RC16 Data Sheet for register and bit explanations ...

Page 19

... PTC as output ;reset Counter (low order) ;reset Counter (high order) ;reset Sample (low order) ;reset Sample (high order) ;clear bit 0 of port PTE ;clear bit 1 of port PTE ;define bit 0 of port PTE as output Go to: www.freescale.com AN2688/D Software Listings 19 ...

Page 20

... Freescale Semiconductor, Inc. AN2688/D bset DDRE1,DDRE WaitState: wait bclr PTE0,PTE bra WaitState ;******************************************************************************************* ;* Timer Interrupt (min = 48 cycles / max = 108 cycles) ;******************************************************************************************* TPMInt: lda TPMSC bclr TOF,TPMSC bset PTE0,PTE brset ACO,ACMPSC,SetOutHigh bclr PTA1,PTA bclr PTA2,PTA bra IncCounter SetOutHigh: bset PTA1,PTA bset PTA2,PTA inc SampleL ...

Page 21

... CounterH: rmb 1 CounterL: rmb 1 setSIMOPT: equ %01000001 ;System Options Register MOTOROLA Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator For More Information On This Product, Copyright (c) Motorola 2004 Comments -------------------------------------------- Initial data entry Go to: www.freescale.com AN2688/D Software Listings 21 ...

Page 22

... Freescale Semiconductor, Inc. AN2688/D ; |||||||| ; |||||||+-RESET Pin Enable = 1 ; ||||||+--Background Debug Mode Pin Enable = 0 ; |||||+---Unused during write ; ||||+----Unused during write ; |||+-----Unused ; ||+------Stop Mode Enable = 0 ; |+-------COP Watchdog Timeout = Long Timeout ; +--------COP Watchdog Enable = 0 setPMCSC1: equ %01011000 ;System Power Management Status and Control 1 Register ; |||||||| ...

Page 23

... Freescale Semiconductor, Inc. MOTOROLA Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator For More Information On This Product, Go to: www.freescale.com AN2688/D Software Listings 23 ...

Page 24

... Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. digital dna is a trademark of Motorola, Inc. All other product or service names are the property of their respective owners. Motorola, Inc Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2004 AN2688/D Rev. 0 3/2004 Go to: www.freescale.com ...

Related keywords