Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.

Slides:



Advertisements
Similar presentations
Analog to Digital Conversion (ADC)
Advertisements

Chapter 12: Analog Converter Subsystem
Analog-to-Digital Converter (ADC) And
Analogue to Digital Conversion By Cap’n Tim Johnson, PE Prepared 11/12/2013.
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC)  Read.  Homework #13 and Lab #13 due next week. 
EET 252 Unit 6 Analog-to-Digital Conversion
Analog to Digital Converters Byron Johns Danny Carpenter Stephanie Pohl Harry “Bo” Marr October 4, 2005.
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
Digital to Analog and Analog to Digital Conversion
CE 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Analog to Digital (and back again) Interfacing a microprocessor-based system.
4-Integrating Peripherals in Embedded Systems (cont.)
A/D and D/A. Overview Introduction oDefinitions oOp amps -- a quick review Digital-to-analog conversions Analog-to-digital conversions Reading: Text,
Analog to Digital Conversion. Introduction  An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts continuous signals to discrete.
Analog to Digital Conversion. 12 bit vs 16 bit A/D Card Input Volts = A/D 12 bit 2 12 = Volts = Volts = 2048 −10 Volts = 0 Input Volts.
Shuvra Das University of Detroit Mercy
Lecture 9: D/A and A/D Converters
What is ADC ? Types of ADCs HC11 & ADC Analog to Digital Converter Denis BISSIERES Ian CAMPBELL Yohan LESPERAT Mechatronics - Fall 04.
Analogue to Digital Conversion
68HC11 Analog I/O Chapter 12.
Interfacing Analog and Digital Circuits
Interfacing with the Analog World Wen-Hung Liao, Ph.D.
Analogue to Digital Conversion
Introduction to Data Conversion
Discussion #25 – ADCECEN 3011 Conversion Mosiah 5:2 2 And they all cried with one voice, saying: Yea, we believe all the words which though has spoken.
Analog to Digital Converters (ADC)
ADC STUDENT LECTURE Andrew Brown Jonathan Warner Laura Strickland.
EET260: A/D and D/A converters
H. Huang Transparency No.11-1 The 68HC11 Microcontroller Chapter 11: 68HC11 Analog to Digital Converter The 68HC11 Microcontroller Han-Way Huang Minnesota.
PH4705/ET4305: A/D: Analogue to Digital Conversion
Data Acquisition. Data Acquisition System Analog Signal Signal Conditioner ADC Digital Processing Communication.
Digital to Analog and Analog to Digital Conversion
Week #7 Data Acquisition System, Part (A)
11 Lecture Slides ME 3222 Kinematics and Control Lab Lab 2 AD DA and Sampling Theory By Dr. Debao Zhou.
Computer Based Data Acquisition Basics. Outline Basics of data acquisition Analog to Digital Conversion –Quantization –Aliasing.
ACOE2551 Microprocessors Data Converters Analog to Digital Converters (ADC) –Convert an analog quantity (voltage, current) into a digital code Digital.
1 4-Integrating Peripherals in Embedded Systems (cont.)
Analog to Digital Converters (ADC) 1
Digital to Analogue Converter
Data Acquisition Systems
ELN5622 Embedded Systems Class 7 Spring, 2003 Aaron Itskovich
ISAT 300 Computer-Based Instrumentation (part 2) Sampling and A/D Converters 11/14/01.
Revised: Aug 1, ECE 263 Embedded System Design Lessons HC12 Analog-to-Digital (ATD) Converter System.
High Speed Analog to Digital Converter
Analog-to-Digital and Digital-to-Analog Conversion
1 Data-Converter Circuits A/D and D/A Chapter 9 1.
Analog/Digital Conversion
Data Acquisition System
ECE 2799 Electrical and Computer Engineering Design ANALOG to DIGITAL CONVERSION Prof. Bitar Last Update:
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
1 What is Multimedia? Multimedia can have a many definitions Multimedia means that computer information can be represented through media types: – Text.
ECE 447: Lecture 2 Internal Input/Output Devices A/D Converter.
0808/0809 ADC. Block Diagram ADC ADC0808/ADC Bit μP Compatible A/D Converters with 8-Channel Multiplexer The 8-bit A/D converter uses successive.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Introduction to Data Conversion EE174 – SJSU Tan Nguyen.
Electronic instrumentation Digitization of Analog Signal in TD
EKT 314/4 WEEK 9 : CHAPTER 4 DATA ACQUISITION AND CONVERSION ELECTRONIC INSTRUMENTATION.
Digital Logic & Design Dr. Waseem Ikram Lecture 45.
Digital to analog converter [DAC]
MECH 373 Instrumentation and Measurements
EI205 Lecture 13 Dianguang Ma Fall 2008.
Signal conditioning.
Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems.
Digital Acquisition of Analog Signals – A Practical Guide
Soutenance de thèse vendredi 24 novembre 2006, Lorient
لجنة الهندسة الكهربائية
Lesson 8: Analog Signal Conversion
Conversation between Analogue and Digital System
Chapter 7 Converters.
 Both data about the physical world and control signals sent to interact with the physical world are typically "analog" or continuously varying quantities.
