Timer 0 Modes of Operation. Normal Mode Clear Timer on Compare Match (CTC) Fast PWM Mode Phase Corrected PWM Mode

Size: px
Start display at page:

Download "Timer 0 Modes of Operation. Normal Mode Clear Timer on Compare Match (CTC) Fast PWM Mode Phase Corrected PWM Mode"

Transcription

1 Timer 0 Modes of Operation Normal Mode Clear Timer on Compare Match (CTC) Fast PWM Mode Phase Corrected PWM Mode

2 PWM - Introduction Recall: PWM = Pulse Width Modulation We will mostly use it for controlling motors PWM is used in MANY other applications! Standard PWM signal Frequency can vary!

3 PWM Servo control Standard servos require a 50Hz (20ms) signal Typically, a 1ms 2ms high pulse 1ms = CCW, 2ms = CW, 1.5ms = neutral

4 Generating a PWM signal One way to generate a PWM signal on a uc is to use interrupts and a timer Set up the timer to interrupt in deterministic intervals Write a digital high to an output port in the ISR Wait... Write a digital low to the same port in the ISR Wait... Repeat (possibly updating the timer count value in the ISR to change the duty cycle)

5 Generating a PWM signal What is wrong with doing this???

6 Generating a PWM signal What is wrong with doing this??? You have to interrupt several times to generate the signal You have to interrupt to change the signal duty cycle VERY inefficient!!!

7 Generating a PWM signal Is there any other way to generate these signals???

8 Generating a PWM signal Is there any other way to generate these signals??? Of course! Use the output compare modes within the timer's functionality We will discuss both methods used on Timer 0 Fast PWM Phase corrected PWM

9 Fast PWM High frequency operation Hence the name FAST PWM Uses a single-slope operation!

10 Fast PWM Functionality Counter is incremented until it reaches the TOP and then it's cleared When a match occurs on EITHER OCR0A/B the corresponding output compare pin is changed Changed according to the COM0A/B bits in TCCR0A

11 Fast PWM vs. CTC How is this different than CTC mode??? Recall: In CTC mode the TCNT value never reaches the TOP unless the value in OCR0A is 255! The counter is cleared on a match In Fast PWM mode, the counter is only cleared when the TOP is reached So what is TOP (depends on the mode) Determined by the WGM bits

12 Fast PWM vs. CTC How is this different than CTC mode??? Recall: In CTC mode the match value is only compared to OCR0A OCR0B is disabled! In Fast PWM mode, both OCR0A and B are used for corresponding comparisons (depending on the mode) This allows two different PWM signals to be generated from a single timer This allows three different PWM signals to be generated if using 16-bit timers

13 Fast PWM vs. CTC How is this different than CTC mode??? Recall: In CTC mode the match value can only be toggled when a match occurs Unless we play interrupt tricks with the value in OCR0A we can only generate a 50% duty cycle signal In Fast PWM mode, we can toggle, set, or clear the pin on match (as we will see) Since we don't clear the timer on a match, we can also generate PWM signals with different duty cycles Further, this allows us to generate inverted PWM signals

14 So, how do we use it? Depends on which mode we want to use! WGM = 3 or WGM = 7

15 What's the difference? WGM = 3 Standard operation Timer counts from 0x00 to 0xFF When a match occurs on OCR0A/B the OC0A/B pins are changed accordingly WGM = 7 The TOP (0xFF) value is set to the value in OCR0A As a result, OC0A is ALWAYS either high or low (depending on the COM bits) We can generate a desired frequency for OC0B by adjusting the value in OCR0A

16 Lets have a look at WGM = 3 We have to make a choice for the behavior of OC0A/B Set the COM0A/B 1:0 bits

17 What frequency does it operate at? Depends on the prescale value! Clock select bits in TCCR0B (1,8,64,256,1024) Recall the single slope operation: if operating in WGM=3 mode F_PWM = F_clk/(N*256) Prescale Frequency Period khz 16 us khz 128 us Hz ms Hz ms Hz ms

18 Servo control Looking at the frequencies and period of the signal, is it possible to control our servos using Timer 0 in Fast PWM mode??? Recall: We need a 50 Hz signal (20 ms period) Prescale Frequency Period khz 16 us khz 128 us Hz ms Hz ms Hz ms

19 DC Motor control Looking at the frequencies and period of the signal, is it possible to control standard DC Motors using Timer 0 in Fast PWM mode??? Recall: We need a duty cycle that ranges from 0%- 100% Prescale Frequency Period khz 16 us khz 128 us Hz ms Hz ms Hz ms

20 DC Motor control Answer: Yes! The frequency doesn't matter (sort-of) we just need to see how we control the duty cycle! Recall, we can set OCR0A/B to toggle, set, or clear on a match! We can change the values of OCR0A/B to change the duty cycle 64 = 25% duty cycle 128 = 50% duty cycle 192 = 75% duty cycle

21 Example!

22 Example!

23 Notes on the Example Two things to notice about our example We generate TWO different PWM signals on OC0A and OC0B OC0A changes from 0% - 100% -0% OC0B is a 75% duty cycle square wave We never have to interrupt to change the duty cycle We can write to OCR0A anytime This may cause glitches but shouldn't have any effect on your motor We can eliminate the glitches using one of the 16-bit timers or an RTOS

