ECE 354 Computer Systems Lab II

Slides:



Advertisements
Similar presentations
Analog to digital converter
Advertisements

Jordan Barry Victor Brzeski
Sensors Interfacing.
ECT 357 Ch 16 Output Control. Today’s Quote: The measure of a man is not how great his faith is bt how great his love is. The measure of a man is not.
Data Acquisition ET 228 Chapter
4-Integrating Peripherals in Embedded Systems (cont.)
Data acquisition and manipulation
Explain the introduction to ADC, ADC characteristics, Programming ADC using PIC18, Introduction to DAC and DAC interfacing with PIC18.
Introduction of Holtek HT-46 series MCU
ECT 357 Ch 10 Analog to Digital COnversion. Today’s Quote: It’s better to die with a good name than to live with a bad one. It’s better to die with a.
COMP3221: Microprocessors and Embedded Systems Lecture 20: Analog Output Lecturer: Hui Wu Session 2, 2004.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
In this PPT, all the materials covered up for the PIC microcontroller set-up would be studied. Preliminary skills: Knowing of basic C grammar and basic.
V 0.21 Timers A timer on a  C is simply a counter The input clock frequency to a timer can be prescaled so that it is some fraction of the system clock.
1 4-Integrating Peripherals in Embedded Systems (cont.)
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Digital to Analogue Converter
ELN5622 Embedded Systems Class 7 Spring, 2003 Aaron Itskovich
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
Other Chapters From the text by Valvano: Introduction to Embedded Systems: Interfacing to the Freescale 9S12.
Microprocessoren lesson 6. PWM /motor control/servo.
Data Acquisition ET 228 Chapter 15 Subjects Covered Analog to Digital Converter Characteristics Integrating ADCs Successive Approximation ADCs Flash ADCs.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
CS224 I/O. Timers Timer1 is 16-bit timer 2^16-1 or 65,535 SYSCLK = 40MHz, Prescalers – 1:1, 1:8, 1:64, and 1:256 – Use T1CONbits.TCKPS=3 for 1:256 scaling.
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
Microcontroller Applications ELEC 421 Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Chapter 11 Data Acquisition and Manipulation The aims of this chapter are to introduce: the main features of a data acquisition system; the characteristics.
Lab 3: ADC.
ECE 2799 Electrical and Computer Engineering Design ANALOG to DIGITAL CONVERSION Prof. Bitar Last Update:
D ATA A CQUISITION AND M ANIPULATION. A NALOG V S. D IGITAL Q UANTITIES 2.
ECE 101 Exploring Electrical Engineering Chapter 7 Data Acquisition Herbert G. Mayer, PSU Status 11/30/2015 Derived with permission from PSU Prof. Phillip.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Application Case Study Christmas Lights Controller
MECH 373 Instrumentation and Measurements
Why are Timer Functions Important?
Chip Config & Drivers – Required Drivers:
Digital Control CSE 421.
Application Case Study Security Camera Controller
Serial mode of data transfer
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
The 8085 Microprocessor Architecture
Microcontroller Applications
EI205 Lecture 13 Dianguang Ma Fall 2008.
Chapter 13 Linear-Digital ICs
Fri. Oct 13 Announcements Lab practical next week
AVR Addressing Modes Subject: Microcontoller & Interfacing
ECE-L304 Lecture 3.
Chapter 8 Data Acquisition
Introduction to Microprocessors and Microcontrollers
Interfacing Memory Interfacing.
Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems.
Simple ADC structures.
Final Exam Review Department of Electrical and Computer Engineering
Digital Control Systems Waseem Gulsher
PIC18F458 Analog-to-Digital
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.
CSCI1600: Embedded and Real Time Software
ADC and DAC Programming in AVR
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
ADC and DAC Data Converter
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Device Drivers – Digital Voltmeter
Robotics System Lecture 11_12: DC Motor
CSCI1600: Embedded and Real Time Software
ADC and DAC Data Converter
PIC Microcontroller ADC interfacing Prof. Ashvini Kulkarni
Presentation transcript:

ECE 354 Computer Systems Lab II Lab 4: D/A and A/D Conversion Exam Review

Status Lab 2 reports graded and returned. All grades will be on WebCT shortly Lab 3 Nice job! See comments on next slide Reports due Monday at 5pm Lab 4 WebCT Quiz April 25-27 Demo May 2-3 Exam : Wed April 27, Marston 132, 2:30-4, closed book Covering Lectures/Labs 1,2,3. Review slides and readings. Practice Exam emailed out today

Comments on Lab 3 Use terminology correctly!! FSM design virtual memory, memory map, memory control signals, strobe, ack, random, error, short, burned chip, code, rotate FSM design State diagram VHDL style User interface, error checking Memory testing Faults, Why PLD? Why Tri-state buffer? PIC software engineering Debug methodology

Lab 4 Overview Analog communication between two PICs Uses A/D and D/A Basic functionality Enter character on terminal 1st PIC converts character to analog voltage Analog value transmitted via wire to 2nd PIC 2nd PIC converts voltage back to digital character 2nd PIC displays character on terminal Configurable: PIC sends or receives, how many characters (voltage levels) are allowed

