Converting between Analog and Digital Domains

Similar documents
Analog to Digital Conversion

CPE 310L EMBEDDED SYSTEM DESIGN (CPE)

Interfacing Analog to Digital Data Converters. A/D D/A Converter 1

Data Conversion and Lab (17.368) Fall Lecture Outline

International Islamic University Chittagong (IIUC) Department of Electrical and Electronic Engineering (EEE)

Analog to Digital Converter. Last updated 7/27/18

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR NPTEL ONLINE CERTIFICATION COURSE. On Industrial Automation and Control

Chapter 11 Sections 1 3 Dr. Iyad Jafar

The Successive Approximation Converter Concept - 8 Bit, 5 Volt Example

ELCT706 MicroLab Session #3 7-segment LEDs and Analog to Digital Conversion. Eng. Salma Hesham

Hello and welcome to this presentation of the STM32L4 Analog-to-Digital Converter block. It will cover the main features of this block, which is used

Decade Counters Mod-5 counter: Decade Counter:

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Analog to Digital Converter

EECS 373 Design of Microprocessor-Based Systems

Part 2 -- A digital thermometer or talk I2C to your atmel microcontroller

Introduction to Embedded Microcomputer Systems Lecture Discrete digital signal. Continuous analog signal

Converters: Analogue to Digital

Note 5. Digital Electronic Devices

VIRTUAL INSTRUMENTATION

BASIC LINEAR DESIGN. Hank Zumbahlen Editor Analog Devices, Inc. All Rights Reserved

nc... Freescale Semiconductor, I

Analog-to-Digital Conversion

Fig. 1 Analog pins of Arduino Mega

SUBSYSTEMS FOR DATA ACQUISITION #39. Analog-to-Digital Converter (ADC) Function Card

Data Converter Overview: DACs and ADCs. Dr. Paul Hasler and Dr. Philip Allen

A/D and D/A convertor 0(4) 24 ma DC, 16 bits

Analog Input & Output

Analog-to-Digital Converter

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 2018 EXAMINATION MODEL ANSWER

Experiment 9 Analog/Digital Conversion

TXZ Family. Reference Manual 12-bit Analog to Digital Converter (ADC-A) 32-bit RISC Microcontroller. Revision

UNIT V 8051 Microcontroller based Systems Design

Analog-to-Digital Conversion (Part 2) Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

ADC Peripheral in Microcontrollers. Petr Cesak, Jan Fischer, Jaroslav Roztocil

AN919: Using the EFM8LB1 ADC

Tutorial Introduction

Analog input and output

NON-OVERSAMPLING DIGITAL TO ANALOG CONVERTER ASSEMBLY INSTRUCTIONS FEATURES DESCRIPTION JUNDAC FIVE

Low Power, 16-Bit Buffered Sigma-Delta ADC AD7790

Tutorial on Technical and Performance Benefits of AD719x Family

AN3023 Application note

Linear Circuit Design Handbook

MSP430 Teaching Materials

B I O E N / Biological Signals & Data Acquisition

Chapter 29 Analog Digital Converter (ADC)

TV Synchronism Generation with PIC Microcontroller

Alice EduPad Board. User s Guide Version /11/2017

Scans and encodes up to a 64-key keyboard. DB 1 DB 2 DB 3 DB 4 DB 5 DB 6 DB 7 V SS. display information.

Major Differences Between the DT9847 Series Modules

Differences Between Controller Continuum ADC Modules 12-bit ADC vs. 16-bit ADC

NC Eng Systems. Block Diagrams. Learning Outcome 1. MjD

Digital (5hz to 500 Khz) Frequency-Meter

Reading an Image using CMOS Linear Image Sensor. S.R.Shinthu 1, P.Maheswari 2, C.S.Manikandababu 3. 1 Introduction. A.

Embedded System Training Module ABLab Solutions

Point System (for instructor and TA use only)

MODELING OF ADC ARCHITECTURES IN HDL LANGUAGES

ECE 372 Microcontroller Design

MF 644 MULTIFUNCTION I/O DEVICE USER'S MANUAL

R.G.O. 32 BIT CAMAC COUNTER MODULE USER MANUAL

DIGITAL ELECTRONICS MCQs

BCCU Brightness and Color Control Unit. XMC microcontrollers September 2016

MBI5050 Application Note

Section bit Analog-to-Digital Converter (ADC)

B. Sc. III Semester (Electronics) - ( ) Digital Electronics-II) BE-301 MODEL ANSWER (AS-2791)

INF4420 Project Spring Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC)

OVERVIEW LED BACKLIGHT CONTROLLER FAMILY

Triple RTD. On-board Digital Signal Processor. Linearization RTDs 20 Hz averaged outputs 16-bit precision comparator function.

MF 634 MULTIFUNCTION I/O CARD USER'S MANUAL

