我是新人小白,请大神帮忙我一下啊,看看我哪里写错了呀,
三菱ST中DDRVA执行后,DZRN无法回归原点的问题,单独回原点正常,执行DDRVA移动后,再执行DZRN就无动作
详细请帮忙看看下面的程序
(*校准螺距*)
Current_Distance := Pulse_Current_Distance / ONE_Pulse_Feed;
IF Calibration THEN(*如果校准按钮被按下*)
ONE_Pulse_Feed := Calibration_Distance / Pitch_Setting * K100;(*计算1mm所用脉冲值*)
DDRVA ( Calibration,Calibration_Distance,Feeding_Distance,Pulse_Output,Y001);
Direction_Output :=TRUE;(*正转方向启动*)
IF M8029=TRUE THEN
Direction_Output := FALSE;
Calibration := FALSE;(*否则RST校准按钮*)
END_IF;
END_IF;
(*回原点*)
IF NOT Backward_Limit AND NOT Enclosure_Not_Closed AND NOT Backward_Limit THEN
DZRN (Back_Servo_Origin,K2000,K1000,Servo_Origin,Pulse_Output);
IF Back_Servo_Origin THEN
OUT_T(Scintillation=1,TC2,K10);
OUT_T(Servo_Origin_Lamp =TRUE,TC1,K10);
IF TC2 =TRUE THEN
Servo_Origin_Lamp :=TRUE;
IF TC1 =TRUE THEN
Scintillation :=0;
END_IF;
ELSIF TC2 =FALSE THEN
Servo_Origin_Lamp :=FALSE;
Scintillation :=1;
END_IF;
END_IF;
END_IF;
IF Back_Servo_Origin THEN
IF Pulse_Current_Distance =K0 THEN
Back_Servo_Origin :=FALSE;
Servo_Origin_Lamp :=TRUE;
END_IF;
ELSIF Pulse_Current_Distance <>K0 THEN
Servo_Origin_Lamp :=FALSE;
END_IF;
最后在论坛的好心大哥帮助下,完美解决,提供修改的程序,帮忙大家避坑!!IF Calibration THEN
IF LDF(TRUE ,OUT_Puls_Monitor) THEN
M340:=1;
END_IF;
OUT_T(M340=1,TC3,K100);
IF TC3=1 THEN
Calibration := FALSE;
M340:=0;
END_IF;
END_IF;
[ 此帖被flexium在2021-08-17 19:11重新编辑 ]