Timer A (0 and 1) and PWM EE3376

Similar documents
Lab 5 Timer Module PWM ReadMeFirst

ME 461 Laboratory #2 Timers and Pulse-Width Modulation

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

University of Texas at El Paso Electrical and Computer Engineering Department

Lazy Clock Electronics and Software

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

Microcontrollers: Lecture 3 Interrupts, Timers. Michele Magno

Microcontroller: Timers, ADC

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

Review for Final Exam

Timer A. Last updated 8/7/18

Lecture 6: More on Timers and PWM

VORAGO Timer (TIM) subsystem application note

Hello, and welcome to this presentation of the STM32 Digital Filter for Sigma-Delta modulators interface. The features of this interface, which

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

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

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

This section describes the basic functions of a the general purpose 16-bit Timer_A in MSP430 based system.

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

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -3 1 UNIT 3

Hello, and welcome to this presentation of the STM32 Infrared Timer. Features of this interface allowing the generation of various IR remote control

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

EE 308 Apr. 24, 2002 Review for Final Exam

Review for Final Exam

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

Select the single most appropriate response for each question.

MSP430 Interfacing Programs

High Resolution Pulse Generation

ME 461 Laboratory #3 Analog-to-Digital Conversion

Graphical Control Panel User Manual

DAC A (VCO) Buffer (write) DAC B (AGC) Buffer (write) Pulse Code Buffer (write) Parameter Buffer (write) Figure A.1. Receiver Controller Registers

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

Fixed-function (FF) implementation for PSoC 3 and PSoC 5 devices

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

Chapter 6 PROGRAMMING THE TIMERS

PIC ADC to PWM and Mosfet Low-Side Driver

PC-OSCILLOSCOPE PCS500. Analog and digital circuit sections. Description of the operation

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

Fixed-function (FF) implementation for PSoC 3 and PSoC 5LP devices

ECE251: Tuesday October 3 0

WDTCTL = WDTPW + WDTHOLD; P1DIR = 1; // P1.0 output, all others input. sits here as long as the pin is high while (P1IN & 8); while (!

Macroblcok MBI5042 Application Note-VB.01-EN

CSCI1600 Lab 4: Sound

1. Objectives Generation of Gate Drive Signals Inverter Circuitry Initial Testing Inverter Testing 5. 5.

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

EIE/ENE 334 Microprocessors

EE 308 Lab Spring 2009

MSP430 Family Mixed-Signal Microcontroller Application Reports

Generating DTMF Tones Using Z8 Encore! MCU

EE 308 Spring Using the HCS12 PWM

ECE 511: MICROPROCESSORS

LM4: The timer unit of the MC9S12DP256B/C

The MC9S12 Pulse Width Modulation System. Pulse Width Modulation

nc. Function Set Configuration The 32LQD is the main function of the set. It can be used either alone, with one of the supporting functions, or with b

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

Data Converters. Lecture Fall2013 Page 1

RedPitaya. FPGA memory map

USB4. Encoder Data Acquisition USB Device Page 1 of 8. Description. Features

ATmega16A Microcontroller

PIC Analog Voltage to PWM Duty Cycle

MBI5031 Application Note

8253 functions ( General overview )

Topics Introduction to Microprocessors

Small DC Motor Control

Experiment#6: Speaker Control

Microprocessors & Interfacing

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

Product Family: 05, 06, 105, 205, 405, WinPLC, Number: AN-MISC-021 Terminator IO Subject: High speed input/output device

MICROCONTROLLER TUTORIAL II TIMERS

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

Cleaning Robot Working at Height Final. Fan-Qi XU*

Analog Input and Output. Lecturer: Sri Parameswaran Notes by: Annie Guo

EE 308 Spring 2013 The MC9S12 Pulse Width Modulation System

Utilizing the Trigger Routing Unit for System Level Synchronization

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

TKT-3500 Microcontroller systems

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

Timer/Counter with PWM

µtasker Document µtasker Hardware Timers

Ocean Controls KT-5198 Dual Bidirectional DC Motor Speed Controller

AN4507 Application note

Using the HCS08 TPM Module In Motor Control Applications

Micro Controller Based Ac Power Controller

OBSOLETE. Bus Compatible Digital PWM Controller, IXDP 610 IXDP 610

Analog to Digital Conversion

Pulse Width Modulation

Linear Integrated Circuits

PCL-836 Multifunction countertimer and digital I/O add-on card for PC/XT/ AT and compatibles

Getting Precise with MSP430 Sigma-Delta ADC Peripherals Vincent Chan MSP430 Business Development Manager TI Asia

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

Electric Bike BLDC Hub Motor Control Using the Z8FMC1600 MCU

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

Programming and Interfacing

Pulse Width Modulation

Using Z8 Encore! XP MCU for RMS Calculation

Using the Z8 Encore! XP Timer

Temperature Monitoring and Fan Control with Platform Manager 2

Artificial Sine Wave Generation Using SX Communications Controller

