资源简介
三路步进电机驱动程序--多轴联动,使用了插值法,对步进电机进行驱动,可以实现多路步进电机的联动,快速反应,无延时
代码片段和文件信息
void pulse_out(int motor_numunsigned char dir) //电机脉冲输出函数(请自己添加对应硬件函数)
{
if(dir==0) //收线
switch (motor_num)
{
case 1 :motor_1(1);break;
case 2 :motor_2(1);break;
case 3 :motor_3(1);break;
}
else //放线
{
switch (motor_num)
{
case 1 :motor_1(-1);break;
case 2 :motor_2(-1);break;
case 3 :motor_3(-1);break;
}
}
}
unsigned int int_abs(int num)
{
if(num<0)num=0-num;
return num;
}
void Motor_linkage(int Motor1_stepunsigned char Motor1_dirint Motor2_stepunsigned char Motor2_dirint Motor3_stepunsigned char Motor3_dir)
{
int max = 0; //通过冒泡排序,找出最大的脉冲数
int mid = 0;
int min = 0;
int max_pulse_num = 0mid_puls
- 上一篇:奥林巴斯DP01显微镜相机驱动
- 下一篇:libevent-master.zip
评论
共有 条评论