通过功能说明,其实,很容易想到的就是使用编码指令,来给按钮的按下顺序进行编码,然后按照编码来实现顺序启动。
IF #编码 AND (#SB.%X0 OR #SB.%X1 OR #SB.%X2) THEN
#ENCO_TEMP_1 := ENCO(IN := #SB);
END_IF;
IF #ENCO_TEMP_1=0 THEN
#motor1 := 'FIRST';
#ENCO_TEMP_2 := ENCO(IN := #SB);
IF #ENCO_TEMP_2=1 THEN
#motor2 := 'SECOND';
#motor3 := 'THIRD';
ELSIF #ENCO_TEMP_2=2 THEN
#motor3 := 'SECOND';
#motor2 := 'THIRD';
END_IF;
ELSIF #ENCO_TEMP_1=1 THEN
#motor2 := 'FIRST';
#ENCO_TEMP_3 := ENCO(IN := #SB);
IF #ENCO_TEMP_3=0 THEN
#motor1 := 'SECOND';
#motor3 := 'THIRD';
ELSIF #ENCO_TEMP_3=2 THEN
#motor3 := 'SECOND';
#motor1 := 'THIRD';
END_IF;
ELSIF #ENCO_TEMP_1=2 THEN
#motor3 := 'FIRST';
#ENCO_TEMP_4 := ENCO(IN := #SB);
IF #ENCO_TEMP_4=0 THEN
#motor1 := 'SECOND';
#motor2 := 'THIRD';
ELSIF #ENCO_TEMP_3=1 THEN
#motor2 := 'SECOND';
#motor1 := 'THIRD';
END_IF;
END_IF;
IF #START AND (#motor1='FIRST') THEN
#MOTOR_1.%X0:=1;
ELSIF #START AND (#motor2='FIRST') THEN
#MOTOR_1.%X1 := 1;
ELSIF #START AND (#motor3='FIRST') THEN
#MOTOR_1.%X2 := 1;
END_IF;
#TIME.TON(IN := (#MOTOR_1.%X0 OR #MOTOR_1.%X1 OR #MOTOR_1.%X2),
PT := T#5S,
Q => #SECOND);
IF #SECOND AND (#motor1 = 'SECOND') THEN
#MOTOR_1.%X0 := 1;
ELSIF #SECOND AND (#motor2 = 'SECOND') THEN
#MOTOR_1.%X1 := 1;
ELSIF #SECOND AND (#motor3 = 'SECOND') THEN
#MOTOR_1.%X2 := 1;
END_IF;
#TIME_1.TON(IN := #SECOND,
PT := T#5S,
Q => #THIRD);
IF #THIRD AND (#motor1 = 'THIRD') THEN
#MOTOR_1.%X0 := 1;
ELSIF #THIRD AND (#motor2 = 'THIRD') THEN
#MOTOR_1.%X1 := 1;
ELSIF #THIRD AND (#motor3 = 'THIRD') THEN
#MOTOR_1.%X2 := 1;
END_IF;
IF #STOP THEN
#MOTOR_1 := 0;
END_IF;
当然了,若你有什么想要实现的功能,也可以私信小编,我会帮大家写个示例!最主要的是通过我的抛砖引玉来使大家的水平有更好的提高。