F²MC-16FX FAMILY ALL SERIES PROGRAMMABLE PULSE GENERATOR 16-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

354 Facta Universitatis ser.: Elec. and Energ. vol. 13, No.3, December 2000 in the audio frequency band. There are many reasons for moving towards a c

Transcription:

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 the peripheral has an offset from the base some registers are for control l bits to enable the peripheral l bits to configure specific modes of operation l bits to determine level of clock division some registers are for status which is generally read-only l error conditions are represented with a bit in status register l completion status some registers are for data l data to be transmitted is written to data registers l data received can be read from data registers l data measured (i.e. ADC) can be read from data registers

Pulse Width Modulation l l l l Most commonly used for motor control switching mode for efficiency with transistor drive circuit One time configuration stand alone operation Pulse Width Modulation like a poor man s version of Digital to Analog Converter l take average value of square wave with variable duty cycle l low power output must buffer with driving circuit for high power applications (motors, etc) l can change analog value, but much slower than D/A Generates a square wave control of frequency control of duty cycle control of polarity - starts high, ends low OR starts low, ends high control of alignment left vs. center 8 independent channels on Port P (P for PWM)

Pulse Width Modulation 50% 75% 25% 10%

Pulse Width Modulation 50% selected clock counter value 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 duty cycle period PWM frequency = F sc / (period) = 100KHz / 10 = 10 KHz PWM duty cycle = ((period duty cycle) / (period)) * 100% = ((10 5) / 10) * 100% = 50%

PWM Simple Design Example write to duty cycle duty cycle 8 bit compare = clksel 8 bit counter load r latch s output write to period 8 bit compare period =

Functions of Timers l stop watch l captures time of external events for instance rising edge of input pin allows for period and pulse width measurements l creates output waveform rising edge programmed for specific time falling edge programmed for specific time l pulse accumulations count cycles while input is asserted count the number of rising edges on input l creates periodic interrupts

Input Capture Mode Port pin as Input TAR 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 capture time of first rising edge - LAST capture time of second rising edge - NEW l l input pin can be programmed in variety of ways In this example, Port input interrupt is enabled Input rising edge causes interrupt which captures time on TAR TAR is recorded and compared against previous captured value LAST value is subtracted from NEW to get period of waveforms

Output Compare Mode (8 channels) port pin as output TAR 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 CCR1 CCR0 l Can program edges relative to time in TAR l Can generate periodic interrupts with same mechanism

Pulse Accumulation (edge based) Port pin selected as TACLK TACLK 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 Increments on every rising edge in this example l l Counts the number of rising edges over time For a fixed time, can calculate the average frequency

Pulse Accumulation (gated time) Port pin as Input TAR0 0 0 0 0 0 0 1 2 3 3 3 3 3 3 4 5 6 6 6 6 TAR1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 l Interrupt for rising and falling edges of port 1 l l l One interrupt enables TAR and one disables Use other timer to measure straight time for comparison TAR0 / TAR1 is ratio of on versus off.

MSP430 User s Manual

MSP430 User s Manual

MSP430 User s Manual

MSP430 User s Manual

TACCTLx continued

Up down mode

32 bit counter extension example l If 16 bit counter is running at 1 MHz, rollover occurs every 2 16 * ( 1 / 1MHz) = 64 milliseconds l By extending to 32 bits, rollover period is much longer 2 32 * ( 1 / 1MHz ) ~ 4000 seconds l Set overflow interrupt service routine to increment a global variable - 16 bit TAR_extended - which represents the upper 16 bits of a 32 bit word. 15 0 15 0 TAR_extended- SRAM TAR= 0x170 31 0

Note on programming MSP430 P1DIR = 0x41; P1SEL = 0x41; P1SEL2 = 0x01; // P1.0 and P1.6 to output CCR0 = 1000; //PWM Period - Freq = (SMCLK freq)/(ccr0 value) //eg,smclk = 1MHZ so 1MHZ/1000 = 1Khz is the PWM Freq CCTL1 = OUTMOD_7; //CCR1 toggle/set CCTL2 = OUTMOD_7; //CCR2 toggle/reset CCR1 = 0; //CCR1 PWM duty cycle TACTL = TASSEL_2 + MC_1; Typical programming style is to use header file abbreviations for registers and bit patterns. TACTL is the TA0CTL register at 0x160 TASSEL_2 is (2*0x0100u)) = 0x0200 unsigned picks the SMCLK MC_1 = (0x0020) picks up to CCR0 mode. TASSEL_2 MC_1 = 0x0220 which programs both the mode and clock.

msp430x22x4_ta_03

msp430x22x4_ta_03

msp430x22x4_ta_03

msp430x22x4_ta_05

msp430x22x4_ta_05

msp430x22x4_ta_05

msp430x22x4_ta_07

msp430x22x4_ta_07

msp430x22x4_ta_07

msp430x22x4_ta_16

msp430x22x4_ta_16

msp430x22x4_ta_16

msp430x22x4_ta_22

ta_22