Why Analog? Not everything is digital! And even digital signaling has analog aspects (!?) Analog circuits and analysis are still necessary Physical phenomena (ie the real world) are usually analog Many sensors are analog (potentiometer, phototransistor, thermo-sensor, microphone) Many actuators are analog (solenoid, speakers) Some signals need to be processed in analog domain before conversion to digital (amplification, filtering, linearization) Requires conversion between analog and digital domain DAC: digital to analog converter ADC: analog to digital converter PIC has both

Digital and Analog Conversion ADC transfer function: 10-bit ADC converter 1024 voltage levels between 0V and VREF 10-bit digital value Usually VDD=VREF How does D/A and A/D conversion work?

D/A Conversion How can a digital “value” be converted into a corresponding analog voltage?

D/A Conversion Need to generate analog voltage that corresponds to 10-bit digital value PIC uses Pulse Width Modulation (PWM) PWM: Use square wave generator Period and duty cycle adjustable Use low-pass filter to “smooth out” wave DC value depends on length of duty cycle Shorter period (higher frequency) gives better results PIC Period and duty cycle set through registers

Pulse Width Modulation

PWM on PIC Registers involved: Basic operation: PR2 register: PWM period CCPR1L and CCP1CON<5:4>: 10-bit duty cycle Basic operation: Start of period Timer TMR2 cleared CCP1 pin set to high 10-bit duty cycle latched to CCPR1H When TMR2 = CCPR1H Clear CCP1 (duty cycle over) When TMR2 = PR2 New period starts

CCP1CON Register

Timer 2 Prescaler Prescaler determines effective clock rate for TMR2 Postscaler irrelevant for us Used if Timer 2 needs to drive additional component at different frequency PMW period formula:

PWM Setup Setup steps: Example for 20 MHz clock: Set PWM period by writing to PR2 register Set PWM duty cycle by writing to CCPR1L register and CCP1CON<5:4> bits Make CCP1 pin output by clearing the TRISC<2> bit Set TMR2 prescale value Enable Timer 2 by writing to TCON2 Configure the CCP1 module for PWM operation Example for 20 MHz clock:

A/D Conversion How can we generate digital value of analog voltage?

A/D Conversion Use D/A converter to generate different analog values and compare Control logic decides which values to try When comparison complete, best match is put on output How can D/A be matched to input in fewest steps?

Successive Approximation Matching strategies: Counting conversion (slow) Successive approximation (faster) Successive Approximation: Basically binary search: 10 steps instead of 1024

PIC ADC Characteristics (1) “Sample and Hold” ADC samples for a given time (charges hold capacitor) Then sample value is disconnected from source (“hold”) A/D conversion is performed On completion, ADC can sample again Sampling takes some time Depends on source impedance (max 10 kΩ) Lower source impedance reduces sample time because hold capacitance charges faster (see Peatman Figure 10-5(b)) Also depends on temperature, etc.

PIC ADC Characteristics (2) Analog input model and acquisition time formula:

ADCON0 Register ADC enable (bit 0) Busy/idle (conversion takes some time): Bit 2 in ADCON0 register Check by polling or enable interrupt Channel selection (bits 5-3): Selects pins to be used Selects external or internal reference voltage A/D conversion clock setting (bits 7-6)

Channel Selection

A/D Conversion Clock Setting Time to convert 1 bit must be ≥ 1.6 μs Clock setting must be adjusted to external clock

ADCON1 Register Port configuration (bits 3-0) Chooses pins to be digital I/O or analog input (see data sheet) Result Format Selection (bit 7) Chooses justification of 10-bit conversion result:

ADC Setup Configure A/D module: Configure A/D interrupt (if desired): Configure analog pins/voltage reference and digital I/O (ADCON1) Select A/D input channel (ADCON0) Select A/D conversion clock (ADCON0) Turn on A/D module (ADCON0) Configure A/D interrupt (if desired): Clear ADIF bit Set ADIE bit Set PEIE bit Set GIE bit Wait required acquisition time Start conversion Set GO/_DONE bit (ADCON0) Wait for A/D conversion to complete (polling or interrupt) Read A/D result from (ADRESH:ADRESL) and clear ADIF bit Goto 1. or 2. wait 2 A/D clock ticks

Reference PWM (D/A conversion) A/D conversion PIC data sheet pp. 61-62 Peatman Section 6.9 (pp. 112-119) A/D conversion PIC data sheet pp. 111-116 Peatman Chapter 10

Lab 4 Lab setup: Send characters coded in analog between terminals 2 PICs (available in lab kit) Need 2 terminals Send characters coded in analog between terminals Low pass filter needs to be adapted to PWM settings

Signal Discretization We use adaptable signal coding Choose between 2x (x={1,2,..6}) symbols: Robustness depends on x: Most robust: only two characters and two voltages 512 ADC results can represent one character Most information: 64 characters and voltage ranges 16 ADC results can represent one character

Lab 4 Demo Each PIC can be used for transmitting or receiving User can specify function after reset User also specifies coding level (1..6) Same on both PICs Requires well-designed ASCII manipulation When character is entered on terminal PIC 1 receives character Converts it to analog signal PIC 2 received analog signal Converts it to digital value Prints result on terminal Should be robust for low coding levels

Exam Review See last year’s exam solutions emailed out today… Topics: PIC Architecture Interrupts Serial communication Timers Assembly