Code:
SineCounter = 0;
static int Sine[]; // declared so only called once
//## Sine table => 100off values
const rom int Sine[] = {512,544,576,608,639,670,700,730,759,786,813,838,862,885,907,926,944,961,975,988,999,1008,1015,1020,1023,1023,
1023,1020,1015,1008,999,988,975,961,944,926,907,885,862,838,813,786,759,730,700,670,639,608,576,544,512,
480,448,416,385,354,324,294,265,238,211,186,162,139,117,98,80,63,49,36,25,16,9,4,1,1,1,
4,9,16,25,36,49,63,80,98,117,139,162,186,211,238,265,294,324,354,385,416,448,480};
void PWM_Main (void)
if (SineCounter == 99)
{
SineCounter = 0;
}
else
{
DutyCycleReg = Sine[SineCounter]; //IS THIS CORRECT???????
}
SineCounter++;
}
void "turn on PWM o/ps"(void)v.............
{
PWM ctrl.....
}
Repeat.............
######################