24 Fast PWM mode cont. So what about WGM = 7??? We will look at this option in phase corrected PWM mode The basic principles are the same

25 Phase corrected PWM mode Similar operation to Fast PWM mode Difference: Dual slope operation

26 WGM for Phase Corrected PWM Similar to Fast PWM we have two options to choose from WGM = 1 or WGM = 5

27 What's the difference??? In phase corrected PWM the timer counts from 0x00 to TOP then back down to 0x00 TOP is defined as 0xFF when WGM = 1 and the value in OCR0A when WGM = 5 Some important things to note: The timer does not overflow at the TOP but rather at the BOTTOM Depending on the COM0A/B bits and the WGM bits, OC0A/B is cleared when a match happens while up-counting and set when down-counting

28 COM bits Essentially the same as with Fast PWM In BOTH PWM modes, the DDR must be set to be an output on OC0A/B

29 So what frequencies do we have available? Again we need to look at the prescale value Since we have a dual-slope, we can compute the frequency of the PWM as: f_pwm = f_clk/(n*510) Prescale Frequency Period khz us khz 255 us Hz 2.04 ms Hz 8.16 ms Hz ms

30 Servo control Looking at the frequencies and period of the signal, is it possible to control our servos using Timer 0 in Phase Correct PWM mode??? Recall: We need a 50 Hz signal (20 ms period) Prescale Frequency Period khz us khz 255 us Hz 2.04 ms Hz 8.16 ms Hz ms

31 Yes!!! How??? Servo control

32 Servo control Yes!!! How??? We need to choose the correct prescale value Prescale Frequency Period khz us khz 255 us Hz 2.04 ms Hz 8.16 ms Hz ms

33 Servo control Yes!!! How??? We need to choose the correct prescale value Prescale Frequency Period khz us khz 255 us Hz 2.04 ms Hz 8.16 ms Hz ms Only one choice will work!!! (divide by 1024)

34 Servo control Using WGM = 1 and a prescale value of 1024 we get a 32 ms period signal Will this work for servo control???

35 Servo control Using WGM = 1 and a prescale value of 1024 we get a 32 ms period signal Will this work for servo control??? NO!!! We need a 20 ms period signal so standard operation is too long! Can we slow it down a bit??

36 Servo control Using WGM = 1 and a prescale value of 1024 we get a 32 ms period signal Will this work for servo control??? NO!!! We need a 20 ms period signal so standard operation is too long! Can we slow it down a bit?? YES!!! Use WGM = 5 and set OCR0A to a smaller value than 0xFF!!! Recall: It takes 32 ms to count from 0x00 to 0xFF back to 0x00

37 Servo control So how do we determine what value to use for OCR0A??? Recall: We have f_pwm = f_clk/(n*510) = f_clk/(2*n*255) This assumes we count from 0x00 to 0xFF but we want to stop at some OCR0A < 0xFF f_pwm = f_clk/(2*n*ocr0a) OR OCR0A = f_clk/(2*n*f_pwm)

38 Servo control For a 50 Hz PWM signal and prescale of 1024 OCR0A = 16 Mhz/(2*1024*50) = We can't have a.25 (8-bit integer value), so what is our true frequency??? Round down: OCR0A = 156 f_pwm = 16 Mhz/(1*1024*156) = Hz Which has a ms period (close enough!)

39 Servo control Recall: to control the servo we need a 20 ms period signal We have just calculated how to generate this! We also need the signal to be high from 1ms 2ms and low the rest! Hmmm. How do we go about doing this??? Think OCR0B!!!

40 Servo control Recall that we can use the OCR0B register to control the behavior of OC0B OCR0A is in use and therefore OC0A is always a constant!!!!! How do we compute what OCR0B needs to be??? The derivation is left as an exercise to YOU!!! OCR0B = f_clk * desired high pulse (in ms)/(2*n) This is for COMB set to clear on match up-counting (10)! Think about how you might change it for COMB = 11

41 Servo control Assuming we have COMB = 10 OCR0B = f_clk * desired high pulse (in ms)/(2*n) 1ms = 8 1.5ms = 12 2ms = 16

42 Example (servo control)

43 Example (servo control)

44 Some notes on the example Again, we can control the servos without the need to interrupt program flow!!! What's the issue with Timer 0 though??

45 Some notes on the example Again, we can control the servos without the need to interrupt program flow!!! What's the issue with Timer 0 though?? Too low of resolution!!! We only have four values to get us from full CCW to neutral Our servo control will be very course! How do we fix this???

46 Some notes on the example Again, we can control the servos without the need to interrupt program flow!!! What's the issue with Timer 0 though?? Too low of resolution!!! We only have four values to get us from full CCW to neutral Our servo control will be very course! How do we fix this??? Use the 16-bit timer Setting one up is left to you (LAB)

47 DC Motor control Looking at the frequencies and period of the signal, is it possible to control standard DC Motors using Timer 0 in Phase Correct PWM mode??? Recall: We need a duty cycle that ranges from 0%- 100% Prescale Frequency Period khz us khz 255 us Hz 2.04 ms Hz 8.16 ms Hz ms

48 DC Motor control Answer: Yes! The frequency doesn't matter (sort-of) we just need to see how we control the duty cycle! Recall, we can set OCR0A/B to toggle, set, or clear on a match! We can change the values of OCR0A/B to change the duty cycle similar to Fast PWM!!! This method is preferred to control motors since the phase is correct in this mode What do I mean by phase correct??? (draw figure)!!

ATmega16A Microcontroller

ATmega16A Microcontroller ATmega16A Microcontroller Timers 1 Timers Timer 0,1,2 8 bits or 16 bits Clock sources: Internal clock, Internal clock with prescaler, External clock (timer 2), Special input pin 2 Features The choice of

More information

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss Grundlagen Microcontroller Counter/Timer Günther Gridling Bettina Weiss 1 Counter/Timer Lecture Overview Counter Timer Prescaler Input Capture Output Compare PWM 2 important feature of microcontroller

More information

Timer/Counter with PWM

Timer/Counter with PWM Timer/Counter with PWM The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi ATMEL 8-bit AVR Microcontroller with 4/8/16/32K Bytes In-System

More information

L13: (25%), (20%), (5%) ECTE333

L13: (25%), (20%), (5%) ECTE333 ECTE333 s schedule ECTE333 Lecture 1 - Pulse Width Modulator School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia Week Lecture (2h) Tutorial (1h) Lab (2h)

More information

The Interface Communicate to DC motor control. Iu Retuerta Cornet

The Interface Communicate to DC motor control. Iu Retuerta Cornet The Interface Communicate to DC motor control Iu Retuerta Cornet Mälardalens University, IDT department Supervisor and examiner : Lars Asplund 26 th May 2010 Abstract Mälardalens University makes internationally

More information

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by A MORON'S GUIDE TO TIMER/COUNTERS v2.2 by RetroDan@GMail.com TABLE OF CONTENTS: 1. THE PAUSE ROUTINE 2. WAIT-FOR-TIMER "NORMAL" MODE 3. WAIT-FOR-TIMER "NORMAL" MODE (Modified) 4. THE TIMER-COMPARE METHOD

More information

ECED3204: Microprocessor Part IV--Timer Function

ECED3204: Microprocessor Part IV--Timer Function ECED3204: Microprocessor Part IV--Timer Function Jason J. Gu Department of 1 Outline i. Introduction to the Microcontroller Timer System ii. Overview of the Mega AVR Timer System iii. Timer Clock Source

More information

Counter/Timers in the Mega8

Counter/Timers in the Mega8 Counter/Timers in the Mega8 The mega8 incorporates three counter/timer devices. These can: Be used to count the number of events that have occurred (either external or internal) Act as a clock Trigger

More information

Chapter 6 PROGRAMMING THE TIMERS

Chapter 6 PROGRAMMING THE TIMERS Chapter 6 PROGRAMMING THE TIMERS Force Outputs on Outcompare Input Captures Programmabl e Prescaling Prescaling Internal clock inputs Timer-counter Device Free Running Outcompares Lesson 2 Free Running

More information

Design with Microprocessors

Design with Microprocessors Design with Microprocessors Year III Computer Science 1-st Semester Lecture 5: AVR timers Timers AVR timers 8 bit timers/counters 16 bit timers/counters Characteristics Input clock prescaler Read / write

More information

MICROCONTROLLER TUTORIAL II TIMERS

MICROCONTROLLER TUTORIAL II TIMERS MICROCONTROLLER TUTORIAL II TIMERS WHAT IS A TIMER? We use timers every day - the simplest one can be found on your wrist A simple clock will time the seconds, minutes and hours elapsed in a given day

More information

3DoT C++ Timer/Counter 4 with PWM

3DoT C++ Timer/Counter 4 with PWM 3DoT C++ Timer/Counter 4 with PWM This article is on the motor control section of the 3DoT board using Timer/Counter 4 operating in Fast PWM mode. The AVR Microcontroller and Embedded Systems using Assembly

More information

CSCI1600 Lab 4: Sound

CSCI1600 Lab 4: Sound CSCI1600 Lab 4: Sound November 1, 2017 1 Objectives By the end of this lab, you will: Connect a speaker and play a tone Use the speaker to play a simple melody Materials: We will be providing the parts

More information

Exercise 5: PWM and Control Theory

Exercise 5: PWM and Control Theory Exercise 5: PWM and Control Theory Overview In the previous sessions, we have seen how to use the input capture functionality of a microcontroller to capture external events. This functionality can also

More information

AVR PWM 11 Aug In the table below you have symbols used in the text. The meaning of symbols is the same in the entire guide.

AVR PWM 11 Aug In the table below you have symbols used in the text. The meaning of symbols is the same in the entire guide. Aquaticus PWM guide AVR PWM 11 Aug 29 Introduction This guide describes principles of PWM for Atmel AVR micro controllers. It is not complete documentation for PWM nor AVR timers but tries to lighten some

More information

CprE 288 Introduction to Embedded Systems (Output Compare and PWM) Instructors: Dr. Phillip Jones

CprE 288 Introduction to Embedded Systems (Output Compare and PWM) Instructors: Dr. Phillip Jones CprE 288 Introduction to Embedded Systems (Output Compare and PWM) Instructors: Dr. Phillip Jones 1 Announcements HW8: Due Sunday 10/29 (midnight) Exam 2: In class Thursday 11/9 This object detection lab

More information

Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot Controllers

Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot Controllers Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot 1. Introduction..................................................... 2 2. Motor Driver Truth Tables.............................................

