electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

pulse width modulation


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> pulse width modulation
Author Message
cai2



Joined: 30 Nov 2006
Posts: 60
Helped: 1


Post19 Sep 2007 8:03   

pulse width modulation


please help...can i use pulse width modulation with 89c2051 microcontroller?...and if, how can it be?...Crying or Very sad
Back to top
Darth Maul



Joined: 19 Jul 2007
Posts: 19
Helped: 2
Location: Yogyakarta, Indonesia


Post19 Sep 2007 11:14   

Re: pulse width modulation


yeah you can. you can use a timer and any port pin. the timer set the pin high for some duration of time, and reset it low for the rest of the time in one cycle. repeat it again infinitely. the required duty cycle is adjusted by setting the duration the pin set high compared to the duration it is pulled low. the switching frequency is determined by the length of one cycle.

so for example, if you want to drive a dc motor with switching frequency of 200 hz, then the length of one cycle is 1/200 = 5 ms, here is the code (i'm using sdcc):

#include <at89x2051.h>
void delay(unsigned char t) /* t in .1 ms */

void main(void){
unsigned char dutycycle;

/*
some code
*/

while(1){
dutycycle = P1;
/*
assuming dutycycle is determined by values inputted by user through P1
with precaution so as not to exceed 50
*/
P3_0 = 1;
delay(dutycycle);
P3_0 = 0;
delay(50 - dutycycle);
}

/*
other code
*/

this way, if you want a dutycycle of 50%, then P3_0 should be on for 2.5 ms (call delay with argument 25) and off for the next 2.5 ms. 20% means P3_0 on for 1 ms (call delay(10)Wink and off for 4 ms (call delay(40)Wink.
there are certainly other better ways to implement pwm on 89x2051 uC, it's just one popped out of my head, so please cmiiw.
Back to top
vijaya_narayana



Joined: 12 Jun 2007
Posts: 147
Helped: 9


Post19 Sep 2007 14:23   

Re: pulse width modulation


yes u can generate PWM using 89C2051 you can use the two timers for this.I think there is an application note for PWM u can try in google search
Back to top
Google
AdSense
Google Adsense




Post19 Sep 2007 14:23   

Ads




Back to top
cai2



Joined: 30 Nov 2006
Posts: 60
Helped: 1


Post24 Sep 2007 4:40   

Re: pulse width modulation


can i apply it on a 3 phase induction motor using this microcontroller?
Back to top
Darth Maul



Joined: 19 Jul 2007
Posts: 19
Helped: 2
Location: Yogyakarta, Indonesia


Post02 Oct 2007 3:51   

Re: pulse width modulation


induction motor is an ac motor, so to control its speed you must vary the ac voltage frequency. you can do this by pwm, but instead of having the pwm to vary the voltage level, you must vary the frequency AND voltage. try consulting on books about electric machinery, such as stephen chapman's. sorry can't help you much more on this.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> pulse width modulation
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Pulse width modulation (19)
Pulse Width Modulation (5)
Pulse Width Modulation (1)
Pulse Width Modulation (1)
Pulse width modulation (4)
Pulse width modulation (2)
pulse width modulation (6)
Pulse Width Modulation (PWM) circuit (3)
Pulse Width Modulation DC Motor Control (7)
Measuring Pulse width modulation PWM (11)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS