mc9s12xs128单片机控制的舵机程序
1个回答
展开全部
void PIT_Init(void)//定时中断初始化函数 0.01s=10ms定时中断设置
{
PITCFLMT_PITE=0;
PITCE_PCE0=1;
PITMTLD0=240-1;
PITLD0=2000-1;
PITINTE_PINTE0=1;
PITCFLMT_PITE=1;
}
/*void PWM_Init(void)
{
//CH01 Motor In1
//CH23 Motor In2
//SB,B for ch2367
//SA,A for ch0145
PWME = 0x00;
PWMCTL = 0x00;
PWMCAE = 0x00;
PWMPOL = 0xFF;
PWMPRCLK = 0x33; //8分频 A,B为6MHZ
PWMSCLA = 0x03; //6分频,SA为1MHZ
PWMSCLB = 0x03;
PWMCLK = 0xFF;
PWMPER1=1000;
PWMDTY1=0;
PWMPER3=1000;
PWMDTY3=0;
PWMCNT1 = 0;
PWMCNT3 = 0;
PWME = 0x2A;}*/
static void PWM_Init(void)
{
{
PITCFLMT_PITE=0;
PITCE_PCE0=1;
PITMTLD0=240-1;
PITLD0=2000-1;
PITINTE_PINTE0=1;
PITCFLMT_PITE=1;
}
/*void PWM_Init(void)
{
//CH01 Motor In1
//CH23 Motor In2
//SB,B for ch2367
//SA,A for ch0145
PWME = 0x00;
PWMCTL = 0x00;
PWMCAE = 0x00;
PWMPOL = 0xFF;
PWMPRCLK = 0x33; //8分频 A,B为6MHZ
PWMSCLA = 0x03; //6分频,SA为1MHZ
PWMSCLB = 0x03;
PWMCLK = 0xFF;
PWMPER1=1000;
PWMDTY1=0;
PWMPER3=1000;
PWMDTY3=0;
PWMCNT1 = 0;
PWMCNT3 = 0;
PWME = 0x2A;}*/
static void PWM_Init(void)
{
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询