Hello, and welcome to this presentation of the STM32 system window watchdog. It will cover the main features of this peripheral used to detect

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

ABSTRACT. List of Tables 1 Excitation, Sample/Hold, and Direct Comparator Input Configurations DCM Register Configuration...

Maintenance/ Discontinued

CDK3402/CDK bit, 100/150MSPS, Triple Video DACs


AD9884A Evaluation Kit Documentation

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

Microcontrollers. Outline. Class 4: Timer/Counters. March 28, Timer/Counter Introduction. Timers as a Timebase.

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

25.5 A Zero-Crossing Based 8b, 200MS/s Pipelined ADC

Low Power, 16-Bit Buffered Sigma-Delta ADC AD7790

Topic D-type Flip-flops. Draw a timing diagram to illustrate the significance of edge

Reaction Game Kit MitchElectronics 2019

Digital Strobe Tuner. w/ On stage Display

How advances in digitizer technologies improve measurement accuracy

Digital Effects Pedal Description Ross Jongeward 10 December 2014

Published in A R DIGITECH

Laboratory 9 Digital Circuits: Flip Flops, One-Shot, Shift Register, Ripple Counter

The 9S12 A/D converter Huang Section ATD_10B8C Block User Guide

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

USER MANUAL FOR THE ANALOGIC GAUGE FIRMWARE VERSION 1.0

ES /2 digit with LCD

Zeroplus Logic Analyzer Multi-LA Stack and LA-Oscilloscope Stack

UNIIQA+ NBASE-T Monochrome CMOS LINE SCAN CAMERA

Viewing Serial Data on the Keysight Oscilloscopes

MATLAB & Image Processing (Summer Training Program) 4 Weeks/ 30 Days

USER MANUAL FOR THE ANALOGIC GAUGE FIRMWARE VERSION 1.1

THE NOISE PERFORMANCE OF EVALUATION BOARDS FOR A UNIVERSAL TRANSDUCER INTERFACE WITH USB CONNECTION

MACROVISION RGB / YUV TEMP. RANGE PART NUMBER

3 V/5 V, ±10 V Input Range, 1 mw 3-Channel 16-Bit, Sigma-Delta ADC AD7707

Department of Communication Engineering Digital Communication Systems Lab CME 313-Lab

Transcription:

Converting between Analog and Digital Domains Chapter 6 Renesas Electronics America Inc. Advanced Embedded Systems using the RX63N Rev. 0.1 00000-A

Topics Need Reference voltage Resolution Sample and Hold circuit Successive approximation Transfer function Conversion speed 12-bit ADC registers Operating modes 10-bit ADC registers D/A converter D/A converter registers 2

Need The microcontroller can process only digital data Are the following commonly measured quantities analog or digital? 1. Distance 2. Weight 3. Acceleration 4. Temperature 3

Need All physical quantities are analog. The world is analog! We need to convert these analog values to digital for the microcontroller to comprehend the value of the real analog physical quantity 4

Reference voltage The analog value is compared with a known reference voltage to obtain its digital form The measurement process is called quantization 5

Resolution The number of bits in the digital output is called the resolution of the ADC A 10-bit A/D convertor can produce 2^10 = 1024 distinct digital outputs RX63N microcontroller has an 8 channel 10-bit and a 21 channel 12-bit A/D converter units 6

Sample and Hold circuit This circuit catches hold of the voltage to be converted to digital form It is helpful particularly when the input analog voltage varies very fast When the switch is closed, the capacitor charges to the value of analog voltage and that value is fed to the A/D converter 7

Successive Approximation RX63N microcontroller employs this method of conversion In this method, initially the microcontroller compares the analog voltage with half the reference voltage In each approximation step, the microcontroller halves the possible range between which the digital value lies In this way the microcontroller closes in on the analog value, setting 1 or 0 to the bit position starting from MSb Set 1 if the analog value is greater than the reference value of that step, else set to 0 8

Successive Approximation Consider 2.5V to be measured with Vref= 3.3V using 10- bit A/D converter First 2.5 is compared with 1.65 (mean of 0 & 3.3). Since 2.5>1.65, our digital value is 1xxxxxxxxx Next compare 2.5 with 2.47 (mean of 1.65 & 3.3). Since 2.5>2.47, our digital value is 11xxxxxxxx We proceed in similar way till we get the lsb of the digital form We compare n times, where n is the resolution of the A/D converter 9

Transfer function n= digital output Vin = input analog voltage V+ref = upper reference voltage V-ref = lower reference voltage, generally zero N = resolution of A/D converter 10

Conversion speed Conversion speed = Start delay(td) + input sampling time(tspl) + conversion time (tsam) 11

