Google

Mar 10, 2010

PWM with 89S52

Here is the program for Pulse width modulation PWM on basic for 89s52.

You could generate pwm using the following psedocode

#define high_period
#define low_period

main()
{
!!Code to initiate the timer;
!!Timer counter register value = high_period;
!!set port pin high
!!start timer
while(1);
}

interrupt void time_interrupt_routine(void)
{
if(port pin is high)
!!Timer counter register value = low_period;

else
!!Timer counter register value = high_period;

!!Toggle port pin
!! start timer;
}

Here high_period + low_period gives the time period in terms of clock cycle and

high_period/(high_period + low_period) *100 gives the dutycycle.

6 comments:

Rahulraj said...

microprocessorforyou.blogspot.com

its a best site to learn 8085 and 8086 microprocessor with progeamming.

Rahulraj said...

microprocessorforyou.blogspot.com

its a best site to learn 8085 and 8086 microprocessor with programming.

Unknown said...

nice stuff sir,
keeps going :)
you can also follow my website about microprocessor
http://microprocessorforyou.blogspot.com

Selva said...

Really you have done a good job. Thanks for sharing this valuable information.
Embedded System Courses in Chennai
Embedded Course in Coimbatore
Embedded Training in Chennai

Dhilshan said...

Happy to read the informative blog. Thanks for sharing
best selenium training center in chennai
best training institute for selenium in chennai

David Fincher said...

This post is so interactive and informative.keep update more information...
Tally Course in Velachery
Tally course in Chennai