How can I use 8051 I/O pins to emulate PWM output signal?

Hi Everyone:
I am from China.I have a question
that is need your help.That is I wanted
to use some 8051 pins to emulate PWM
output signals,please tell me source program about KEIL C for 8051.Thank you!

yours truly
JianJian

Parents
  • Hi Jian Jian!

    Well, many C51 derivates have PWM on chip. Other than that, yopu can do that with a timer interrupt. Trigger the interrupt of the timer like every mili second and then count the HIGH and LOW times of your signal with a counter... teh resolution will not be really great, but for some purposes it works... you can sure set the resolution to less than a milli second of course, but when it is too short, you will spend all processor time for the PWM signals.

    Take care,
    Sven

Reply
  • Hi Jian Jian!

    Well, many C51 derivates have PWM on chip. Other than that, yopu can do that with a timer interrupt. Trigger the interrupt of the timer like every mili second and then count the HIGH and LOW times of your signal with a counter... teh resolution will not be really great, but for some purposes it works... you can sure set the resolution to less than a milli second of course, but when it is too short, you will spend all processor time for the PWM signals.

    Take care,
    Sven

Children
No data
More questions in this forum