void Go()
{ char i ,temp;
//A
PH1 = 0; //PH1为0 则A线圈为反向电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableA[i];
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[i];
P1 = P1&temp;
delay(1);
}
delay(speed);
//B
PH1 = 1; //PH1为1 则A线圈为正向电流
for(i = 0; i<3; i++)
{ temp = P1;
P1 = TableA[i];
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[i];
P1 = P1&temp;
delay(1);
}
delay(speed);
} |