步进电机调速
你是怎么实现加减速的?用T型还是S型加减速,还是在软件中给定一系列频率来加减?
下面是执行加速的
if (motor->CurrPos >= Motor_GetAccTotal(motor->CurrSpd) )//(CurrPos这是走的步数,是重0开始的),要满足这个条件速度才变一次
{
if (motor->CurrSpd >= motor->CurrentAction.Speed)
{
///motor->CurrSpd = motor->MaxSpd;
motor->Status.tBits.SpeedStatus = e_MotorSpeed_Cons;
break;
}
motor->CurrSpd ++;
Motor_SetStepTimer(motor,1);//这个函数是取去对应的频率(也就是速度)(在这个数组里取SpdLevTab)
}
下面这是个速度表(也就是改变频率表)
uint32 SpdLevTab[]={
#ifdef NEW_SPEEDTAB
17578, 8789, 5859, 4395, 3516, 2930, 2511, 2197,
1953, 1758, 1758, 879, 586, 439, 352, 293,
251, 220, 195, 176, 160, 146, 135, 126,
117, 110, 103, 98, 93, 88, 84, 80,
76, 73, 70, 68, // 72, 73
#else
#if 0
///12000,6000,3000, 1500, 900, 700, 583, 468, // 1 ~ 8
432, 432, 416, 400, 400, 384, 483, 368,
368, 368, 352, 352, 352, 336, 336, 336, // 9
320, 320, 320, 320, 304, 304, 304, 304, // 17
288, 288, 288, 288, 272, 272, 256, 256, // 25
256, 192, 128, 96,
#else
7031, 7027, 7009, 6960, 6860, 6685, 6415, 6041, // 1~8
5570, 5022, 4434, 3843, 3282, 2772, 2324, 1942, // 9~16
1620, 1352, 1132, 950, 801, 678, 577, 493, // 17~24
423, 365, 316, 275, 240, 211, 185, 164, // 25
145, 129,
#endif
#endif
/*64, 56, 48, 40, // 36~ -- 76~
32, 30, 28, 26, 25, 24, 23, 23, // 41
29, 29, 29, 28, 27, 26, 25, 24, // 49
23, 22, 21, 20, 19, 18, 17, 16, // 57
31, 30, 29, 28, 27, 26, 25, 24, // 65
23, 22, 21, 20, 19, 18, 17, 16, // 73
31, 29, 27, 25, 23, 21, 19, 17, // 81
31, 30, 29, 28, 27, 26, 25, 24, // 89
23, 23, 22, 22, 21, 21, 20, 20, // 97
19, 19, 18, 18, 17, 17, 16, 16, // 105*/
64, 56, 48, 40, // 36~ -- 76~
32, 30, 28, 26, 25, 24, 23, 23, // 41
29, 29, 29, 28, 27, 26, 25, 24, // 49
23, 22, 21, 20, 19, 18, 17, 16, // 57
31, 30, 29, 28, 27, 26, 25, 24, // 65
23, 22, 21, 20, 19, 18, 17, 16, // 73
31, 29, 27, 25, 23, 21, 19, 17, // 81
31, 30, 29, 28, 27, 26, 25, 24, // 89
23, 23, 22, 22, 21, 21, 20, 20, // 97
19, 19, 18, 18, 17, 17, 16, 16, // 105
/*
115, 103, 93, 83, 75, 68, // 33
62, 56, 51, 47, 43, 39, 36, 33, // 41
30, 28, 26, 24, 22, 21, 19, 18, // 49
17, 15, 14, 27, 25, 24, 22, 21, // 57
20, 19, 17, 16, 15, 29, 28, 26, // 65
25, 23, 22, 21, 20, 19, 36, 34, // 73
33, 31, 30, 28, 27, 26, 25, 23, // 81
22, 21, 41, 39, 38, 36, 35, 33, // 89
32, 30, 29, 28, 27, 26, 25, 24, // 97
23, 22, 21, 21, 20, 19, 19, 18, // 105
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //16 zero*/
};
Motor_GetAccTotal(motor->CurrSpd) )这个函数取的值是这个表里的值
根据上面这点怎样才能看出加速是T型还是S型 ,我是个菜鸟,大侠帮帮忙讨论下啊,自己一个搞了快一个月,没搞出来,上面那个问题,我一直找不到。
Motor_GetAccTotal(motor->CurrSpd) 这个函数是根据这个CurrSpd速度返回的为以下对应
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,16,32,48,64,80,96,112,114,176,208,240,272,
320,368,416,464,512,576,640,704,800,912,1024,1152,1296,1440,1584,1744,
1968,2208,2448,2736,3024,3328,3632,3952,4352,4832,5344,5872,6400,6944,7504,8080,
9248,10448,11664,12912,14176,15472,16784,18128,20864,23648,26480,29360,32288,35264,38288,41360,
43504,44944,46384,47824,49968,52112,54256,56400,58544,60688,62832,64976,67120,69264,71408,73552,
不错的文件,值得收藏
节拍时间越短速度越快吧