Login / Signup

PWM (Pulse Width Modulation) Overview

  • user warning: Table './devemc/sessions' is marked as crashed and last (automatic?) repair failed query: SELECT COUNT(sid) AS count FROM sessions WHERE timestamp >= 1422300249 AND uid = 0 in /home/devemc/public_html/dev/includes/session.inc on line 157.
  • user warning: Table './devemc/sessions' is marked as crashed and last (automatic?) repair failed query: SELECT COUNT(DISTINCT s.uid) FROM sessions s WHERE s.timestamp >= 1422300249 AND s.uid > 0 in /home/devemc/public_html/dev/modules/user/user.module on line 790.
PWM (Pulse Width Modulation) Overview

PWM (Pulse Width Modulation) Overview

The difference T- λ represents the time when the system is in off state (“logic state 0”).

PWM Representation
Fig.1 PWM Representation

D = λ / T

The duty cycle can have a value in the [0:1] interval. The average power transferred to the load (controlled device) is directly proportional with the value of D. When D=0 the power transmitted is null, as a matter of fact the circuit is off. On the other hand the load can be in full power when D=1.

2.PWM Advantages/Disadvantages
The PWM efficiency is always compared with the efficiency of a power resistive circuit. For a load which requires 50% level of power a PWM circuit will use exactly 50% of the power, while a resistive circuit will need 70-80% level power because 20-30% will be waste as heating power.
Disadvantages for PWM are cost and complexity of the circuit which generates it, moreover can be a source of radio frequency interference (RFI) on the global circuit, because PWM is a periodic signal.

3.Example of PWM Utilization
Using the PIC16F876A microcontroller for generating a PWM signal:
The CCP module (Capture/Compare/PWM) is responsible for the PWM functionality. One of the functions for the 16-bit register is PWM Master/Slave Duty Cycle.

PWM Block Diagram for PIC 16F987A
Fig.2 PWM Block Diagram for PIC 16F987A

The PWM output signal is determined by period (time base) and the time while the output is logic "1". The frequency of the PWM signal is 1/T, where T is the period.

PWM Output
Fig.3 PWM Output

This is how to program the PWM period and PWM duty-cycle values:

PWM period = [(PR2) + 1] • 4 • TOSC •(TMR2 prescale value)
PWM duty cycle =(CCPR1L:CCP1CON<5:4>) •TOSC • (TMR2 prescale value)

Defining the function for PWM module initialization:

void InitPWM()	/* init PWM mode */
CCP1CON=0;		/*  reset CCP1 module */
CCP2CON=0;		/*  reset CCP2 module  */
T2CON=0b00000010;  	/* postscaler=1:1; timer2=OFF; prescaler=1:16 */
TMR2=0;	              /* reset Timer2
PR2=0xFF;		/* Period: 256 x 16 x 4 x 0.05us=0.8192ms
/* PWM period=[(PR2) + 1]x(TMR2 prescale value)x4xTOSC
CCP1CON=0b00001100; 	/* select PWM mode */
CCPR1L=0x00;		/* PWM duty cycle=(CCPR1L:CCP1CON<5:4>)xTOSCx(TMR2 prescale value) */
TMR2ON=1;                     /* Timer2 ON */
void PWM1(unsigned int period, unsigned char factor)
if(period <= 255) {
T2CKPS0=0;	/* prescaler=1 */
PR2=(unsigned char)period;
} else if(perioad>255 && period<=1023) {
T2CKPS0=1;	/* prescaler=4 */
PR2=(unsigned char)(period/4);
} else if(period>1023 && period<=4095) {
T2CKPS1=1;	/* prescaler=16 */
PR2=(unsigned char)(period/16);
void main(void)
TRISC=TRISC & 0b11111001;
InitPWM();	      /* init PWM mode */

4.PWM Application
PWM is very often used for DC motor controlling or light intensity. The control is made with a MOSFET transistor because, unlike to bipolar transistors, it has a low on-resistance and high current carrying capability. A more professional solution is the dedicated MOSFET driver because it is easier to use and also have an internal protection against shoot-through current.



PWM Lamp and Cooler Controller
Fig.4 PWM Lamp and Cooler Controller

Who's online

There are currently users and guests online.

Recent comments