Presentation transcript:

Analog Capture- Port E

Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC

Real world (lab) is analog V tt Computer (binary) is digital D/A Conversion ComputerDAC Computer DAC A/D Conversion V

Digital to Analog Conversion (DAC or D/A) 8 bits Computer A/D

Digital to Analog conversion involves transforming the computer’s binary output in 0’s and 1’s (1’s typically = 5.0 volts) into an analog representation of the binary data

D/A conversion can be as simple as a weighted resistor network 4 - bit DAC Converter Resistor values correspond to binary weights of the number D 3 D 2 D 1 D 0, i.e. 1/8, 1/4, 1/2, and 1 Using EWB we can model this device

Analog-to Digital Conversion (ADC or A/D) A/D 8 bits Computer

An ideal A/D converter takes an input analog voltage and converts it to a perfectly linear digital representation of the analog signal If you are using an 8-bit converter, the binary representation is 8-bit binary number which can take on 2 8 or 256 different values. If your voltage range were volts, then 0 VOLTS VOLTS

Voltage (Volts) Analog Voltage LSB

Number of Bits (N)Resolution (1/2 N ) Increment (mV) for 5 volts 61/ / / / / /

Analog signals Analog output is typical of most transducers and sensors. Need to convert these analog signals into a digital representation so the microcontroller can use it. Some characteristics of analog signals. –Maximum and minimum voltages –Precise continuous signals –Rate of voltage change –Frequency if not a steady state signal 12/22/2015 ECE265 11

Analog  Digital Conversion 2-Step Process: Quantizing - breaking down analog value is a set of finite states Encoding - assigning a digital word or number to each state and matching it to the input signal

Step 1: Quantizing Example: You have 0-10V signals. Separate them into a set of discrete states with 1.25V increments. (How did we get 1.25V? See next slide…) Output States Discrete Voltage Ranges (V)

Quantizing The number of possible states that the converter can output is: N=2 n where n is the number of bits in the AD converter Example: For a 3 bit A/D converter, N=2 3 =8. Analog quantization size: Q=(V max -V min )/N = (10V – 0V)/8 = 1.25V

Encoding Here we assign the digital value (binary number) to each state for the computer to read. Output States Output Binary Equivalent

Accuracy of A/D Conversion There are two ways to best improve accuracy of A/D conversion: increasing the resolution which improves the accuracy in measuring the amplitude of the analog signal. increasing the sampling rate which increases the maximum frequency that can be measured.

Resolution Resolution (number of discrete values the converter can produce) = Analog Quantization size (Q) (Q) = Vrange / 2^n, where Vrange is the range of analog voltages which can be represented In our previous example: Q = 1.25V, this is a high resolution. A lower resolution would be if we used a 2-bit converter, then the resolution would be 10/2^2 = 2.50V.

Sampling Rate Frequency at which ADC evaluates analog signal. As we see in the second picture, evaluating the signal more often more accurately depicts the ADC signal.

Aliasing Occurs when the input signal is changing much faster than the sample rate. For example, a 2 kHz sine wave being sampled at 1.5 kHz would be reconstructed as a 500 Hz (the aliased signal) sine wave. Nyquist Rule: Use a sampling frequency at least twice as high as the maximum frequency in the signal to avoid aliasing.

Overall Better Accuracy Increasing both the sampling rate and the resolution you can obtain better accuracy in your AD signals.

ADC Flow Diagram in HC11 8 channel/bit input V RL = 0 volts V RH = 5 volts Digital input on PE Port E (analog input) Pin: Analog Multiplexer A/D Converter Result Register Interface ADR1 - result 1 ADR2 - result 2 ADR3 - result 3 ADR4 - result 4

Port E and ADR addresses When using Port E as a digital port the port is accessed through address $100A The A/D control register, ADCTL, is at address $1030 The ADR registers are at addresses – these are read only registers. –ADR1 - $1031 –ADR2 - $1032 –ADR3 - $1033 –ADR4 - $ /22/2015 ECE265 23

