ningling_21 发表于 2014-11-28 11:08 
程序合并时,函数,变量和管脚定义不能重复
你好,请再回答我一个问题,这有一个四线双极性步进电机正转程序,如何改成反转程序。
大神原谅我,问的问题有点低级。
void Go()
{ char i ,temp;
//A
PH1 = 0; //PH1为0 则A线圈为反向电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableA;
P1 = P1&temp;
delay(1);
}
PH2 = 0; //PH2为0 则B线圈为反向电流
I02 = 1;
I12 = 1; //输出0
delay(speed);
//0
PH1 = 0; //PH1为0 则A线圈为反向电流
I01 = 1; //输出0
I11 = 1;
PH2 = 1; //PH2为1 则B线圈为正电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableB;
P1 = P1&temp;
delay(1);
}
delay(speed);
//B
PH1 = 1; //PH1为1 则A线圈为正向电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableA;
P1 = P1&temp;
delay(1);
}
PH2 = 1; //PH2为1 则B线圈为正向电流
I02 = 1; //输出0
I12 = 1;
////
delay(speed);
//0
PH1 = 1; //PH1为1 则A线圈为正向电流
I01 = 1;
I11 = 1;
PH2 = 0; //PH2为0 则B线圈为反向电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableB;
P1 = P1&temp;
delay(1);
}
delay(speed);
}
|