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.

Slides:



Advertisements
Similar presentations
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 5 Other Subsystems.
Advertisements

EEE305 Microcontroller Systems
More fun with Timer/Counters
Programmable Interval Timer
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Taking timing further Chapter Nine 9.1 – 9.8 Dr. Gheith Abandah1.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Servo motor angle rotation control by adjusting PWM ratio.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
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.
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Lecture 29: LM3S9B96 Microcontroller – Pulse Width Modulator (PWM)
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
ARM Timers.
System Clocks.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
MS_uC / fue1 / V TIMx - Timer Programming Microcontroller TIMx - Timer Autumn term 2012.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Timers The timers of the PIC16C7X microcontroller can be briefly described in only one sentence. There are three completely independent timers/counters.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
Timer Peripherals.
The 8253 Programmable Interval Timer
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
ELE22MIC Lecture 18 The AVR Sleep Modes The ATMEGA128’s Timer System
Microprocessoren lesson 6. PWM /motor control/servo.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
8254 Timer.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
Microcontroller Applications ELEC 421 Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
Chapter 12 Some PIC Microcontroller Advances The aims of this chapter are to introduce: To introduce in overview two microcontrollers which show some enhanced.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Timer 1 and 2 operation, PWM Principles. Timer 1 Operation.
Microcontrollers session. What is Microcontroller? Microcontroller is composed of microprocessor,ram, flash memory,EEPROM and some modules like timers,
C Examples 6. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
Closed Loop Temperature Control Circuit with LCD Display Mike Wooldridge ECE 4330 Embedded Systems.
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
TIMERS.
Timer modules in PIC 16F877.  The PIC 16F877 basically has three independent timer modules,  denoted by the symbols, TIMER-0, TIMER1,andTIMER2. . These.
16F877A.
Why are Timer Functions Important?
V.V.P. ENGINEERING COLLEGE,RAJKOT
Programmable Interval Timer
Programmable Interval Timer 8254 LECTURE 3
AVR Addressing Modes Subject: Microcontoller & Interfacing
Microprocessors Timers
Oct 30 Announcements Code Marked and on Blackboard
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Timer/Counter Modified from Dr. Lam Phung’s Slides.
16-bit Timer/Counter1 Features
8-bit Timer/Counter0 with PWM
Oct 30 Announcements Code Marked and on Blackboard
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
ECE 354 Computer Systems Lab II
8051 Timers / Counters It has two timers Timer 0 and Timer 1.
Programmable Interval timer 8253 / 8254
8-bit Timer/Counter2 with PWM and Asynchronous Operation
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Programmable Interval timer 8253 / 8254
UNIT 19 PWM 로봇 SW 교육원 조용수.
Figure CCP1 Control Register
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.
Timer/Counter Timer/Counter 0 Timer/Counter 1 Timer/Counter 2 8 bit
Timers Chapter 2.
Presentation transcript:

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 how great his faith is bt how great his love is. And now these three remain: faith, hope and love. But the greatest of these is love. And now these three remain: faith, hope and love. But the greatest of these is love. 1 Corinthians 13:13 1 Corinthians 13:13

Pulse Width Modulation Each CCP (Capture/Compare/PWM) module contains a 16-bit register which can operate as a 10-bit PWM Master/Slave Duty Cycle register. The operation of CCP1 is identical to that of CCP2. When both CCP’s are used, the PWMs will have the same frequency and update rate (TMR2 interrupt).

PWM Mode In Pulse Width Modulation (PWM) mode, the CCP1 pin produces up to a 10-bit resolution PWM output. Since the CCP1 pin is multiplexed with the PORTC data latch, the TRISC bit must be cleared to make the CCP1 pin an output.

PWM Period The PWM period is specified by writing to the PR2 register. The PWM period can be calculated using the following formula: PWM period = (PR2) + 1] 4 TOSC (TMR2 prescale value) PWM frequency is defined as 1 / [PWM period]. When TMR2 is equal to PR2, the following three events occur on the next increment cycle: TMR2 is cleared The CCP1 pin is set (exception: if PWM duty cycle = 0%, the CCP1 pin will not be set) The PWM duty cycle is latched from CCPR1L into CCPR1H

PWM Duty Cycle The PWM duty cycle is specified by writing to the CCPR1L register and to the CCP1CON bits. Up to 10-bit resolution is available. The CCPR1L contains the eight MSbs and the CCP1CON contains the two LSbs. This 10- bit value is represented by CCPR1L:CCP1CON. The following equation is used to calculate the PWM duty cycle in time: PWM duty cycle = (CCPR1L:CCP1CON ) TOSC (TMR2 prescale value)

CCP1CON REGISTER/CCP2CON REGISTER Bits 7-6 unused Bits 7-6 unused Bits 5-4 two least significant bits of the 10 bit PWM cycle. Bits 5-4 two least significant bits of the 10 bit PWM cycle. Bits XX PWM Mode Bits XX PWM Mode

PWM Setup The following steps should be taken when configuring the CCP module for PWM operation: 1. Set the PWM period by writing to the PR2 register. 2. Set the PWM duty cycle by writing to the CCPR1L register and CCP1CON bits. 3. Make the CCP1 pin an output by clearing the TRISC bit. 4. Set the TMR2 prescale value and enable Timer2 by writing to T2CON. 5. Configure the CCP1 module for PWM operation.

PWM Operation 1. Set the PWM duty cycle by writing to the CCPR1L register and CCP1CON bits. CCPR1L and CCP1CON can be written to at any time, but the duty cycle value is not latched into CCPR1H until after a match between PR2 and TMR2 occurs (i.e., the period is complete). In PWM mode, CCPR1H is a read only register.

PWM Buffering The CCPR1H register and a 2-bit internal latch are used to double buffer the PWM duty cycle. This double buffering is essential for glitchless PWM operation. When the CCPR1H and 2-bit latch match TMR2 concatenated with an internal 2-bit Q clock or 2 bits of the TMR2 prescaler, the CCP1 pin is cleared.

PWM Output A PWM output (Figure 14-4) has a time-base (period) and a time that the output stays high (duty cycle). The frequency of the PWM is the inverse of the period (1/period). Note: If the PWM duty cycle value is longer than the PWM period, the CCP1 pin will not be cleared.

PWM Output

PWM Block Diagram

Feedback Sources Timing Timing Encoder Encoderlinearrotary Analog Analog Generator Generator Bridge Bridge

Control Strategies Analog Control Analog Control PID PID ANN ANN Fuzzy Logic Fuzzy Logic Other Other