More information

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs.

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs. Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs. 1 The purpose of this course is to provide an introduction to the RL78 timer Architecture.

More information

Building Interactive Devices and Objects. Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz MHCI Lab, LMU München

Building Interactive Devices and Objects. Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz MHCI Lab, LMU München Building Interactive Devices and Objects Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz michael.rohs@ifi.lmu.de MHCI Lab, LMU München Today Servo Motors DC Motors Stepper Motors Motor Drivers PWM WLAN

More information

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff Hardware Flags and the RTI system 1 Need for hardware flag Often a microcontroller needs to test whether some event has occurred, and then take an action For example A sensor outputs a pulse when a model

More information

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE 9S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE In this sequence of three labs you will learn to use the 9S12 S hardware sybsystem. WEEK 1 PULSE WIDTH MODULATION

More information

Atmel ATmega328P Timing Subsystems. Reading

Atmel ATmega328P Timing Subsystems. Reading 1 P a g e Atmel ATmega328P Timing Subsystems Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 9: Programming Timers

More information

Department of Mechanical and Aerospace Engineering ME106 Fundamentals of Mechatronics Andrew Nguyen Ryan Nunn-Gage Amir Sepahmansour Maryam Sotoodeh

Department of Mechanical and Aerospace Engineering ME106 Fundamentals of Mechatronics Andrew Nguyen Ryan Nunn-Gage Amir Sepahmansour Maryam Sotoodeh NATCAR Department of Mechanical and Aerospace Engineering ME106 Fundamentals of Mechatronics Andrew Nguyen Ryan Nunn-Gage Amir Sepahmansour Maryam Sotoodeh May 16, 2006 Table of Contents I. Summary..3

More information

Microcontroller: Timers, ADC

Microcontroller: Timers, ADC Microcontroller: Timers, ADC Amarjeet Singh February 1, 2013 Logistics Please share the JTAG and USB cables for your assignment Lecture tomorrow by Nipun 2 Revision from last class When servicing an interrupt,

More information

Power. EE 109 Unit 17 -Pulse Width Modulation. Duty Cycle. Output Devices

Power. EE 109 Unit 17 -Pulse Width Modulation. Duty Cycle. Output Devices 17.1 Power 17.2 EE 109 Unit 17 -Pulse Width Modulation Recall (or learn) that Power is a measure of: In an electronic circuit, P = Power = Current & Voltage (each may be w/ time) A circuit that draws a

More information

EE 308 Spring 2013 The MC9S12 Pulse Width Modulation System

EE 308 Spring 2013 The MC9S12 Pulse Width Modulation System The MC9S12 Pulse Width Modulation System o Introduction to PWM o Review of the Output Compare Function o Using Output Compare to generate a PWM signal o Registers used to enable the Output Capture Function

More information

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10 uc Crash Course Joshua Childs Joshua Hartman A. A. Arroyo Whats is covered in this lecture ESD Choosing A Processor GPIO USARTS o RS232 o SPI Timers o Prescalers o OCR o ICR o PWM ADC Interupts 1 ESD KILLS!

More information

LM4: The timer unit of the MC9S12DP256B/C

LM4: The timer unit of the MC9S12DP256B/C Objectives - To explore the Enhanced Capture Timer unit (ECT) of the MC9S12DP256B/C - To program a real-time clock signal with a fixed period and display it using the onboard LEDs (flashing light) - To

More information

The MC9S12 Pulse Width Modulation System. Pulse Width Modulation

The MC9S12 Pulse Width Modulation System. Pulse Width Modulation The MC9S12 Pulse Width Modulation System o Introduction to PWM o Review of the Output Compare Function o Using Output Compare to generate a PWM signal o Registers used to enable the Output Capture Function

More information

PWM System. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

PWM System. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff PWM System 1 Pulse Width Modulation (PWM) Pulses are continuously generated which have different widths but the same period between leading edges Duty cycle (% high) controls the average analog voltage

More information

Hardware and software resources on the AVR family for the microcontroller project

Hardware and software resources on the AVR family for the microcontroller project Hardware and software resources on the AVR family for the microcontroller project 1 1. Code Vision The C Compiler you use: CodeVisionAVR (CVAVR) Where can you find it? a (limited) version is available

More information

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes Purpose The intent of this course is to provide you with information about the main features of the S08 Timer/PWM (TPM) interface module and how to configure and use it in common applications. Objectives

More information

Candidate: Achema Hosea Egbubu (142773) Title: Monitoring 50/60Hz Grid Coupling A Study In Conjunction with Wind-Energy Feed to Main Grids

Candidate: Achema Hosea Egbubu (142773) Title: Monitoring 50/60Hz Grid Coupling A Study In Conjunction with Wind-Energy Feed to Main Grids Master Thesis 2016 Candidate: Achema Hosea Egbubu (142773) Title: Monitoring 50/60Hz Grid Coupling A Study In Conjunction with Wind-Energy Feed to Main Grids 0 CONTENTS ii Telemark University College Faculty

More information

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006.

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006. UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING SENG 466 Software for Embedded and Mechatronic Systems Project 1 Report May 25, 2006 Group 3 Carl Spani Abe Friesen Lianne Cheng 03-24523 01-27747 01-28963

More information

Lab 5 Timer Module PWM ReadMeFirst

