ADSP-21368 SHARC Processor Hardware Reference 8-21
Pulse Width Modulation
Programming Example
The following program shows the four steps used to configure a PWM
module.
Listing 8-1. Generic PWM Configuration Example
#include "def21369.h"
.global start;
/* define for PWM frequency used in PWMPERIOD0 */
#define fPWM 0x1388; /* 200MHz/2(20kHz) => 50us */
.section/pm seg_pmco;
start:
call default_int_enable;
call PWM_setup;
call PWM_enables;
nop;
finish: jump finish;
start.end: nop;
/* enable interrupts */
default_int_enable:
LIRPTL = 0;
IRPTL = 0;
bit set MODE1 IRPTEN; /* Global interrupt enable
bit set LIRPTL P13IMSK; /* Enable PWM default interrupt -
location 13 */
default_int_enable.end: rts;
/* PWM setup registers */
PWM_setup: