sd5 舵机问题
时间:10-02
整理:3721RD
点击:
int main(void)
{
uint32_t FTMDuty = 0;
FTM_InitTypeDef FTM_InitStruct1;
//3?ê??ˉ?μí3ê±?ó ê1ó?ía2?50M?§?? PLL±??μμ?100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
//3?ê??ˉFTM
FTM_InitStruct1.Frequency = 200; // 200HZ
FTM_InitStruct1.FTMxMAP = FTM0_CH0_PC1; //FTM0_CH0 PC1òy??
FTM_InitStruct1.FTM_Mode = FTM_Mode_EdgeAligned; //±????????£ê?
FTM_InitStruct1.InitalDuty = 500; //3?ê??ˉoó2úéú6%μ?????±è
FTM_Init(&FTM_InitStruct1);
while(1)
{
FTMDuty += 100;
if(FTMDuty==1200)
FTMDuty=500;
FTM_PWM_ChangeDuty(FTM0_CH0_PC1,FTMDuty); //FTMDUTY±??ˉ
DelayMs(500);
}
}
舵机不转
{
uint32_t FTMDuty = 0;
FTM_InitTypeDef FTM_InitStruct1;
//3?ê??ˉ?μí3ê±?ó ê1ó?ía2?50M?§?? PLL±??μμ?100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
//3?ê??ˉFTM
FTM_InitStruct1.Frequency = 200; // 200HZ
FTM_InitStruct1.FTMxMAP = FTM0_CH0_PC1; //FTM0_CH0 PC1òy??
FTM_InitStruct1.FTM_Mode = FTM_Mode_EdgeAligned; //±????????£ê?
FTM_InitStruct1.InitalDuty = 500; //3?ê??ˉoó2úéú6%μ?????±è
FTM_Init(&FTM_InitStruct1);
while(1)
{
FTMDuty += 100;
if(FTMDuty==1200)
FTMDuty=500;
FTM_PWM_ChangeDuty(FTM0_CH0_PC1,FTMDuty); //FTMDUTY±??ˉ
DelayMs(500);
}
}
舵机不转
频率不对。改成300HZ。试一试。还有供电要注意。