EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.
Advertisements

Interfacing to the Analog World
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Analog-to-Digital Converter (ADC) And
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC)  Read.  Homework #13 and Lab #13 due next week. 
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
EET 252 Unit 6 Analog-to-Digital Conversion
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
Presented by- Md. Bashir Uddin Roll: Dept. of BME KUET, Khulna-9203.
Module 4: Analog programming blocks. Module Objectives Analyze a control task that uses analog inputs. Connect a potentiometer to LOGO! controller and.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Unit 4 Sensors and Actuators
Explain the introduction to ADC, ADC characteristics, Programming ADC using PIC18, Introduction to DAC and DAC interfacing with PIC18.
Storey: Electrical & Electronic Systems © Pearson Education Limited 2004 OHT 26.1 Data Acquisition and Conversion  Introduction  Sampling  Signal Reconstruction.
Introduction to Data Conversion
EET 252 Unit 7 Digital-to-Analog Conversion
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 12 Data Acquisition  Read Bishop, Chapter 8.  Lab #12 and Homework #12 due next week.
Digital I/O Connecting to the Outside World
Representing Sound in a computer Analogue  Analogue sound is produced by being picked up by a transducer (microphone) and converted in an electrical current.
11 Lecture Slides ME 3222 Kinematics and Control Lab Lab 2 AD DA and Sampling Theory By Dr. Debao Zhou.
Digital to Analog Converters (DAC) 1
Data Converters ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Module 4: Analog programming blocks. Module Objectives Analyze a control task that uses analog inputs. Connect a potentiometer to LOGO! controller and.
ACOE2551 Microprocessors Data Converters Analog to Digital Converters (ADC) –Convert an analog quantity (voltage, current) into a digital code Digital.
©2008 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected under all copyright laws as they currently exist.
Digital to Analogue Converter
Data Acquisition Systems
Instrumentation Overview Spring 2012 The laboratory is a controlled environment where we can measure isolated physical phenomena with a view to eventual.
Representing Numerical Data Analog Any signal that varies continuously over time Mechanical Pneumatic Hydraulic Electrical Digital Quantities are represented.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
CHAPTER 19 Data Conversion. Objectives Describe and Analyze: Analog vs. Digital Signals Resolution Digital-to-Analog Conversion Analog-to Digital Conversion.
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon.
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
Digital-to-Analog Analog-to-Digital Week 10. Data Handling Systems  Both data about the physical world and control signals sent to interact with the.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
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.
ECE 101 Exploring Electrical Engineering Chapter 7 Data Acquisition Herbert G. Mayer, PSU Status 11/30/2015 Derived with permission from PSU Prof. Phillip.
Electronic instrumentation Digitization of Analog Signal in TD
EKT 314/4 WEEK 9 : CHAPTER 4 DATA ACQUISITION AND CONVERSION ELECTRONIC INSTRUMENTATION.
Lecture Notes / PPT UNIT III
Unit 1 Introduction Number Systems and Conversion.
MECH 373 Instrumentation and Measurements
Microprocessors Data Converters Analog to Digital Converters (ADC)
Computer Architecture and Number Systems
EET 2259 Unit 12 Data Acquisition
Digital-to-Analog Analog-to-Digital
Floating Point Math & Representation
EI205 Lecture 13 Dianguang Ma Fall 2008.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Arduino - Introduction
Signal conditioning.
Digital-to-Analog Analog-to-Digital
EET 2261 Unit 11 Controlling LCD and Keypad
Digital Control Systems Waseem Gulsher
EET 2259 Unit 12 Data Acquisition
EET 2261 Unit 11 Controlling LCD and Keypad
ECE 354 Computer Systems Lab II
PIC18F458 Analog-to-Digital
Conversation between Analogue and Digital System
Digital Systems and Binary Numbers
ADC and DAC Data Converter
Data Acquisition (DAQ)
Programming the BASIC Stamp
Lecture 2: Number Systems
UNIT 5 Analog signals.
Chapter 7 Converters.
PIC Analog Input Tom Igoe, NYU-ITP
ADC and DAC Data Converter
 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:

EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz next week.

Analog Quantities Most physical quantities (temperature, pressure, light intensity, etc.) are analog quantities. Transducers are devices that convert one of these physical quantities to an analog voltage or current. Example, a temperature sensor might produce a voltage in mV that is proportional to the temperature in degrees Fahrenheit.

Interfacing to the Analog World Before a microprocessor can work on analog information, we must first use an analog-to-digital converter (ADC) to transform the analog values into digital binary values. Conversely, we use a digital-to-analog converter (DAC) to transform digital values from the microprocessor into analog values that can be used to control analog devices. See Chapter 12 of Floyd’s Digital Electronics for details on ADCs and DACs.

A Typical Application . . Digital inputs Digital outputs Analog input (voltage or current) Analog output (voltage or current) ADC Micro- processor DAC . . Control physical variable Physical variable Transducer Actuator Students who have taken EET 159: don’t confuse DAC with DAQ. But the DAQ cards in room 1230 contain DACs and ADCs.

