How to make pwm in pic16f877a?

ErnieM

Joined Apr 24, 2011
7,992
Did you notice how they jumped from India common 16F877A to 555?
I steered him onto that. Using a 555 is a bit of a personal private joke for me.

Of course, I would build a PWM out of a PIC long George I'd pick up a 555 anyway.
 

OBW0549

Joined Mar 2, 2015
2,977
If generating a PWM using a PIC16F877 is too complicated, and a 555 is also too complicated, try an LTC6992-- a single-chip PWM generator with only three external parts. The frequency of the PWM output is programmed with a single resistor plus a pair of resistors arranged as a voltage divider. A 0-1 volt input controls the duty cycle of the PWM.

It doesn't get any simpler than that. If it's too complicated for you, you probably shouldn't be playing with electronics. And don't bother asking for the circuit or how to use it-- I'm not going to explain it to you. Read the data sheet instead, as it explains everything.
 

ErnieM

Joined Apr 24, 2011
7,992
how to understand and build basic pwm without 555
diffrent wave form like sawtoth
For that you just need a comparator, similar to an op amp where the output is high when the + input is greater than the - input, and the output is low when + in is lower than - in.

The sawtooth or any linear wave is applied to the + in, and the control voltage to the - in.

When control < sawtooth you get a constant high out. 100% pulse

When control > sawtooth you get a constant low out. 0% pulse

When control between the min and max of the sawtooth you get a controlled pulse width between 0 and 100%

pwm.gif
 

Thread Starter

embedded29

Joined Apr 8, 2017
72
hello,
i have done it is working what is theory behind it and how to build sawtoth wave and triangular waveform..
 
Top