DOC PREVIEW
UNCC ECGR 4101 - Using the M16C/62 Analog to Digital Converter in One-Shot Mode

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AbstractIntroductionOne-Shot Mode DescriptionExample ProgramReferenceSoftware CodeAPPLICATION NOTE M16C/62 Using the M16C/62 Analog to Digital Converter in One-Shot Mode 1.0 Abstract The following article outlines the steps necessary to set up, perform, and read a single conversion using the onboard analog to digital converter (ADC) of the M16C. The ADC is useful in measuring output voltages of sensors such as accelerometers or other analog instrumentation and converting them to digital values. 2.0 Introduction The M16C line of devices features an onboard analog to digital converter (ADC). The ADC consists of one 10-bit successive approximation circuit with a capacitive coupled amplifier. There are eight analog input pins, selectable conversion clock speeds, sample and hold function, and several conversion modes. Figure 1 is an overview of the internal circuitry for the ADC block. 1/2φAD1/2fADA-D conversion rate selection(03C116, 03C016)(03C316, 03C216)(03C516, 03C416)(03C716, 03C616)(03C916, 03C816)(03CB16, 03CA16)(03CD16, 03CC16)(03CF16, 03CE16)CKS1=1CKS0=00 0 : Normal operation0 1 : ANEX01 0 : ANEX11 1 : External op-amp modeA-D register 0(16)A-D register 1(16)A-D register 2(16)A-D register 3(16)A-D register 4(16)A-D register 5(16)A-D register 6(16)A-D register 7(16)Resistor ladderANEX1ANEX0Successive conversion registerOPA1,OPA0=0,1OPA0=1OPA1=1OPA1,OPA0=1,1AN0AN1AN2AN3AN5AN6AN7A-D control register 0 (address 03D616)A-D control register 1 (address 03D716)VrefVINData bus high-orderData bus low-orderVREFAN4OPA1,OPA0=0,0VCUT=0AVSSVCUT=1CKS0=1CKS1=0CH2,CH1,CH0=000CH2,CH1,CH0=001CH2,CH1,CH0=010CH2,CH1,CH0=011CH2,CH1,CH0=100CH2,CH1,CH0=101CH2,CH1,CH0=110CH2,CH1,CH0=111DecoderComparatorOPA1, OPA0Addresses Figure 1 Internal Circuitry for ADC Block—Overview REU05B0004-0100Z June 2003 Page 1 of 7M16C/62Using the M16C/62 Analog to Digital Converter in One-Shot Mode 3.0 One-Shot Mode Description In one-shot mode, one pin of the ADC is selected as the input source. Once triggered, a conversion takes place on the selected pin and the result is stored in the ADC result register corresponding to the selected channel. An interrupt signifies the completion of a conversion. and F are overviews of the registers that will be used in this example. These registers are detailed in the included sample code. For specific details, consult the M16C/. Figure 2Figure 2 A-D Converter Related Registers igure 3 A-D control register 0 (Note 1)Symbol Address When resetADCON0 03D61600000XXX2b7 b6 b5 b4 b3 b2 b1 b0Analog input pin select bit0 0 0 : AN0 is selected0 0 1 : AN1 is selected0 1 0 : AN2 is selected0 1 1 : AN3 is selected1 0 0 : AN4 is selected1 0 1 : AN5 is selected1 1 0 : AN6 is selected1 1 1 : AN7 is selected (Note 2)CH0Bit symbol Bit name F unctionCH1CH2A-D operation mode select bit 00 0 : One-shot mode0 1 : Repeat mode1 0 : Single sweep mode1 1 : Repeat sweep mode 0Repeat sweep mode 1 (Note 2)MD0MD1Trigger select bit 0 : Software trigger1 : ADTRG triggerTRGADSTA-D conversion start flag 0 : A-D conversion disabled1 : A-D conversion startedFrequency select bit 0 0 : fAD/4 is selected1 : fAD/2 is selectedCKS0WRb2 b1 b0b4 b3Note 1: If the A-D control register is rewritten during A-D conversion, the conversion result is indeterminate.Note 2: When changing A-D operation mode, set analog input pin again. A-D control register 1 (Note)Symbol Address When resetADCON1 03D7160016Bit name FunctionBit symbolb7 b6 b5 b4 b3 b2 b1 b0A-D sweep pin select bitSCAN0SCAN1MD2BITS8/10-bit mode select bit 0 : 8-bit mode1 : 10-bit modeVCUTOPA0Vref connect bitOPA1A-D operation mode select bit 10 : Any mode other than repeat sweep mode 11 : Repeat sweep mode 10 : Vref not connected1 : Vref connectedExternal op-amp connection mode bitWRWhen single sweep and repeat sweep mode 0 are selected0 0 : AN0, AN1 (2 pins)0 1 : AN0 to AN3 (4 pins)1 0 : AN0 to AN5 (6 pins)1 1 : AN0 to AN7 (8 pins)b1 b0When repeat sweep mode 1 is selected0 0 : AN0 (1 pin)0 1 : AN0, AN1 (2 pins)1 0 : AN0 to AN2 (3 pins)1 1 : AN0 to AN3 (4 pins)b1 b00 0 : ANEX0 and ANEX1 are not used0 1 : ANEX0 input is A-D converted1 0 : ANEX1 input is A-D converted1 1 : External op-amp connection modeb7 b6Frequency select bit 1 0 : fAD/2 or fAD/4 is selected 1 : fAD is selectedCKS1Note: If the A-D control register is rewritten during A-D conversion, the conversion result is indeterminate. REU05B0004-0100Z June 2003 Page 2 of 7M16C/62Using the M16C/62 Analog to Digital Converter in One-Shot Mode A-D control register 2 (Note) Symbol Address When resetADCON2 03D416 0000XXX02b7 b6 b5 b4 b3 b2 b1 b0A-D conversion method select bit 0 : Without sample and hold1 : With sample and holdBit symbol Bit name Function R WNote 1: If the A-D control register is rewritten during A-D conversion, the conversion result is indeterminate.A-D register i Symbol Address When resetADi(i=0 to 7) 03C016 to 03CF16 Indeterminate Eight low-order bits of A-D conversion resultFunction R W(b15)b7b7 b0b0(b8)• During 10-bit mode Two high-order bits of A-D conversion result• During 8-bit mode When read, the content is indeterminateSMPReserved bitAlways set to “0”000Nothing is assigned. Write "0" when writing to these bits.When read, the value is "0".Nothing is assigned. Write "0" when writing to these bits.When read, the value is "0". Figure 3 A-D Converter Related Registers 4.0 Example Program This example program demonstrates how to perform a conversion using the ADC in the following environment: Environment Setup • One-shot conversion • 10-bit mode • Analog input 0 used • Sample and hold enabled • Vref connected • Conversion clock used will be fAD/2 (if f(Xin) is greater than 10 MHz, fAD must be divided ) • Software conversion start ADC Software Setup • Set the ADCON0 register for fAD/2,one-shot operation using AN0 (0x80) • Set the ADCON1 register for 10 bit mode, fADdivided, and connect Vref (0x28) • Set the ADCON2 register for sample and hold (0x01) • Enable the A/D converter by setting the ADST bit to 1 • Read current A/D channel values in the variables ‘TempStore’ in the AD Interrupt Service Routine REU05B0004-0100Z June 2003 Page 3 of 7M16C/62Using the M16C/62 Analog to Digital Converter in One-Shot Mode 5.0 Reference Renesas Technology Corporation Semiconductor Home Page http://www.renesas.com E-mail Support [email protected] Data Sheets • M16C/62 datasheets, 62aeds.pdf User’s Manual • NC30 Ver. 4.0 User’s


View Full Document

UNCC ECGR 4101 - Using the M16C/62 Analog to Digital Converter in One-Shot Mode

Documents in this Course
Load more
Download Using the M16C/62 Analog to Digital Converter in One-Shot Mode
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Using the M16C/62 Analog to Digital Converter in One-Shot Mode and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Using the M16C/62 Analog to Digital Converter in One-Shot Mode 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?