Lab 5 Timer Module PWM ReadMeFirst Lab 5 Timer Module PWM ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) Interrupt Vector Table 3) Pin out Summary 4) DriverLib API 5) SineTable Overview In this lab, we are going to use the output hardware

More information

Exercise 3: Sound volume robot

Exercise 3: Sound volume robot ETH Course 40-048-00L: Electronics for Physicists II (Digital) 1: Setup uc tools, introduction : Solder SMD Arduino Nano board 3: Build application around ATmega38P 4: Design your own PCB schematic 5:

More information

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 PIC Functionality General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 General I/O Logic Output light LEDs Trigger solenoids Transfer data Logic Input Monitor

More information

Timer A. Last updated 8/7/18

Timer A. Last updated 8/7/18 Last updated 8/7/18 Advanced Timer Functions Output Compare Sets a flag and/or creates an interrupt when the counter value matches a value programmed into a separate register Input Capture Captures the

More information

PIC ADC to PWM and Mosfet Low-Side Driver

PIC ADC to PWM and Mosfet Low-Side Driver Name Lab Section PIC ADC to PWM and Mosfet Low-Side Driver Lab 6 Introduction: In this lab you will convert an analog voltage into a pulse width modulation (PWM) duty cycle. The source of the analog voltage

More information

Timer A (0 and 1) and PWM EE3376

Timer A (0 and 1) and PWM EE3376 Timer A (0 and 1) and PWM EE3376 General Peripheral Programming Model l l l l Each peripheral has a range of addresses in the memory map peripheral has base address (i.e. 0x00A0) each register used in

More information

Measuring Distance Using Sound

Measuring Distance Using Sound Measuring Distance Using Sound Distance can be measured in various ways: directly, using a ruler or measuring tape, or indirectly, using radio or sound waves. The indirect method measures another variable

More information

ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair. Overview

ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair. Overview ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair Overview For this assignment, you will be controlling the light emitted from and received by an LED/phototransistor pair. There are many

More information

EE 308 Lab Spring 2009

EE 308 Lab Spring 2009 9S12 Subsystems: Pulse Width Modulation, A/D Converter, and Synchronous Serial Interface In this sequence of three labs you will learn to use three of the MC9S12's hardware subsystems. WEEK 1 Pulse Width

More information

PIC Analog Voltage to PWM Duty Cycle

PIC Analog Voltage to PWM Duty Cycle Name Lab Section PIC Analog Voltage to PWM Duty Cycle Lab 5 Introduction: In this lab you will convert an analog voltage into a pulse width modulation (PWM) duty cycle. The source of the analog voltage

More information

ECE251: Tuesday October 3 0

ECE251: Tuesday October 3 0 ECE251: Tuesday October 3 0 Timer Module Continued Review Pulse Input Characterization Output Pulses Pulse Count Capture Homework #6 due Thursday Lab 7 (Maskable Interrupts/ SysTick Timer) this week. Significant

More information

Roland Kammerer. 13. October 2010

Roland Kammerer. 13. October 2010 Peripherals Roland Institute of Computer Engineering Vienna University of Technology 13. October 2010 Overview 1. Analog/Digital Converter (ADC) 2. Pulse Width Modulation (PWM) 3. Serial Peripheral Interface

More information

EEL 4744C: Microprocessor Applications Lecture 8 Timer Dr. Tao Li

EEL 4744C: Microprocessor Applications Lecture 8 Timer Dr. Tao Li EEL 4744C: Microprocessor Applications Lecture 8 Timer Reading Assignment Software and Hardware Engineering (new version): Chapter 14 SHE (old version): Chapter 10 HC12 Data Sheet: Chapters 12, 13, 11,

More information

Reading Assignment. Timer. Introduction. Timer Overview. Programming HC12 Timer. An Overview of HC12 Timer. EEL 4744C: Microprocessor Applications

Reading Assignment. Timer. Introduction. Timer Overview. Programming HC12 Timer. An Overview of HC12 Timer. EEL 4744C: Microprocessor Applications Reading Assignment EEL 4744C: Microprocessor Applications Lecture 8 Timer Software and Hardware Engineering (new version): Chapter 4 SHE (old version): Chapter 0 HC Data Sheet: Chapters,,, 0 Introduction

More information

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim Abstract - This project utilized Eleven Engineering s XInC2 development board to control several peripheral devices to open a standard 40 digit combination

More information

TKT-3500 Microcontroller systems

TKT-3500 Microcontroller systems TKT-3500 Microcontroller systems Lec 4 Timers and other peripherals, pulse-width modulation Ville Kaseva Department of Computer Systems Tampere University of Technology Fall 2010 Sources Original slides

More information

Lab 5: Inverted Pendulum PID Control

Lab 5: Inverted Pendulum PID Control Lab 5: Inverted Pendulum PID Control In this lab we will be learning about PID (Proportional Integral Derivative) control and using it to keep an inverted pendulum system upright. We chose an inverted

More information

The Need. Reliable, repeatable, stable time base. Memory Access. Interval/Event timers ADC DAC

The Need. Reliable, repeatable, stable time base. Memory Access. Interval/Event timers ADC DAC Timers The Need Reliable, repeatable, stable time base Memory Access /Event timers ADC DAC Time Base: Crystal Oscillator Silicon Dioxide forms a piezoelectric crystal that can deform in eclectic field,

More information

