flexium
級(jí)別: 正式會(huì)員
|
我是新人小白,請(qǐng)大神幫忙我一下啊,看看我哪里寫錯(cuò)了呀, 三菱ST中DDRVA執(zhí)行后,DZRN無法回歸原點(diǎn)的問題,單獨(dú)回原點(diǎn)正常,執(zhí)行DDRVA移動(dòng)后,再執(zhí)行DZRN就無動(dòng)作 詳細(xì)請(qǐng)幫忙看看下面的程序 (*校準(zhǔn)螺距*) Current_Distance := Pulse_Current_Distance / ONE_Pulse_Feed; IF Calibration THEN(*如果校準(zhǔn)按鈕被按下*) ONE_Pulse_Feed := Calibration_Distance / Pitch_Setting * K100;(*計(jì)算1mm所用脈沖值*) DDRVA ( Calibration,Calibration_Distance,Feeding_Distance,Pulse_Output,Y001); Direction_Output :=TRUE;(*正轉(zhuǎn)方向啟動(dòng)*) IF M8029=TRUE THEN Direction_Output := FALSE; Calibration := FALSE;(*否則RST校準(zhǔn)按鈕*) END_IF; END_IF; (*回原點(diǎn)*) 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重新編輯 ] |
---|---|
|
seafar
目前C#
級(jí)別: 家園?
|
加個(gè)延時(shí)再觸發(fā)回原點(diǎn) |
|
---|---|---|
|
flexium
級(jí)別: 正式會(huì)員
|
圖片:
這個(gè)的確是三菱PLC的ST語(yǔ)言編程;如圖 |
---|---|
|
flexium
級(jí)別: 正式會(huì)員
|
加了延時(shí)還是不行,不能回原點(diǎn),如下紅色字體部分 (*校準(zhǔn)螺距*) Current_Distance := Pulse_Current_Distance / ONE_Pulse_Feed; IF Calibration THEN(*如果校準(zhǔn)按鈕被按下*) ONE_Pulse_Feed := Calibration_Distance / Pitch_Setting * K100;(*計(jì)算1mm所用脈沖值*) DDRVA ( Calibration,Calibration_Distance,Feeding_Distance,Pulse_Output,Y001); Direction_Output :=TRUE;(*正轉(zhuǎn)方向啟動(dòng)*) IF Relay_1 = TRUE THEN Direction_Output := FALSE; Calibration := FALSE;(*否則RST校準(zhǔn)按鈕*) END_IF; END_IF; OUT_T (M8029,TC3,K10); IF TC3 =TRUE THEN Relay_1:= TRUE; ELSE Relay_1:= FALSE; END_IF; (*回原點(diǎn)*) 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; |
---|---|
|
flexium
級(jí)別: 正式會(huì)員
|
上一任程序工程師用ST寫的,我只能繼續(xù)用了,不然我要從頭寫,那頭發(fā)不保呀 |
---|---|
|
hefq
級(jí)別: 家園?
|
M8029只接通到下一個(gè)功能指令就關(guān)掉了,你拿他來開定時(shí)器是沒用的 |
---|---|
|
情深深雨蒙蒙
If you don't forget your o
級(jí)別: 家園?
|
M8029貌似一般都用上升沿 |
|
---|---|---|
|