Digital to Analog and Back

Similar documents
DAC Digital To Analog Converter

Chapter 6: From Digital-to-Analog and Back Again

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Atmel Norway XMEGA Introduction

DS1104 R&D Controller Board

Analog/Digital Conversion. Analog Signals. Digital Signals. Analog vs. Digital. Interfacing a microprocessor-based system to the real world.

Timer A (0 and 1) and PWM EE3376

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Debouncing Switches. Mechanical switches are one of the most common interfaces to a uc.

MicroMag3 3-Axis Magnetic Sensor Module

Conversion Between Analog and Digital Signals

Pulse Width Modulation

Analog-to-Digital Converters

Microcontroller Programming Beginning with Arduino. Charlie Mooney

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

A 5 Degree Feedback Control Robotic Arm (Haptic Arm)

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

Lab Experiment 1: The LPC 2148 Education Board

2.0 Command and Data Handling Subsystem

Digital to Analog and Analog to Digital Conversion

Software Manual RS232 Laser Merge Module. Document # SU Rev A

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Embedded Systems Design Course Applying the mbed microcontroller

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

AC : PRACTICAL DESIGN PROJECTS UTILIZING COMPLEX PROGRAMMABLE LOGIC DEVICES (CPLD)

Microcontroller-based experiments for a control systems course in electrical engineering technology

Pulse Width Modulation Applications

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

1/22/16. You Tube Video. Definitions. Duty Cycle: on-time per period (specified in per cent)

Microcomputers. Analog-to-Digital and Digital-to-Analog Conversion

User s Manual of Board Microcontroller ET-MEGA2560-ADK ET-MEGA2560-ADK

Palaparthi.Jagadeesh Chand. Associate Professor in ECE Department, Nimra Institute of Science & Technology, Vijayawada, A.P.

AN4646 Application note

Self-Evaluation Configuration for Remote Data Logging Systems

Implementing SPI Communication Between MSP430 G2452 and LTC ADC

Cold-Junction-Compensated K-Thermocoupleto-Digital Converter (0 C to C)

A Master-Slave DSP Board for Digital Control

Extended Boundary Scan Test breaching the analog ban. Marcel Swinnen, teamleader test engineering

Measuring, Controlling and Regulating with labworldsoft

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

A Lesson on Digital Clocks, One Shots and Counters

Flexible Active Shutter Control Interface using the MC1323x

A Lesson on Digital Clocks, One Shots and Counters

Work with Arduino Hardware

Tamura Closed Loop Hall Effect Current Sensors

AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE

Chapter 13. PIC Family Microcontroller

Interfacing Analog to Digital Data Converters

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Use and Application of Output Limiting Amplifiers (HFA1115, HFA1130, HFA1135)

Real Time Development of MC Applications using the PC Master Software Visualization Tool. 1. Introduction. 2. Development of Motor Control.

I2C PRESSURE MONITORING THROUGH USB PROTOCOL.

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

Micro-Step Driving for Stepper Motors: A Case Study

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

AC/DC Power Supply Reference Design. Advanced SMPS Applications using the dspic DSC SMPS Family

Accurate Measurement of the Mains Electricity Frequency

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

Digital Single Axis Controller

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

ADS9850 Signal Generator Module

LEVERAGING FPGA AND CPLD DIGITAL LOGIC TO IMPLEMENT ANALOG TO DIGITAL CONVERTERS

Solar Energy Conversion using MIAC. by Tharowat Mohamed Ali, May 2011

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

EFC Frequency converters

US-SPI New generation of High performances Ultrasonic device

Analog signals are those which are naturally occurring. Any analog signal can be converted to a digital signal.

STEPPER MOTOR SPEED AND POSITION CONTROL

Analog Representations of Sound

Tire pressure monitoring

Product Datasheet P MHz RF Powerharvester Receiver

Status of the design of the TDC for the GTK TDCpix ASIC

RF Measurements Using a Modular Digitizer

Digital to Analog Converter. Raghu Tumati

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

Computer Systems Structure Input/Output

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 46 Per-pin Signal Generator

HDMM01 V1.0. Dual-axis Magnetic Sensor Module With I 2 C Interface FEATURES. Signal Path X

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Arduino Motor Shield (L298) Manual

CPU ARM926EJ-S, 200MHz. Fast Ethernet 10/100 Mbps port. 6 digital input 2 digital open-drain alarm output