Number of Bits and Accuracy The ADC periodically samples the analog signal, and converts each sampled value of the analog signal into a binary code. The more bits that are used in this code, the more accurate is the representation of the original signal. The following slides (from Floyd’s Chapter 12) show an example of how using 2 bits results in much less accuracy than using 4 bits.

Figure 12. 8 Light gray = original waveform Figure 12.8 Light gray = original waveform. Blue = Reconstructed waveform using four quantization levels (2 bits).

Figure 12. 10 Light gray = original waveform Figure 12.10 Light gray = original waveform. Blue = Reconstructed waveform using sixteen quantization levels (4 bits).

Resolution Several common ways of specifying an ADC’s resolution: Number of bits, n Number of output codes, = 2n, or number of steps in the output, = 2n − 1 Percentage resolution, = 1 / (2n − 1), expressed as a percentage Step size, = Vref / 2n

Resolution: Examples n 4 2n 16 2n−1 15 1 / (2n−1) 6.67% Vref / 2n Formula 4-bit ADC 10-bit ADC Number of bits n 4 Number of output codes 2n 16 Number of steps in the output 2n−1 15 Percentage resolution 1 / (2n−1) 6.67% Step size (assuming 5 V reference voltage) Vref / 2n 312.5 mV

ADC Hardware Many analog-to-digital converter chips are available. Example: the ADC0804 is a popular 8-bit ADC chip. Our PIC chip has a built-in 10-bit ADC.

The PIC Chip’s Analog Inputs Seven of the PIC chip’s pins (labeled AN0 through AN7) can be configured as analog inputs to the chip’s internal ADC.

Configuring the Analog Inputs How do we tell the PIC chip whether we want to use these pins as analog inputs or as digital I/O? Example: How do we tell it whether we want pin 8 to act as AN5 or as bit 0 of PORT E?

Analog Inputs on the LAB-X1 On the LAB-X1 board, three of these pins (AN0, AN1, AN3) are permanently connected to the wipers on three potentiometers. By rotating a potentiometer, you vary the analog voltage present at one of these analog input pins.

New PICBASIC Commands & Operators in Lab #4 ADCIN command PAUSEUS command / operator // operator

ADCIN (p. 45 in PICBASIC manual) Tells the PIC chip to perform an analog-to-digital conversion using its built-in A/D converter, and then saves the result of this conversion. Example: ADCIN 0 result performs an A/D conversion on the voltage present at analog input 0, and stores the result in the variable named result. Don’t confuse the ADCIN command with ADCON0 and ADCON1, which are special function registers on the PIC chip.

PAUSEUS (p. 113 in PICBASIC manual) Recall that the PAUSE command inserts a time delay into your program. This delay is measured in milliseconds. Example: PAUSE 500 causes a 500 ms delay. The PAUSEUS command is very similar, but the delay is measured in microseconds instead of milliseconds. Example: PAUSEUS 500 causes a 500 s delay.

Integer Math Recall the difference between integers (such as 2 or 47 or 365) and floating-point numbers (such as 3.14 or 1.5 or 16.97). PICBASIC can only deal with integers, not floating-point numbers. All math operations give integer results. This requires us to play some tricks if we need to work with floating-point numbers.

Quotient and Remainder We know that 7÷2 = 3.5 Recall that another way to say this is that 7÷2 = 3 with a remainder of 1. In this example, 3 is called the quotient and 1 is called the remainder. Another example: If you take 20÷8, what is the quotient and what is the remainder? This is how we learned to do division before we were taught floating-point numbers (decimals). With microprocessors that can only do integer math, you have to regress to the way you thought about division in your early days.

/ Operator (p. 35 in PICBASIC manual) The / operator returns the quotient part of a division. Example: 7 / 2 in a PICBASIC program will return a result of 3.

// Operator (p. 35 in PICBASIC manual) The // operator returns the remainder part of a division (sometimes called the modulus). Example: 7 // 2 in a PICBASIC program will return a result of 1. By using both / and //, we can keep track of both the quotient and the remainder part of a division. Do this in a practice program, sending the quotient and the remainder out to the LEDs, separated by a 2-second pause.

Integer Math in Lab #4 Look at program called A-D Conversion3.pbp Recall that for a 10-bit A/D conversion using a reference voltage of 5 V, the step voltage is about 4.9 mV. So to find the voltage (in mV) corresponding to an A/D result, we need to multiply by 4.9. But since PICBASIC can only handle integers, it can’t handle 4.9. So instead, we multiply by 49 and then divide by 10. -First have them run A-D Conversion3.pbp again. -Example: if the A/D result is 437, then the voltage is about 2141 mV.

Integer Math in Lab #4 (Continued) Now that we have the voltage in mV, we want to print it on the LCD in V. Example: if the voltage = 2141 mV, then we want to print 2.141 V. To get the part before the decimal point, take 2141 / 1000. (This returns an answer of 2.) To get the part after the decimal point, take 2141 // 1000. (This returns an answer of 141.) Then print those two answers, separated by a decimal point: 2.141.

Another Application For another use of these integer math tricks, see these documents in the “Documents PIC” folder on the R: shared drive: “Convert Celsius to Fahrenheit using Integer Math.docx” “Convert Fahrenheit to Celsius using Integer Math.docx”