Page 1. So Far. Usage Examples. Input Capture Basics. Familiar with CS/ECE 6780/5780. Al Davis. Trigger interrupts on rising/falling/both edges

Page 1. So Far. Usage Examples. Input Capture Basics. Familiar with CS/ECE 6780/5780. Al Davis. Trigger interrupts on rising/falling/both edges So Far CS/ECE 6780/5780 Al Davis Today s topics: Input capture particular focus on timing measurements useful for 5780 Lab 7 Familiar with threads, semaphores, & interrupts Now move on to capturing edge

More information

Timing System. Timing & PWM System. Timing System components. Usage of Timing System

Timing System. Timing & PWM System. Timing System components. Usage of Timing System Timing & PWM System Timing System Valvano s chapter 6 TIM Block User Guide, Chapter 15 PWM Block User Guide, Chapter 12 1 2 Timing System components Usage of Timing System 3 Counting mechanisms Input time

More information

Experiment#6: Speaker Control

Experiment#6: Speaker Control Experiment#6: Speaker Control I. Objectives 1. Describe the operation of the driving circuit for SP1 speaker. II. Circuit Description The circuit of speaker and driver is shown in figure# 1 below. The

More information

VORAGO Timer (TIM) subsystem application note

VORAGO Timer (TIM) subsystem application note AN1202 VORAGO Timer (TIM) subsystem application note Feb 24, 2017, Version 1.2 VA10800/VA10820 Abstract This application note reviews the Timer (TIM) subsystem on the VA108xx family of MCUs and provides

More information

AN AT89C52 MICROCONTROLLER BASED HIGH RESOLUTION PWM CONTROLLER FOR 3-PHASE VOLTAGE SOURCE INVERTERS

AN AT89C52 MICROCONTROLLER BASED HIGH RESOLUTION PWM CONTROLLER FOR 3-PHASE VOLTAGE SOURCE INVERTERS IIUM Engineering Journal, Vol. 6, No., 5 AN AT89C5 MICROCONTROLLER BASED HIGH RESOLUTION PWM CONTROLLER FOR 3-PHASE VOLTAGE SOURCE INVERTERS K. M. RAHMAN AND S. J. M. IDRUS Department of Mechatronics Engineering

More information

Lab 5: Control and Feedback. Lab 5: Controls and feedback. Lab 5: Controls and Feedback

Lab 5: Control and Feedback. Lab 5: Controls and feedback. Lab 5: Controls and Feedback Lab : Control and Feedback Lab : Controls and feedback K K You may need a resistor other than exactly K for better sensitivity This embedded system uses the Photo sensor to detect the light intensity of

More information

Embedded Hardware Design Lab4

Embedded Hardware Design Lab4 Embedded Hardware Design Lab4 Objective: Controlling the speed of dc motor using light sensor (LDR). In this lab, we would want to control the speed of a DC motor with the help of light sensor. This would

More information

CS/ECE 6780/5780. Al Davis. Today s topics: Output capture Pulse Width Modulation Pulse Accumulation all useful options for Lab7 1 CS 5780

CS/ECE 6780/5780. Al Davis. Today s topics: Output capture Pulse Width Modulation Pulse Accumulation all useful options for Lab7 1 CS 5780 CS/ECE 6780/5780 Al Davis Today s topics: Output capture Pulse Width Modulation Pulse Accumulation all useful options for Lab7 1 CS 5780 Output Compare Basic output control create square waves» including

More information

Using the Z8 Encore! XP Timer

Using the Z8 Encore! XP Timer Application Note Using the Z8 Encore! XP Timer AN013104-1207 Abstract Zilog s Z8 Encore! XP microcontroller consists of four 16-bit reloadable timers that can be used for timing, event counting or for

More information

Laboratory Exercise 1 Microcontroller Board with Driver Board

Laboratory Exercise 1 Microcontroller Board with Driver Board Laboratory Exercise 1 Microcontroller Board with Driver Board The purpose of this lab exercises is to demonstrate how the Microcontroller Board can be used to control motors connected to the Driver Board

More information

Chapter 5 Timer Functions ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 5.1 The Timer System 5.2 Programming the Timer System 5.3 Examples and Applications The

More information

High Resolution Pulse Generation

High Resolution Pulse Generation High Resolution Pulse Generation An Application Note for the NS9360 Processor www.digi.com 90001138 2009 Digi International Inc. All Rights Reserved. Digi, Digi International, and the Digi logo are trademarks

More information

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ υιοπασδφγηϕκλζξχϖβνµθωερτψυιοπασδ φγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκλζ ξχϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµ EE 331 Design Project Final Report θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ

More information

Oct 30 Announcements. Bonus marked will be posted today Will provide 270 style feedback on multiple-choice questions. [3.E]-1

Oct 30 Announcements. Bonus marked will be posted today Will provide 270 style feedback on multiple-choice questions. [3.E]-1 Oct 30 Announcements Code Marked and on Blackboard This week: Mon 2:30 to 3:00pm, Tues 2:30 to 3:30 and W-F 1:30 to 3:00pm opportunity to talk about code: earn 2 extra points on the coding part Bonus marked

More information

8-bit Microcontroller. Application Note. AVR085: Replacing AT90S8515 by ATmega8515. Features. Introduction. AT90S8515 Errata Corrected in ATmega8515