Ingar Fredriksen AVR Applications Manager. Tromsø August 12, 2005

Principles of Adjustable Frequency Drives

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

Android Controlled Based Interface

Note monitors controlled by analog signals CRT monitors are controlled by analog voltage. i. e. the level of analog signal delivered through the

Single Phase Two-Channel Interleaved PFC Operating in CrM

AN3998 Application note

MANUAL FOR RX700 LR and NR

System theremino MasterDIL-V3

Chapter 2 Logic Gates and Introduction to Computer Architecture

LOCAL INTERCONNECT NETWORK (LIN)

Transcription:

Digital to Analog and Back Analog: encoding information using voltage Many sensors use voltage as an output Motors torque is determined by current passing through the motor Digital: encoding information with bits How to move between these? 1

Digital to Analog Conversion How could we do this with a single digital pin of our microprocessor? 2

Digital to Analog Conversion: Pulse Width Modulation What does this circuit do? 3

Digital to Analog Conversion: Pulse Width Modulation Processor digital pin: generate PWM signal RC circuit smooths this PWM signal out Pulse width determines smoothed voltage 4

D2A: Pulse Width Modulation Easy to implement But: Assumes analog out requires zero current Smoothed signal may not be smoothed enough Filter induces a delay 5

Digital to Analog Conversion: Resistive Network Sometimes need faster response Solution: use multiple digital pins What would this circuit look like? 6

Digital to Analog Conversion On the group quiz: 3-bit D2A converter Process specifies a digital output Within a short period of time (~ 1 ns), the voltage settles to the value that we computed 7

Digital to Analog Conversion In class exercise 8

Analog to Digital Conversion For a given voltage, what is the digital representation of the voltage? How would we implement this? 9

Analog to Digital Conversion Board exercise 10

Analog to Digital Conversion For a given voltage, what is the digital representation of the voltage? 11

Analog to Digital Conversion Common approach: successive approximation 1. Set V_low = 0; V_high 5 2. Use a D2A converter to produce a voltage guess V =(V_low + V_high)/2 3. Compare this with the input voltage Vin 4. If guess is too low, then set V_low = V 5. If guess is too high, then set V_high = V 6. Continue with #2 (until V_low == V_high) 12

A2D in the Mega2560 The mega2560 contains hardware that implements successive approximation 16 mega2560 pins can be configured as analog input pins 13

Mega2560: The Connections AREF: (for our purposes) connect to +5V ADC will measure voltages between 0 and AREF Connect input analog signal to the appropriate ADC pin 14

A Code Example: Configuration // Initialize adc adc_set_reference(adc_ref_aref); // Use the AREF reference pin adc_set_adlar(0); // For our purposes, always use 0 adc_set_prescalar(adc_prescalar_128); // Necessary with 16MHz clock // and 10 bit resolution // Turn on ADC Converter adc_set_enable(adc_enable); 15

A Code Example: Use uint16_t val; // Can do the following an arbitrary number of times adc_set_channel(adc_channel_0); // ADC0 // Actually start a conversion adc_start_conversion(); <Could go off and do something else for a while> val = adc_read(); // Read the analog value 16

Analog Conversion Notes All functions are provided in oulib See OUlib documentation for the definition of constants Can get to the example code from the Atmel HowTo www.cs.ou.edu/~fagg/classes/general/atmel 17

Analog Conversion Notes Setting the maximum voltage: adc_set_reference(adc_ref_aref); // Use the AREF reference pin Can also used a fixed voltage (+2.56V): adc_set_reference(adc_ref_2p56v); 18

Analog Conversion Notes Determining how fast the conversion requires: adc_set_prescalar(adc_prescalar_128); // Necessary with 16MHz clock // and 10 bit resolution Conversion requires: 128 * 15 / 16000000 seconds Can convert faster, but may not get the full 10- bit resolution 19

Analog Conversion Notes Reading out the value: val = adc_read(); // Read the analog value Blocks until conversion is complete Will return a value between 0 and 0x3FF (1023) 20

Analog Conversion Notes Can configure the mega2560 to interrupt on conversion completion 21

Other Devices External devices are available that will perform D2A and A2D Often interface to the microprocessor via I 2 C or SPI (these are high-speed serial protocols) Many options Resolution Conversion speed Number of channels 22