SlideShare a Scribd company logo
1 of 18
RMK COLLEGE OF ENGINEERING AND
TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND
COMMUNICATION ENGINEERING
EC8791
EMBEDDED AND REAL TIME SYSTEMS
S. Rajalakshmi
AP/ECE
LPC2148 PULSE WIDTH
MODULATION
Technique by which width of a pulse is varied while keeping the frequency
constant.
A period of a pulse consists of an ON cycle (HIGH) and an OFF cycle (LOW). The
fraction for which the signal is ON over a period is known as duty cycle.
Consider a pulse with a period of 10ms which remains ON (high) for 2ms.
The duty cycle of this pulse will be
D = (2ms / 10ms) x 100 = 20%
Through PWM technique, we can control the
power delivered to the load by using ON-OFF
Pulse Width Modulated signals with different duty cycle
LPC2148 supports two types of controlled PWM outputs
Single Edge Controlled PWM
All the rising (positive going) edges of the output waveform are positioned/fixed at the beginning of
PWM period.
Only falling (negative going) edge position can be controlled to vary the pulse width of PWM.
Double Edge Controlled PWM
All the rising (positive going) and falling (negative going) edge positions can be controlled to vary the
pulse width of PWM.
Both the rising as well as the falling edges can be positioned anywhere in the PWM period.
LPC2148 PWM
The PWM in LPC2148 is based on standard 32-bit Timer Counter, i.e. PWMTC (PWM
Timer Counter).
This Timer Counter counts the cycles of peripheral clock (PCLK).
Timer clock counts can be scaled using 32-bit PWM Prescale Register (PWMPR).
LPC2148 has 7 PWM match registers (PWMMR0 – PWMMR06).
One match register (PWMMR0) is used to set PWM frequency.
Remaining 6 match registers are used to set PWM width for 6 different PWM signals in
Single Edge Controlled PWM or 3 different PWM signals in Double Edge Controlled
PWM.
Whenever PWM Timer Counter (PWMTC) matches with these Match Registers then,
PWM Timer Counter resets, or stops, or generates match interrupt, depending upon
settings in PWM Match Control Register(PWMMCR).
 PWMMR0 = 6 i.e. PWM period is 6 counts, after which PWM
Timer Counter resets.
 PWM2 & PWM3 are configured as Single Edge Controlled PWM
and PWM5 is configured as Double Edge Controlled PWM.
 Prescaler is set to increment PWM Timer Counter after every
two Peripheral clocks (PCLK).
 Match registers (PWMMR2 & PWMMR3) are used to set falling
edge position for PWM2 & PWM3.
 PWMMR4 & PWMMR5 are used to set rising & falling edge
positions respectively for PWM5.
The table given below shows when the PWM is Set (Rising Edge) and Reset
(Falling Edge) for different PWM channels using 7 Match Register.
LPC2148 PWM Pins
Steps for PWM generation
 Reset and disable PWM counter using PWMTCR
 Load prescale value according to need of application in the PWMPR
 Load PWMMR0 with a value corresponding to the time period of your PWM wave
 Load any one of the remaining six match registers (two of the remaining six match
registers for double edge controlled PWM) with the ON duration of the PWM cycle.
(PWM will be generated on PWM pin corresponding to the match register you load
the value with).
 Load PWMMCR with a value based on the action to be taken in the event of a match
between match register and PWM timer counter.
 Enable PWM match latch for the match registers used with the help of PWMLER
 Select the type of PWM wave (single edge or double edge controlled) and which
PWMs to be enabled using PWMPCR
 Enable PWM and PWM counter using PWMTCR
RMK College PWM Module for LPC2148 Microcontroller

More Related Content

What's hot

Design challenges in embedded systems
Design challenges in embedded systemsDesign challenges in embedded systems
Design challenges in embedded systemsmahalakshmimalini
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systemsRAMPRAKASHT1
 
Semiconductor memories
Semiconductor memoriesSemiconductor memories
Semiconductor memoriesSambitShreeman
 
Unit 1 introduction to software defined radios
Unit 1   introduction to software defined radiosUnit 1   introduction to software defined radios
Unit 1 introduction to software defined radiosJAIGANESH SEKAR
 
Real Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsReal Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsHariharan Ganesan
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulationAhmed Diaa
 
Embedded system design challenges
Embedded system design challenges Embedded system design challenges
Embedded system design challenges Aditya Kamble
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051SARITHA REDDY
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerSudhanshu Janwadkar
 
Automatic chocolate vending machine using mucos rtos ppt
Automatic chocolate vending machine using mucos rtos pptAutomatic chocolate vending machine using mucos rtos ppt
Automatic chocolate vending machine using mucos rtos pptJOLLUSUDARSHANREDDY
 

What's hot (20)

TMS320C5x
TMS320C5xTMS320C5x
TMS320C5x
 
Spread spectrum
Spread spectrumSpread spectrum
Spread spectrum
 
Design challenges in embedded systems
Design challenges in embedded systemsDesign challenges in embedded systems
Design challenges in embedded systems
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systems
 
