Lecture 16: Digital to Analog Converter - PWM Implementation

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Advertisements

The 8051 Microcontroller and Embedded Systems
Pulse Width Modulation and Motor Control
Chung-Ta King National Tsing Hua University
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
Announcements Assignment 8 posted –Due Friday Dec 2 nd. A bit longer than others. Project progress? Dates –Thursday 12/1 review lecture –Tuesday 12/6 project.
0 - 1 © 2007 Texas Instruments Inc, Content developed in partnership with Tel-Aviv University From MATLAB ® and Simulink ® to Real Time with TI DSPs Class-D.
Introduction of Holtek HT-46 series MCU
Magnetic Manipulator Team 125. Chad Perkins (Spring Team Lead) John Olennikov(Web Master) Ben Younce Marley Rutkowski(Fall Team Lead) Professor Robert.
EET260: A/D and D/A converters
IO in Embedded Systems Martin Schöberl. Embedded IO2 Overview Input/Output Digital, Analog Translation Heater control example.
COMP3221: Microprocessors and Embedded Systems Lecture 20: Analog Output Lecturer: Hui Wu Session 2, 2004.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Digital to Analog Converters
Chung-Ta King National Tsing Hua University
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Group member: Zhaoxin Mamengduo Cfang Stanley The Implementation of Delta-Sigma Modulation in Digital-to-Analog Converter 1.
T IMERS - 2. O UTPUT U NIT Each capture/compare block contains an output unit. The output unit is used to generate output signals such as PWM signals.
Lecture 18: ADC Implementation Lecturers: Professor John Devlin.
CHAPTER TIMER PROGRAMMING Timers The 8051 has two timers/counters, they can be used as ◦ Timers to generate a time delay ◦ Event counters.
8254 Programmable Interval Timer
ENEE 440 Chapter Timer 8254 Register Select The 8254 timer is actually 3 timers in one. It is an upgraded version of the 8253 timer which was.
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Chapter 13 Linear-Digital ICs. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. Electronic Devices.
Lecture 29: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM)
ARM Timers.
MSP430 Mixed Signal Microcontroller – Parte 2 Afonso Ferreira Miguel Source: slau056d – Texas instruments.
DLS Digital Controller Tony Dobbing Head of Power Supplies Group.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Lecture 11: TI MSP430 Timers Compare Modes
Lecture 15: Digital to Analog Converters Lecturers: Professor John Devlin Mr Robert Ross.
Lecturers: Professor John Devlin Mr Robert Ross
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Module Introduction Purpose  This training module provides an overview of the analog interfaces.
TI MSP430 MICROCONTROLLERS BY ADITYA PATHAK. THE MSP FAMILY Ultra-low power; mixed signal processors Widely used in battery operated applications Uses.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the Digital-to-Analog.
Projects 8051.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the PWM type Digital-to-Analog.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
CSCI1600: Embedded and Real Time Software Lecture 14: Input/Output II Steven Reiss, Fall 2015.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Interfacing Data Converters. D/A converters Design an O/P port with the address FFh to interface the 1408 D/A converter that is calibrated for 0 to 10V.
Timer 1 and 2 operation, PWM Principles. Timer 1 Operation.
Seth Schwiethale James Crosetto James Ellison.  square pulse of ms, repeats every 20 ms  It is the same for both steering and acceleration 
Closed Loop Temperature Control Circuit with LCD Display Mike Wooldridge ECE 4330 Embedded Systems.
Electronic Devices and Circuit Theory
Why are Timer Functions Important?
Clock Signals: 555 Timer 555 Timer Digital Electronics TM
Timers and Event Counters
ECE 3430 – Intro to Microcomputer Systems
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
Revision2 for CENG34340 (Self study exercise no need to submit)
Chapter 13 Linear-Digital ICs
Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing
ECE 3430 – Intro to Microcomputer Systems
Digital Communication
Programmable Interval Timer
AVR Addressing Modes Subject: Microcontoller & Interfacing
Oct 30 Announcements Code Marked and on Blackboard
Oct 30 Announcements Code Marked and on Blackboard
555 Timer 555 Timer Digital Electronics TM 1.2 Introduction to Analog
EECS 373: Design of Microprocessor-Based Systems
TK2633: MICROPROCESSOR & INTERFACING
555 Timer 555 Timer Digital Electronics TM 1.2 Introduction to Analog
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Mark Bristow CENBD 452 Fall 2002
Prof. Chung-Ta King Department of Computer Science
MSP430 Clock System and Timer
Presentation transcript:

Lecture 16: Digital to Analog Converter - PWM Implementation Lecturers: Professor John Devlin Mr Robert Ross

Overview Implementation of a DAC using PWM Class Demonstration Worked example – Software Loops Worked example – Timer Based

DAC PWM Implementation Choose an operating frequency (this specifies the period of the DAC) Create a filter circuit to operate at the desired frequency Write software to vary on/off time When on – drive output high When off – drive output low

PWM software loop implementation PWM can be generated in software simply by using loops This is generally bad design (timers use less CPU resources and are more accurate) A useful stepping stone to understanding DAC’s

PWM software loop implementation MOV #100, R5 ; Period MOV #50, R6 ; ON Time setup MOV #0, R7 ; Comparison register BIS.b #000000001b, &P1OUT ; bit 1 = high on_time INC R7 CMP R6,R7 ; has on time expired JNE on_time BIC.b #00000001b, &P1OUT ;on time expired, bit 1 = low off_time CMP R5, R7 ; has off time expired JNE off_time JMP setup ; off time has expired

Timer based PWM implementation Timers can be used to perform PWM with less CPU overhead – allowing processing for other tasks Design the following PWM timer: Period = 16.38ms F = 61kHz OFF Time climbs from 0 to 16.38ms and repeats from 0 Timers will be covered in detail in lecture 19

Timer based PWM implementation SetupP1 BIS.B #0x0f,&P1DIR ; Set P1.0-P1.7 as outputs BIS.B #00010100b,&P1SEL ; P1.2 and P1.4 TA/SMCLK options SetupP2 BIS.B #11000000b,&P2DIR ; Set P2.6 and P2.7 as outputs Set_clock ; Set to calibrated 1MHz Clock MOV.B &CALBC1_1MHZ,&BCSCTL1 ; Set range; DCO = 1 MHz MOV.B &CALDCO_1MHZ,&DCOCTL ; Set DCO step + modulation setup_timer MOV.W #02000h,&TACCR0 ; CCR0 = PWM Period/2 MOV.W #0,&TACCR1 ; CCR1 = PWM_OFF_Time/2 MOV.W #00C0h,&TACCTL1 ; Output=Toggle/Set MOV.W #0230h, &TACTL ; CLK = SMCLK(1MHz), MODE = ; UP/DOWN

Timer based PWM implementation MOV.W #0, R5 ; Initialise OFF_Time reset_countdown MOV.W #0FFh, R4 ; Initialise countdown main DEC R4 ; Decrement countdown JNZ main ; If countdown != 0, loop INC R5 ; Increment the OFF_time CMP &TACCR0, R5 ; Does OFF_Time = Period? JEQ reset_r5 ; If OFF_Time = Period, jump MOV.W R5,&TACCR1 ; Load OFF_Time into register JMP reset_countdown ; Loop again reset_r5 MOV.W #0, R5 ; Reset OFF time

Circuit Diagram Add a low pass filter to reduce switching noise and return an analog signal C should be small – otherwise DAC response will be low MSP430 R = 330k Analog Signal P1.2 C=100nF

Class Demonstration – Timer PWM Without filtering circuitry With filtering circuitry:

Summary Digital to Analog converters allow digital electronics to output signals which are similar to real world continuous signals Pulse Width Modulation is a simple and widely used form of DAC