daemondong
級(jí)別: 正式會(huì)員
精華主題: 0
發(fā)帖數(shù)量: 36 個(gè)
工控威望: 75 點(diǎn)
下載積分: 609 分
在線時(shí)間: 9(小時(shí))
注冊(cè)時(shí)間: 2019-09-12
最后登錄: 2021-08-17
查看daemondong的 主題 / 回貼
樓主  發(fā)表于: 2019-11-09 16:47
我需要將FX5U的K7軸上電時(shí)能回零,目前只有一個(gè)零點(diǎn)感應(yīng),為了保證每次回到標(biāo)準(zhǔn)零點(diǎn),需要空轉(zhuǎn)一圈找到零起點(diǎn),繼續(xù)轉(zhuǎn)找到零終點(diǎn),然后利用DSZR回零,程序如下:

問(wèn)題是第4步回零時(shí)報(bào)錯(cuò),說(shuō)軸被占用了。 但是我已經(jīng)將M106置為FALSE, 監(jiān)視PLC也表明了這一點(diǎn),為啥還會(huì)出現(xiàn)軸被占用? 謝謝大家

PLSV(M106, D16, K7, Y64);
DSZR(M100,1000,100,K7,M60);
DRVI(M101,D104,D100,K7,M62);

IF NOT M40 THEN
    Y64:=TRUE;
    Y65:=TRUE;
    
    CASE D110 OF
    0:
        D110:=D110+1;   //初始化
        M106:=TRUE;
    1:
        D16:=D100;       //找到零起點(diǎn)
        IF X65 THEN
            D16:=0;
        END_IF;
        IF X65 THEN
            D110:=D110+1;
        END_IF;
        
    2:                              
        IF X65 THEN    //找到零終點(diǎn)
            D16:=D100;
            ELSE
            D16:=0;
        END_IF;
    
        IF NOT X65 THEN
            D110:=D110+1;
        END_IF;
        
    3:
        M106:=FALSE;       //準(zhǔn)備DSZR回零點(diǎn)
        M51:=TRUE;
        M55:=TRUE;
        D110:=4;
        
        
    4:
        M16:=TRUE;       //回零
        IF X65 AND X62 THEN
            D110:=D110+1;
            M40:=TRUE;
        END_IF;
    ELSE
        M40:=TRUE;
    END_CASE;
    
END_IF;

(*Manual Control*)
(*進(jìn)入手動(dòng)控制頁(yè)面,M51手動(dòng)控制標(biāo)志*)
IF M51 THEN
(*    IF M0 AND Y4=FALSE AND X0=FALSE THEN
    END_IF;*)
    IF M55 THEN                  //分步動(dòng)作
        M106:=FALSE;
        M107:=FALSE;
        M108:=FALSE;
    ELSE
        M106:=TRUE;        //全手動(dòng)動(dòng)作
        M107:=TRUE;
        M108:=TRUE;
    END_IF;

    IF M6 OR M16 OR M26 THEN
        IF M6 THEN
            IF Y64 THEN
                D16:=D0;
            ELSE
                D16:=-D0;
            END_IF;
        END_IF;
        IF M16 THEN                          //回零點(diǎn)
            set (NOT X65,M100);
            IF M60 OR X65 THEN
                M100:=FALSE;
                M60:=FALSE;
                M16:=FALSE;
                M120:=FALSE;
            END_IF;
        END_IF;
        IF M26 THEN
            set(NOT M100 AND NOT M120,M101);
            IF M62 OR M120 THEN
                M120:=TRUE;
                M101:=FALSE;
                M62:=FALSE;
                M26:=FALSE;
            END_IF;
        END_IF;
    ELSE
        D16:=0;
        M102:=FALSE;
        M103:=FALSE;
    END_IF;
END_IF;