我是新人小白,請大神幫忙我一下啊,看看我哪里寫錯了呀,
三菱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重新編輯 ]