Semiconductor memories
Semiconductor memoriesSemiconductor memories
Semiconductor memories
 
OFDM
OFDMOFDM
OFDM
 
Unit 1 introduction to software defined radios
Unit 1   introduction to software defined radiosUnit 1   introduction to software defined radios
Unit 1 introduction to software defined radios
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
8051 serial communication-UART
8051 serial communication-UART8051 serial communication-UART
8051 serial communication-UART
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
Real Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systemsReal Time Operating system (RTOS) - Embedded systems
Real Time Operating system (RTOS) - Embedded systems
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
 
Embedded system design challenges
Embedded system design challenges Embedded system design challenges
Embedded system design challenges
 
EC8791 UML-model train controller
EC8791 UML-model train controllerEC8791 UML-model train controller
EC8791 UML-model train controller
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Unit vi (2)
Unit vi (2)Unit vi (2)
Unit vi (2)
 
Fault tolerance techniques
Fault tolerance techniquesFault tolerance techniques
Fault tolerance techniques
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 Microcontroller
 
Automatic chocolate vending machine using mucos rtos ppt
Automatic chocolate vending machine using mucos rtos pptAutomatic chocolate vending machine using mucos rtos ppt
Automatic chocolate vending machine using mucos rtos ppt
 

Similar to RMK College PWM Module for LPC2148 Microcontroller

Pulse Width Modulator duty
Pulse Width Modulator dutyPulse Width Modulator duty
Pulse Width Modulator dutyyc2levgmail
 
Microprocessor and Controller
Microprocessor and ControllerMicroprocessor and Controller
Microprocessor and ControllerBHAVYA DOSHI
 
Lecture Notes: EEEC6440315 Communication Systems - Pulse Time Modulation
Lecture Notes:  EEEC6440315 Communication Systems - Pulse Time ModulationLecture Notes:  EEEC6440315 Communication Systems - Pulse Time Modulation
Lecture Notes: EEEC6440315 Communication Systems - Pulse Time ModulationAIMST University
 
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...IJERD Editor
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar Sanchez
 
PWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfPWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfDuyKhng31
 
Temp based fan speed control
Temp based fan speed controlTemp based fan speed control
Temp based fan speed controlSai Malleswar
 
Modem synchronization and control
Modem synchronization and controlModem synchronization and control
Modem synchronization and controlsirish2chandraa
 
Design of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCEDesign of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCEnandivashishth
 

Similar to RMK College PWM Module for LPC2148 Microcontroller (20)

Pulse Width Modulator duty
Pulse Width Modulator dutyPulse Width Modulator duty
Pulse Width Modulator duty
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
PWM in ARM LPC2148.pptx
PWM in ARM LPC2148.pptxPWM in ARM LPC2148.pptx
PWM in ARM LPC2148.pptx
 
Pwm ppm no1
Pwm ppm no1Pwm ppm no1
Pwm ppm no1
 
5 STM32's TIMER.ppt
5 STM32's TIMER.ppt5 STM32's TIMER.ppt
5 STM32's TIMER.ppt
 
Microprocessor and Controller
Microprocessor and ControllerMicroprocessor and Controller
Microprocessor and Controller
 
G010334953
G010334953G010334953
G010334953
 
ARRHYTHMIA.pptx
ARRHYTHMIA.pptxARRHYTHMIA.pptx
ARRHYTHMIA.pptx
 
Lecture Notes: EEEC6440315 Communication Systems - Pulse Time Modulation
Lecture Notes:  EEEC6440315 Communication Systems - Pulse Time ModulationLecture Notes:  EEEC6440315 Communication Systems - Pulse Time Modulation
Lecture Notes: EEEC6440315 Communication Systems - Pulse Time Modulation
 
PWM_F09.ppt
PWM_F09.pptPWM_F09.ppt
PWM_F09.ppt
 
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...
IJERD (www.ijerd.com) International Journal of Engineering Research and Devel...
 
Kf3617641768
Kf3617641768Kf3617641768
Kf3617641768
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
PWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdfPWM_LDT20CDT222222222222222222222222.pdf
PWM_LDT20CDT222222222222222222222222.pdf
 
Temp based fan speed control
Temp based fan speed controlTemp based fan speed control
Temp based fan speed control
 
Modem synchronization and control
Modem synchronization and controlModem synchronization and control
Modem synchronization and control
 
Design of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCEDesign of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCE
 
Timers and pwm
Timers and pwmTimers and pwm
Timers and pwm
 

More from RajalakshmiSermadurai

More from RajalakshmiSermadurai (15)

Ec8791 arm 9 processor
Ec8791 arm 9 processorEc8791 arm 9 processor
Ec8791 arm 9 processor
 
Ec8791 lpc2148 uart
Ec8791 lpc2148 uartEc8791 lpc2148 uart
Ec8791 lpc2148 uart
 
Ec8791 lpc2148
Ec8791 lpc2148Ec8791 lpc2148
Ec8791 lpc2148
 
Ec8791 lpc2148 timer unit
Ec8791 lpc2148 timer unitEc8791 lpc2148 timer unit
Ec8791 lpc2148 timer unit
 
EC8791 consumer electronics-platform level performance analysis
EC8791 consumer electronics-platform level performance analysisEC8791 consumer electronics-platform level performance analysis
EC8791 consumer electronics-platform level performance analysis
 
EC8791 designing with computing platform
EC8791 designing with computing platformEC8791 designing with computing platform
EC8791 designing with computing platform
 
EC8791 Design Methodologies
EC8791 Design MethodologiesEC8791 Design Methodologies
EC8791 Design Methodologies
 
EC8791 Requirement-Specifications-Quality assurance techniques
EC8791 Requirement-Specifications-Quality assurance techniquesEC8791 Requirement-Specifications-Quality assurance techniques
EC8791 Requirement-Specifications-Quality assurance techniques
 
Ec8791 unit 5 processes and operating systems
Ec8791 unit 5 processes and operating systemsEc8791 unit 5 processes and operating systems
Ec8791 unit 5 processes and operating systems
 
Task assignment and scheduling
Task assignment and schedulingTask assignment and scheduling
Task assignment and scheduling
 
Estimating program run time
Estimating program run timeEstimating program run time
Estimating program run time
 
Introduction and structure of a real time system
Introduction and structure of a real time systemIntroduction and structure of a real time system
Introduction and structure of a real time system
 
Embedded system design process
Embedded system design processEmbedded system design process
Embedded system design process
 
Embedded system introduction
Embedded system introductionEmbedded system introduction
Embedded system introduction
 
EC6703 unit-4
EC6703 unit-4EC6703 unit-4
EC6703 unit-4
 

Recently uploaded

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 

RMK College PWM Module for LPC2148 Microcontroller

  • 1. RMK COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC8791 EMBEDDED AND REAL TIME SYSTEMS S. Rajalakshmi AP/ECE
  • 2. LPC2148 PULSE WIDTH MODULATION Technique by which width of a pulse is varied while keeping the frequency constant. A period of a pulse consists of an ON cycle (HIGH) and an OFF cycle (LOW). The fraction for which the signal is ON over a period is known as duty cycle. Consider a pulse with a period of 10ms which remains ON (high) for 2ms. The duty cycle of this pulse will be D = (2ms / 10ms) x 100 = 20% Through PWM technique, we can control the power delivered to the load by using ON-OFF
  • 3. Pulse Width Modulated signals with different duty cycle
  • 4. LPC2148 supports two types of controlled PWM outputs Single Edge Controlled PWM All the rising (positive going) edges of the output waveform are positioned/fixed at the beginning of PWM period. Only falling (negative going) edge position can be controlled to vary the pulse width of PWM. Double Edge Controlled PWM All the rising (positive going) and falling (negative going) edge positions can be controlled to vary the pulse width of PWM. Both the rising as well as the falling edges can be positioned anywhere in the PWM period.
  • 5. LPC2148 PWM The PWM in LPC2148 is based on standard 32-bit Timer Counter, i.e. PWMTC (PWM Timer Counter). This Timer Counter counts the cycles of peripheral clock (PCLK). Timer clock counts can be scaled using 32-bit PWM Prescale Register (PWMPR). LPC2148 has 7 PWM match registers (PWMMR0 – PWMMR06). One match register (PWMMR0) is used to set PWM frequency. Remaining 6 match registers are used to set PWM width for 6 different PWM signals in Single Edge Controlled PWM or 3 different PWM signals in Double Edge Controlled PWM. Whenever PWM Timer Counter (PWMTC) matches with these Match Registers then, PWM Timer Counter resets, or stops, or generates match interrupt, depending upon settings in PWM Match Control Register(PWMMCR).
  • 6.
  • 7.  PWMMR0 = 6 i.e. PWM period is 6 counts, after which PWM Timer Counter resets.  PWM2 & PWM3 are configured as Single Edge Controlled PWM and PWM5 is configured as Double Edge Controlled PWM.  Prescaler is set to increment PWM Timer Counter after every two Peripheral clocks (PCLK).  Match registers (PWMMR2 & PWMMR3) are used to set falling edge position for PWM2 & PWM3.  PWMMR4 & PWMMR5 are used to set rising & falling edge positions respectively for PWM5.
  • 8. The table given below shows when the PWM is Set (Rising Edge) and Reset (Falling Edge) for different PWM channels using 7 Match Register.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Steps for PWM generation  Reset and disable PWM counter using PWMTCR  Load prescale value according to need of application in the PWMPR  Load PWMMR0 with a value corresponding to the time period of your PWM wave  Load any one of the remaining six match registers (two of the remaining six match registers for double edge controlled PWM) with the ON duration of the PWM cycle. (PWM will be generated on PWM pin corresponding to the match register you load the value with).  Load PWMMCR with a value based on the action to be taken in the event of a match between match register and PWM timer counter.  Enable PWM match latch for the match registers used with the help of PWMLER  Select the type of PWM wave (single edge or double edge controlled) and which PWMs to be enabled using PWMPCR  Enable PWM and PWM counter using PWMTCR