PE0 AN0 PE1 AN1 PE2 AN2 PE3 AN3 PE4 AN4 PE5 AN5 PE6 AN6 PE7 AN7 ANALOG MUX 8-bits CAPACITIVE DAC WITH SAMPLE AND HOLD SUCCESSIVE APPROXIMATION REGISTER AND CONTROL V RH V RL RESULT REGISTER INTERFACE ADR1ADR2ADR3ADR4 ADCTL A/D CONTROL CCF SCAN MULT CDCCCBCA INTERNAL DATA BUS P 64 M68HC11 Family Data Sheet Stuctural Diagram of ADC on HC11

Output StatesDiscretized Voltage Range Binary Coded Equivalent mV $ mV $ mV $02 …… … V $FF HC11 => 8 bits => 2 8 = 256 HC11 accepts 0 – 5V range Voltage Range = (V RH – V RL )/255 * State

ADCTL register To use the A/D converter on the 68HC11 the users only needs to write to ADCTL for the CPU to read results from the register. There are 8 A/D channels but only 4 results from one of the two groups of 4 can be stored at any one time. –Could also use the 4 registers to save 4 conversions from one input pin ADCTL register – controls how the A/D converter works and how the registers are used. 26

00000 Bit: CCF |No Op| SCAN |MULT | CD | CC | CB | CA CCF: (1) after conversion cycle, (0) when written to. SCAN: Continuous (1) or Not (0) MULT: Multi-Channel (1) or Single Channel (0) 0 = Single Channel is read 4 times CD:CC:CB:CA = 0000 – 0111 Chooses input channel Chooses Channel Group when MULT = ADCTL Register $ Read

Control register continued Bit 7 – is set when the A/D conversion is completed. Writing to ADCTL will clear the bit. Bit 6 – unused Bit 5 – SCAN –Value of 0 – single conversion mode – conversion takes place after a write to the register. –Value of 1 – continuous conversion mode Bit 4 – Multiple/Single Channel Control (MULT) –Value of 0 – Single channel – Consecutive conversions results are stored in consecutive ADRx registers ( single channel converted four consecutive times. –The converted value will be copied in –Value of 1 – each pin in the group is converted and the result stored in the ADR register. The CC control bit determines which group of four channels will be converted. Four sequential channels will be converted one time. 28

Control register continued Bit 3- CD is always clear during normal operation. Bit 2– CC When MULT =1 will select the upper or lower group of eight analog input channels; set = upper group (channels 5-8), clear = Lower group (Channel 1-4). When MULT = 0 CC,CB and CA determine which channel will be converted. (Table 11.10) Bit 1, 0- CB and CA will be ignored when MULT =1.

More on control register The MULT bit says. 1 channel or all 4 Table lists specific group. and pin(s) 30

Example of interface setup What configuration is needed in the ADCTL register for the A/D to convert continuously group 0? Solution: Bits 7 and 6 are don’t cares Bit 5 = 1 convert continuously Bit 4 = 1 group of 4 channels Bits 3 and 2 = 00 group 0, PE0-3 Bits 1 and 0 are not used. Value of xx11 00xx or could store $30 31

Setup example 2 What value needs to be written to the ADCTL register to have continuous conversions of pin PE0? What assembler language instructions would you use to set up this? Set ADCTL as follows: –Bits 7 and 6 – don’t cares –Bit 5 – 1 convert continuously val – –Bit 4 – 0 single channel –Bit 3,2,1,0 – 0000 the value for PE0 The assembler code (assumes A accumulator is free) – LDAA #$20 – STAA $

Example: Enable A/D, select PE0, continuous mode ORG $0200 LDX #$1000 BSET $39,X $80 ; Enable the A/D LDAA #$20; Continous scan, PE0 is selected STAA $30,X conBRA con If only PE0 is connected you will get the converted data in locations $1031-$1034.

Example: Enable A/D, select Group 0 (Channels 1-4), continuous mode ORG $0200 LDX #$1000 BSET $39,X $80 ; Enable the A/D LDAA #$30; continous scan, group 0 is selected STAA $30,X conBRA con If only PE0 is connected you will get the converted data in location $1031.

Options Register $ Bit: ADPU |CSEL | IRQE |DLY | CME | NoOp| CR1 | CR0 ADPU: 0 in this bit disable the A/D, 1 will enable the A/D. CSEL: use internal system clock (1), use E-clock (0) -1

Analog to Digital Results Register: $ $ Bit: ADR2 ($1032) Register $1032 = $02 Options Register ($1039) = $80 ADCTL Register ($1030) = $00 Just read in signal between 19.2 – 39.0 mV on pin E1!