12-bit ADC registers Some of the important registers are: A/D Data Registers (ADDRn) (n = 0 to 20) 16-bit register Holds the digital value To use a particular channel, the respective port has to be set up as input. For example, to use AN0, port 4 pin 0 use: PORT4.PDR.BIT.B0 = 0; For inputs, the Port Mode Register (PMR) also has to set up. This can be done using: PORT4.PMR.BIT.B0 = 1; 12

12-bit ADC registers A/D Control Register (ADCSR) Start conversion control Mode select Interrupt enable A/D clock speed 13

12-bit ADC registers A/D Channel Select Register (ADANSx (x=0 or 1)) 2 registers to select 20 channels 14

Operating modes Single cycle scan Performs conversion on single or multiple channels once Continuous scan mode Performs continuous conversion on single or multiple channels 15

ADC Initialization 1. void ADC_Init(){ 2. SYSTEM.MSTPCRA.BIT.MSTPA17 = 0; 3. S12AD.ADCSR.BYTE = 0x0C; 4. S12AD.ADANS0.WORD = 0x01; 5. S12AD.ADCER.BIT.ACE = 1; 6. S12AD.ADCER.BIT.ADRFMT = 0; 7. } Line 2: 12-bit ADC has been selected using the Module Stop Control Register A. Line 3: the Control Register is set: software trigger has been enabled (b1=0, b0=0), the PCLK (b3=1, b2=1) has been selected, A/D Interrupt Enable has not been enabled (b4=0) and Single-Cycle Scan mode has been selected (b6=0). Line 4: Channel 0 (AN000) has been selected. Line 5: automatic clearing of ADDRn Line 6: right alignment of ADDRn is done. 16 2011 Renesas Electronics America Inc. All rights reserved.

Example of a ADC Initialization 1. void ADC_Init() { 2. PORT4.PDR.BIT.B0 = 0; 3. PORT4.PMR.BIT.B0 = 1; 4. SYSTEM.MSTPCRA.BIT.MSTPA17 = 0; 5. S12AD.ADCSR.BYTE = 0x0C; 6. S12AD.ADANS0.WORD = 0x01; 7. S12AD.ADCER.BIT.ACE = 1; 8. S12AD.ADCER.BIT.ADRFMT = 0; 9. S12AD.ADSTRGR.BIT.ADSTRS = 0x0; 10. S12AD.ADCSR.BIT.ADST = 1; 11. } What does each line do? 17 2011 Renesas Electronics America Inc. All rights reserved.

Using ADC data 12. while(1){ 13. if(s12ad.adcsr.bit.adst == 0 && i == 0){ 14. ADC_out = S12AD.ADDR0 & 0X0FFF; 15. sprintf(adc_out,"%d",adc_out); 16. lcd_display(lcd_line2,adc_out ); 17. i++; 18. } 19. } What will this code do? 18 2011 Renesas Electronics America Inc. All rights reserved.

In Class Exercise How would you initialize the ADC and read the internal temperature sensor? 1. void ADC_Init() { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. } 19 2011 Renesas Electronics America Inc. All rights reserved.

10-bit ADC registers Some of the important registers are: A/D Data Register (ADDRn) (n = A to H) 16-bit register Holds the digital data 20

10-bit ADC registers A/D Control/Status Register (ADCSR) Select the input channels Start or stop A/D conversion Enable or disable ADI interrupt 21

10-bit ADC registers A/D Control Register (ADCR) Type of A/D conversion mode Clock select Trigger select 22

D/A converter It converts a digital value stated by programmer to corresponding analog voltage on a microcontroller pin It may be needed for controlling other devices like motor RX63N has a 10-bit D/A converter which has 2 channels Analog value = (D/A data register value / 1024) * Vref 23

D/A converter registers Some of the important registers are: D/A Data Register (DADRm) (m = 0, 1) 16-bit registers Holds the digital value to be converted to analog voltage 24

D/A converter registers D/A Control Register (DACR) Channel select Enable or disable D/A converter unit 25

Example of using the DAC 1. #include "iodefine.h" 2. void DAC_Init(); 3. void main(void){ 4. PORT0.PDR.BIT.B5 = 1; 5. PORT0.PMR.BIT.B5 = 0; 6. DAC_Init(); 7. while(1){} 8. } 9. 10. void DAC_Init(){ 11. SYSTEM.MSTPCRA.BIT.MSTPA19 = 0; 12. DA.DADR1 = 102; 13. DA.DACR.BYTE = 0x9F; 14. } 26 2011 Renesas Electronics America Inc. All rights reserved.

Conclusion We covered the A/D conversion concepts like transfer function, resolution, successive approximation technique The important control registers were also discussed You can now set A/D converter and D/A converter of RX63N to be used in your program 27

References All images taken from: [1] Renesas Electronics, Inc., RX63N Group, RX631 Group User s Manual: Hardware, Rev 1.60, February 2013 28

Renesas Electronics America Inc.