8-bit Microcontroller. Application Note. AVR085: Replacing AT90S8515 by ATmega8515. Features. Introduction. AT90S8515 Errata Corrected in ATmega8515 AVR085: Replacing by ATmega8515 Features Errata Corrected in ATmega8515 Changes to Names Improvements to Timer/Counters and Prescalers Improvements to External Memory Interface Improvements to Power Management

More information

Lecture 12 Timer Functions

Lecture 12 Timer Functions CPE 390: Microprocessor Systems Spring 2018 Lecture 12 Timer Functions Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 Adapted from HCS12/9S12

More information

Human-Robot Interaction Class Koosy Human-Robot Interaction Class

Human-Robot Interaction Class Koosy Human-Robot Interaction Class ATmega128 (8bit AVR Microprocessor) Human-Robot Interaction Class 2008. 4. 28 Koosy 1 Contents Micro Controller Unit Overview ATmega128 Features Necessary Tools General I/O External Interrupt 8bit/16bit

More information

Topics Introduction to Microprocessors

Topics Introduction to Microprocessors Topics 2244 Introduction to Microprocessors Chapter 8253 Programmable Interval Timer/Counter Suree Pumrin,, Ph.D. Interfacing with 886/888 Programming Mode 2244 Introduction to Microprocessors 2 8253/54

More information

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab The purpose of this lab is to learn about sensors and use the ADC module to digitize the sensor signals. You will use the digitized signals

More information

Microcontrollers: Lecture 3 Interrupts, Timers. Michele Magno

Microcontrollers: Lecture 3 Interrupts, Timers. Michele Magno Microcontrollers: Lecture 3 Interrupts, Timers Michele Magno 1 Calendar 07.04.2017: Power consumption; Low power States; Buses, Memory, GPIOs 20.04.2017 Serial Communications 21.04.2017 Programming STM32

More information

Graphical Control Panel User Manual

Graphical Control Panel User Manual Graphical Control Panel User Manual DS-MPE-DAQ0804 PCIe Minicard Data Acquisition Module For Universal Driver Version 7.0.0 and later Revision A.0 March 2015 Revision Date Comment A.0 3/18/2015 Initial

More information

University of Texas at El Paso Electrical and Computer Engineering Department

University of Texas at El Paso Electrical and Computer Engineering Department University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 05 Pulse Width Modulation Goals: Bonus: Pre Lab Questions: Use Port

More information

EIE/ENE 334 Microprocessors

EIE/ENE 334 Microprocessors EIE/ENE 334 Microprocessors Lecture 13: NuMicro NUC140 (cont.) Week #13 : Dejwoot KHAWPARISUTH Adapted from http://webstaff.kmutt.ac.th/~dejwoot.kha/ NuMicro NUC140: Technical Ref. Page 2 Week #13 NuMicro

More information

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its main features and the application benefits of leveraging

More information

µtasker Document µtasker Hardware Timers

µtasker Document µtasker Hardware Timers Embedding it better... µtasker Document utaskerhwtimers.doc/0.07 Copyright 2016 M.J.Butcher Consulting Table of Contents 1. Introduction...3 2. Timer Control Interface...3 3. Configuring a Single-Shot

More information

For more information on these functions and others please refer to the PRONET-E User s Manual.

For more information on these functions and others please refer to the PRONET-E User s Manual. PRONET-E Quick Start Guide PRONET-E Quick Start Guide BASIC FUNCTIONS This guide will familiarize the user with the basic functions of the PRONET-E Servo Drive and assist with start up. The descriptions

More information

EARTH PEOPLE TECHNOLOGY, Inc. FAST ARDUINO OSCILLOSCOPE PROJECT User Manual

EARTH PEOPLE TECHNOLOGY, Inc. FAST ARDUINO OSCILLOSCOPE PROJECT User Manual EARTH PEOPLE TECHNOLOGY, Inc FAST ARDUINO OSCILLOSCOPE PROJECT User Manual The Fast Oscilloscope is designed for EPT USB CPLD Development System. It converts an analog signal to digital and displays the

More information

A Beginners Guide to AVR

A Beginners Guide to AVR See discussions, stats, and author profiles for this publication at: http://www.researchgate.net/publication/263084656 A Beginners Guide to AVR TECHNICAL REPORT JUNE 2014 DOWNLOADS 154 VIEWS 50 1 AUTHOR:

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 5: PIC Peripherals on Chip Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering The PIC Family: Peripherals Different PICs have different

More information

EE251: Thursday October 25

EE251: Thursday October 25 EE251: Thursday October 25 Review SysTick (if needed) General-Purpose Timers A Major Topic in ECE251 An entire section (11) of the TM4C Data Sheet Basis for Lab #8, starting week after next Homework #5

More information

Electronic Counters. Sistemi Virtuali di Acquisizione Dati Prof. Alessandro Pesatori

Electronic Counters. Sistemi Virtuali di Acquisizione Dati Prof. Alessandro Pesatori Electronic Counters 1 Electronic counters Frequency measurement Period measurement Frequency ratio measurement Time interval measurement Total measurements between two signals 2 Electronic counters Frequency

More information

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER 65 CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER 4.1 INTRODUCTION Many control strategies are available for the control of IMs. The Direct Torque Control (DTC) is one of the most

More information

Serial communication inverter. Lab bench scenario. Inverter Board, A/D, D/A, PWM, Filters, Encoders. Inverter board. and Dimmer introduction

