#include"PWM_int.h"
void timerA1_int();
void timerA2_int();
void timerA4_int();
void timerB2_int();
void PWM_int()
{
prc1=1;
invc0=0x1c;
invc1=0x32;
prc1=0;
trgsr=0x45;
timerA1_int();
timerA2_int();
timerA4_int();
timerB2_int();
}
void timerA1_int()
{
int count1=5;
ta1mr=0x52; //定时器A1为8分频,6mhz
ta1=0x0096; //占空比为50%
ta11=0x004b;
while(count1<0)
count1--;
ta11=0x004b;
ta1ic=0x01;
ta1s=1;
}
void timerA2_int() //定时器A2为8分频,6mhz
{ //占空比为40%
int count2=5;
ta2mr=0x52;
ta2=0x0096;
ta21=0x004b;
while(count2<0)
count2--;
ta21=0x004b;
ta2ic=0x01;
ta2s=1;
}
void timerA4_int() //定时器A4为8分频,6mhz
{ //占空比为40%
int count4=5;
ta4mr=0x52;
ta4=0x0096;
ta41=0x004b;
while(count4<0)
count4--;
ta41=0x004b;
ta4ic=0x01;
ta4s=1;
}
void timerB2_int() //定时器B2为8分频,6mhz,载波周期为10khz
{
tb2mr=0x40;
ictb2=2;
prc1=1;
tb2sc=0x00;
prc1=0;
tb2=0x012b;
tb2ic=0x01; //第一中断优先级
tb2s=1;
}
想问一下,为什么我写的三相pwm程序,对应端口无波形(端口已设置为输出)板子系列M16c62p