LED Brightness Control Using PWM of LPC2138: ESD Lab Mini-Project
LED Brightness Control Using PWM of LPC2138: ESD Lab Mini-Project
ENCHANGE LANGUAGE
Upload
Read free for 30 days
User Settings
Skip carousel
What is Scribd?
Documents(selected)
Download now
Jump to Page
You are on page 2of 8
Search inside document
0 ratings0% found this document useful (0 votes)
236 views8 pages
ESD Lab
Mini-
Project
LED
Brig
htne
ssCo
ntro
l
Usin
g
PW
MO
f
LPC
213
8
Pritam
Kondekar
(2013BEN005
)Aditya
Gadgil (2013B
EN007)Pavan
Chopade(2013
BEN008)11-2-
2015
LED Brightness
Control Using PWM
Of LPC2138
1|
Page
Problem
Statement-
To control the
brightness of
the LED
using the
PWM, duty
cycle of which
isvaried by
using the
pot connected
to LPC2138.
PWM of
LPC2138-
PWM (Pulse
Width
Modulation)
enables the user
to produce
the rectangular
wave ofdifferent
and desired duty
cycles. The
match facility in
the LPC2138 is
used for
producing
theoutput. There
are two types of
the PWM- Single
edge controlled
and dual edge
controlled.
Thesingle edge
controlled PWM,
as the name
suggests, the user
can control only
one
edge, and thuscan
control only the
ON Time of the
PWM Wave.
While the dual
edge controlled
facilitates
thecontrol of both
ON Time and
OFF Time.
Steps To
Control the
LED Brightne
ss-
Using ADC to
input the value-
1.
Connect the
potmeter to the
ADC input pin,
the value of the
pot will be
multiplied by
thestep size to
calculate the
cycles in the ON
time.
Enabling and
Operating PWM
1.
2|
Page
Calculations-
The ON time of
the PWM is
decided by the
value of the pot,
which is
connected to
theADC input of
the LPC2138. The
ADC value is
multiplied by the
step size
calculated. We
keepMR0 (Match
Register 0 which
holds the total
PWM period) at
60000.Step Size =
60,000/1024ON
Time value = step
size*the ADC
value
ADDownload to read ad-free.
LED Brightness
Control Using PWM
Of LPC2138
3|
Page
Code-
#include<lpc
213x.h>void
delay(){int
i,j;for(i=0;i<
200;i++){ fo
r(j=0;j<105;
j++)
{}}}void
ADC_init()
{PINSEL0=0
X300000; //
Selected
the ADC
1AD1CR=0X
200104; //A
DC
1 Enabled}v
oid
genpwm(uns
igned int
ton)
{PINSEL0=0
x02; //P0.0
as PWMPWM
PCR=0x200;
//Single edg
ePWMMCR=0
x002; //
Reset on MR
0PWMMR0=6
0000; //
Total periodP
WMMR1=ton
; //On timeP
WMLER=0x0
1; //For MR0
PWMTCR=0x
02; //Reset t
imerPWMTCR
=0x09; //
Enable timer
and pwm}int
ADC_read(u
nsigned char
ch)
{unsigned
int
value;AD1CR
|=1<<ch; //
channel 2del
ay();AD1DR
&=0X7FFFFF
FF;//clear
done bitAD1
CR|
=0X0100000
0;//start con
versionwhile(
!
(AD1DR&0X8
0000000));//
wait
for eocvalue
=(AD1DR&0
XFCC0)>>6;
//store
acquired val
uereturn
value;}int
main()
{unsigned
int
value,ton;
ADDownload to read ad-free.
LED Brightness
Control Using PWM
Of LPC2138
4|
Page
ADC_init();//
Init
ADCwhile(1)
{value=ADC
_read(2);ton
=((60000*va
lue)/1024);/
/ON timegen
pwm(ton);}}
Observations-
Pin Connect
Block-
ADDownload to read ad-free.
LED Brightness
Control Using PWM
Of LPC2138
5|
Page
ADC Control-
PWM Wave-
ADDownload to read ad-free.
LED Brightness
Control Using PWM
Of LPC2138
6|
Page
Circuit
Diagram-
ADDownload to read ad-free.
LED Brightness
Control Using PWM
Of LPC2138
7|
Page
Document4 pages
Microcontroller Based Sinusoidal PWM Inverter For Photovoltaic
Application
Dumitrescu Camil Sorin
No ratings yet
3 Power LED Dimmer Using ATmega32 Microcontroller
Document5 pages
Document7 pages
Document5 pages
Document26 pages
Adc PWM
Shivaram Reddy Manchireddy
No ratings yet
16-B PWM U O - C T Relevant Devices: IT Sing AN N HIP Imer
Document12 pages
Document29 pages
Document17 pages
PWM
maintboard
No ratings yet
PWMC - Pulse Width Modulation Controller
Document19 pages
Document19 pages
CCP PWM
alaa_saq
100% (1)
TOPIC 5 - PWM
Document23 pages
TOPIC 5 - PWM
Muhammad Waqiuddin
No ratings yet
MCES - 18CS44 - Unit4 PWM - DCMotor
Document9 pages
Document9 pages
Document7 pages
Hobby Servo Motor Control Via PIC Pulse Width Modulation: Nathan
Markey April 4, 2003
Luciana Gutierrez Salazar
100% (1)
Digital Stethoscope
Document4 pages
Digital Stethoscope
Dhaval Shah
No ratings yet
Slaa 116
Document21 pages
Slaa 116
misaelrodrigo
No ratings yet
Sine Wave Generation and Implementation Using dsPIC33FJ
Document27 pages
Document6 pages
M4 Micro OneNote
Aryan Rai
No ratings yet
Secrets of Arduino PWM
Document20 pages
Document14 pages
Document18 pages
Assignment 3
Bhakti Kalyankasture
No ratings yet
AN0357
Document18 pages
AN0357
facebookgerrit
No ratings yet
Understanding Pulse Width Modulation (PWM) and its Implementation on Arduino
Document54 pages
Document6 pages
Document10 pages
Atmel PWM Fan Control
Arijan Bogović
No ratings yet
Microcontrollers Lab
Document19 pages
Microcontrollers Lab
AMARNATHNAIDU77
No ratings yet
Safari - 13 Mai 2023 À 09:40
Document1 page
Document7 pages
Document20 pages
Document27 pages
Document5 pages
Document8 pages
Secrets of Arduino PWM
pcrmenge
No ratings yet
Direct Power Control of Three-Phase PWM Rectifiers Using Backstepping Control
Document8 pages
Document8 pages
PWM Registers
Ashok Kumar
No ratings yet
Part Nine - Pulse Width Modulation (PWM)
Document8 pages
Document11 pages
Document5 pages
DSP Gate
bodige123
No ratings yet
Eeol 2007aug13 Pow Ems Opt An PDF
Document22 pages
Document15 pages
Generating PWM With PIC Microcontroller - MikroC Pro
devchandar
100% (1)
CHAPTER 5 Hardware Interfacing
Document51 pages
Document27 pages
Embedded Day 2
199SARAS MISHRA
No ratings yet
Implementation of A Pid Controller Embedded in A Fpga For Positioning A DC
Motor
Document6 pages
Document50 pages
Document16 pages
Document12 pages
Document1 page
2
Dharan
No ratings yet
Microcontroller Based Digital Trigger Circuit For Converter
Document7 pages
Document11 pages
CCP Module
Altaaf Mulani
100% (1)
Analog Dialogue, Volume 45, Number 4
From Everand
Analog Dialogue, Volume 45, Number 4
Analog Dialogue
No ratings yet
Circuit bench - 100 shields for arduino
From Everand
Circuit bench - 100 shields for arduino
Newton C. Braga
No ratings yet
Correct Maintenance - Cognex DataMan 8500
From Everand
Correct Maintenance - Cognex DataMan 8500
Unique Content
No ratings yet
Analog Dialogue, Volume 47, Number 4
From Everand
Analog Dialogue, Volume 47, Number 4
Analog Dialogue
No ratings yet
Reference Guide To Useful Electronic Circuits And Circuit Design Techniques - Part
1
From Everand
Reference Guide To Useful Electronic Circuits And Circuit Design
Techniques - Part 1
Kerwin Mathew
Rating: 2.5 out of 5 stars
2.5/5 (3)
Power Systems-On-Chip: Practical Aspects of Design
From Everand
Power Systems-On-Chip: Practical Aspects of Design
Bruno Allard
No ratings yet
Digital PDP15 Price List April, 1970
From Everand
Digital PDP15 Price List April, 1970
Archive Classics
Rating: 1 out of 5 stars
1/5 (1)
Digital Signal Processing Using the ARM Cortex M4
From Everand
Digital Signal Processing Using the ARM Cortex M4
Donald S. Reay
Rating: 1 out of 5 stars
1/5 (1)
Chapter4 Pipelining END FA11
Document84 pages
Document1 page
Summer Term Year 2014 15 Academic Calendar For Year 2015 16,
Semester I
Aditya Gadgil
No ratings yet
Getting Started With Labview
Document89 pages
Related titles
Skip carousel
Carousel Next
Document
0 ratings
Document
0 ratings
0 ratings
Document
0 ratings
Document
0 ratings
Adc PWM
Document
Adc PWM
Added by Shivaram Reddy Manchireddy
0 ratings
Document
0 ratings
Document
0 ratings
PWM
Document
PWM
Added by maintboard
0 ratings
0 ratings
CCP PWM
Document
CCP PWM
Added by alaa_saq
100%
TOPIC 5 - PWM
Document
TOPIC 5 - PWM
Added by Muhammad Waqiuddin
0 ratings
Document
0 ratings
Document
0 ratings
Hobby Servo Motor Control Via PIC Pulse Width Modulation: Nathan Markey April
4, 2003
Document
Hobby Servo Motor Control Via PIC Pulse Width Modulation: Nathan Markey
April 4, 2003
Added by Luciana Gutierrez Salazar
100%
Digital Stethoscope
Document
Digital Stethoscope
Added by Dhaval Shah
0 ratings
Slaa 116
Document
Slaa 116
Added by misaelrodrigo
0 ratings
Document
100%
M4 Micro OneNote
Document
M4 Micro OneNote
Added by Aryan Rai
0 ratings
Document
100%
0 ratings
Document
0 ratings
Assignment 3
Document
Assignment 3
Added by Bhakti Kalyankasture
0 ratings
AN0357
Document
AN0357
Added by facebookgerrit
0 ratings
Document
0 ratings
Document
0 ratings
Document
0 ratings
Microcontrollers Lab
Document
Microcontrollers Lab
Added by AMARNATHNAIDU77
0 ratings
Document
0 ratings
Document
0 ratings
Document
100%
Document
0 ratings
Document
100%
Document
0 ratings
Document
Document
0 ratings
Document
0 ratings
PWM Registers
Document
PWM Registers
Added by Ashok Kumar
0 ratings
0 ratings
Document
100%
DSP Gate
Document
DSP Gate
Added by bodige123
0 ratings
Document
0 ratings
Document
100%
Document
0 ratings
Embedded Day 2
Document
Embedded Day 2
Added by 199SARAS MISHRA
0 ratings
Document
Implementation of A Pid Controller Embedded in A Fpga For Positioning A DC
Motor
Added by Juan Pablo Rosales
0 ratings
Document
0 ratings
Document
0 ratings
Document
0 ratings
Document
2
Added by Dharan
0 ratings
Document
0 ratings
CCP Module
Document
CCP Module
Added by Altaaf Mulani
100%
From Everand
0 ratings
From Everand
byNewton C. Braga
0 ratings
From Everand
byUnique Content
0 ratings
From Everand
byAnalog Dialogue
0 ratings
Reference Guide To Useful Electronic Circuits And Circuit Design Techniques - Part
1
From Everand
byKerwin Mathew
2.5/5
From Everand
byBruno Allard
0 ratings
From Everand
byArchive Classics
1/5
byDonald S. Reay
1/5
Document
0 ratings
Summer Term Year 2014 15 Academic Calendar For Year 2015 16, Semester I
Document
Summer Term Year 2014 15 Academic Calendar For Year 2015 16, Semester
I
Added by Aditya Gadgil
0 ratings
Document
0 ratings
0% found this document useful
Document
0 ratings
Footer menu
Back to top
About
About Scribd
Everand: Ebooks & Audiobooks
SlideShare
Press
Join our team!
Contact us
Invite friends
Scribd for enterprise
Support
Help / FAQ
Accessibility
Purchase help
AdChoices
Legal
Terms
Privacy
Copyright
Cookie Preferences
Do not sell or share my personal information
Social
InstagramInstagram
TwitterTwitter
FacebookFacebook
PinterestPinterest
Documents
Language:
English