Serial communication inverter. Lab bench scenario. Inverter Board, A/D, D/A, PWM, Filters, Encoders. Inverter board. and Dimmer introduction Inverter Board, A/D, D/A, PWM, Filters, Encoders and Dimmer introduction 20181004 Gunnar Lindstedt Serial communication inverter Lund University, Sweden Lab bench scenario Inverter board PC 9pole Dsub

More information

Using the HCS08 TPM Module In Motor Control Applications

Using the HCS08 TPM Module In Motor Control Applications Pavel Grasblum Using the HCS08 TPM Module In Motor Control Applications Designers can choose from a wide range of microcontrollers to provide digital control for variable speed drives. Microcontrollers

More information

An MPI Daemon-Based Temperature Controller for an AC Susceptometer

An MPI Daemon-Based Temperature Controller for an AC Susceptometer An MPI Daemon-Based Temperature Controller for an AC Susceptometer S. Roy, A. Chakravarti, S. Sil Assistant Professor, Department of Physics, Visva-Bharati, Santiniketan, India Assistant Professor, Department

More information

CQM1H-MAB42 Analog I/O Board Connector CN1: Analog inputs 1 to 4. Name Specifications Model number Slot 1 (left slot) High-speed Counter Board

CQM1H-MAB42 Analog I/O Board Connector CN1: Analog inputs 1 to 4. Name Specifications Model number Slot 1 (left slot) High-speed Counter Board Inner Boards The six available Inner Boards are shown below. Inner Boards can be mounted in slot 1 or slot 2 of a CQM1H-CPU51 or CQM1H- CPU61 CPU Unit. (Some Inner Boards must be mounted in either slot

More information

EDC Quick Start Guide

EDC Quick Start Guide EDC Quick Start Guide BASIC FUNCTIONS This guide will familiarize the user with the basic functions of the EDC Servo Drive and assist with start up. The guide will cover the following: 1. Restoring Parameters

More information

Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation

Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation Quick Parameter List: 0x00: Device Number 0x01: Required Channels 0x02: Ignored Channels 0x03: Reversed Channels 0x04: Parabolic

More information

Switch/ Jumper Table 1-1: Factory Settings Factory Settings (Jumpers Installed) Function Controlled Activates pull-up/ pull-down resistors on Port 0 digital P7 I/O lines Activates pull-up/ pull-down resistors

More information

ELEC 3040/3050 Lab #7

ELEC 3040/3050 Lab #7 ELEC 3040/3050 Lab #7 PWM Waveform Generation References: STM32L1xx Technical Reference Manual STM32L100RC Data Sheet Goals of this lab exercise Begin the primary design project for the semester Speed

More information

Lab 5: Interrupts, Timing, and Frequency Analysis of PWM Signals

Lab 5: Interrupts, Timing, and Frequency Analysis of PWM Signals Lab 5: Interrupts, Timing, and Frequency Analysis of PWM Signals 1 2 Lab 5: Interrupts and Timing Thus far, we have not worried about time in our real-time code Almost all real-time code involves sampling

More information

EE 308 Spring Using the HCS12 PWM

EE 308 Spring Using the HCS12 PWM Using the HCS12 PWM 1. Choose 8-bit mode (PWMCTL = x) 2. Choose high polarity (PWMPOL = xff) 3. Choose left-aligned (PWMCAE = x) 4. Select clock mode in PWMCLK: PCLKn = for 2 N, PCLKn = 1 for 2 (N+1) M,

More information

For reference only Refer to the latest documents for details

For reference only Refer to the latest documents for details STM32F3 Technical Training For reference only Refer to the latest documents for details General Purpose Timers (TIM2/3/4/5 - TIM12/13/14 - TIM15/16/17 - TIM6/7/18) TIM2/5 TIM3/4/19 TIM12 TIM15 TIM13/14

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture overview Microprocessors & Interfacing /Output output PMW Digital-to- (D/A) Conversion input -to-digital (A/D) Conversion Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week9 1 S2, 2008 COMP9032 Week9

More information

EE 308 Apr. 24, 2002 Review for Final Exam

EE 308 Apr. 24, 2002 Review for Final Exam Review for Final Exam Numbers Decimal to Hex (signed and unsigned) Hex to Decimal (signed and unsigned) Binary to Hex Hex to Binary Addition and subtraction of fixed-length hex numbers Overflow, Carry,

More information

Sampling and Reconstruction

Sampling and Reconstruction Experiment 10 Sampling and Reconstruction In this experiment we shall learn how an analog signal can be sampled in the time domain and then how the same samples can be used to reconstruct the original

More information

MicroToys Guide: Motors N. Pinckney April 2005

MicroToys Guide: Motors N. Pinckney April 2005 Introduction Three types of motors are applicable to small projects: DC brushed motors, stepper motors, and servo motors. DC brushed motors simply rotate in a direction dependent on the flow of current.

More information

' Turn off A/D converters (thereby allowing use of pins for I/O) ANSEL = 0

' Turn off A/D converters (thereby allowing use of pins for I/O) ANSEL = 0 dc_motor.bas (PIC16F88 microcontroller) Design Example Position and Speed Control of a dc Servo Motor. The user interface includes a keypad for data entry and an LCD for text messages. The main menu offers

More information