我用的是STM32,定时器是16位的。这个表塞在flash里面有三十多k字节... 其实这只是表的前半部分,最高频率到58.7kHz,后半部分还有,加速到73.8kHz但整个表塞进STM32就要65k字节,c8t6塞不进...
matlab的计算脚本,一个多月前写的,没注释,现在也不太看得懂了....
e1 = 0.375e-3 : 0.375e-3 : 0.603145;
w1 = (2*e1/0.00011);
for j = 1:1608
w1(j) = w1(j)^0.5;
end
w1_get = w1;
e2 = ones(1,10000)*0.60315;
w2 = ones(1,10000)* 104.72;
for j=1:9999
e2(j+1) = e2(j) + (-2.50668 * 0.001 * w2(j) + 0.6375)*0.001;
w2(j+1) = (2*e2(j+1)/0.00011)^0.5;
end
w2_get = w2(1:8842);
e3_2 = 785.3982^2*1.1e-4*0.5;
e3_1 = w2(8842)^2*1.1e-4*0.5;
e3 = e3_1 : 0.1125e-3 : e3_2;
w3 = (2*e3/0.00011);
for j = 1:280126
w3(j) = w3(j)^0.5;
end
w_total=cat(2,w1,w2_get,w3);
T_total = ones(1,290576);
for j = 1:290576
T_total(j) = 2*pi*0.225 /360 / w_total(j);
end
T_mcu = T_total * 72*1000*1000;
T_mcu_string = int32(T_mcu);
T_mcu_string2 = int2str(T_mcu_string(1));
mid2 = ',';
for j=2:30000
mid1 = int2str(T_mcu_string(j));
T_mcu_string2 = cat(2,T_mcu_string2,mid2);
T_mcu_string2 = cat(2,T_mcu_string2,mid1);
end
txt_fileid = fopen('result.txt','w')
fprintf(txt_fileid,'%s',T_mcu_string2);
fclose(txt_fileid);
算出来的每步周期曲线是这样,y轴是定时器周期,注意x轴是步数,不是时间:
角速度曲线,同样注意x轴是步数不是时间。
不过我算的时候留了10倍余量...加速到最高73.8kHz要近两秒 ,可以把雷赛三相步进跑到4k转/s (24V供电),不过在4k转/s情况下反电势太大电机几乎没有什么扭矩了手使劲捏就停了。