PWM_Init(void)
{
//初始化
PWMPRCLK_PCKA
=
0x2
/*16383000Hz/2=8192000Hz
*/
PWMPRCLK_PCKB
=
0x2
/*8192000Hz/4
=2048000Hz
*/
PWMCTL_CON01
=
0X1
/*
0
&
1
成
16位精度PWM工作
*/
PWMPOL_PPOL1
=
0x1
/*
极性为先高后低
与占空比相同
*/
PWMCAE
=
0x00
/*
operate
in
left
aligned
output
mode.
*/
}
void
setPWM01(word
per,byte
start)
{
per
=
(word)(2048000/per)
PWMPER01
=
(word)per
/*
设置脉冲周期
*/
PWMDTY01
=
(word)(per/2)
/*
设置脉冲占空比为50%
*/
if(start==1)PWME_PWME1
=
1
/*
脉冲发送开始
*/
else
PWME_PWME1
=
0
/*
脉冲停止发送
*/闹稿
}
发脉碰败冲时调用
setPWM01(频液吵孝率,1)
你可前握源以皮指看看野火写的三慧态天入门Coretex-M4的文档,详见百度知道链接:http://zhidao.baidu.com/share/6a268d1c08b24ea4aade8d34ea62aa47.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)