閫氳繃绋嬪簭鑾峰彇浠诲姟Task鍛ㄦ湡-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 22|鍥炲: 0

閫氳繃绋嬪簭鑾峰彇浠诲姟Task鍛ㄦ湡

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    鎿︽睏
    2019-8-13 14:13
  • 绛惧埌澶╂暟: 32 澶

    [LV.5]甯镐綇灞呮皯I

    鍙戣〃浜 6 澶╁墠 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
    鍓嶈█    
    鍐嶅垎浜竴涓疄闄呴」鐩父鐢ㄧ殑绋嬪簭娈碉紝Codesys涓嬮氳繃绋嬪簭鑾峰彇浠诲姟Task鍛ㄦ湡銆傦紙Tips:鏂囩珷鎸佺画杈撳嚭涓瓇~~)

    姝f枃    
    鍏堢湅鍔熻兘鏁堟灉锛
    640?wx_fmt=png&from=appmsg.jpg

    闇瑕佸姞杞戒互涓嬪簱:
    • 1.SysTypes
    • 2.CmpIecTask
    娣诲姞绋嬪簭 Pro_SysMessage

    [AppleScript] 绾枃鏈煡鐪 澶嶅埗浠g爜
    PROGRAM Pro_SysMessage
    VAR
            //鑾峰彇Task瀹炴椂鏁版嵁
            ahTaskHandle  : ARRAY[0..5] OF SysTypes.RTS_IEC_HANDLE ;
            aResultList   : ARRAY[0..5] OF SysTypes.RTS_IEC_RESULT ;
            aResult       : ARRAY[0..5] OF SysTypes.RTS_IEC_RESULT ;
            aTaskInfo     : ARRAY[0..5] OF POINTER TO CmpIecTask.Task_Info2 ;
    END_VAR
    
    ahTaskHandle[0] := CmpIecTask.IecTaskGetFirst(pszAppName:= ADR('Application'), pResult:= ADR(aResult[0]));
    ahTaskHandle[1] := CmpIecTask.IecTaskGetNext(pszAppName:= ADR('Application'),hPrevIecTask := ahTaskHandle[0], pResult:= ADR(aResult[1]));        
    ahTaskHandle[2] := CmpIecTask.IecTaskGetNext(pszAppName:= ADR('Application'),hPrevIecTask := ahTaskHandle[1], pResult:= ADR(aResult[2]));
    ahTaskHandle[3] := CmpIecTask.IecTaskGetNext(pszAppName:= ADR('Application'),hPrevIecTask := ahTaskHandle[2], pResult:= ADR(aResult[3]));
    ahTaskHandle[4] := CmpIecTask.IecTaskGetNext(pszAppName:= ADR('Application'),hPrevIecTask := ahTaskHandle[3], pResult:= ADR(aResult[4]));
    ahTaskHandle[5] := CmpIecTask.IecTaskGetNext(pszAppName:= ADR('Application'),hPrevIecTask := ahTaskHandle[4], pResult:= ADR(aResult[5]));
    
    aTaskInfo[0] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[0],pResult:= aResultList[0]); 
    aTaskInfo[1] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[1],pResult:= aResultList[1]); 
    aTaskInfo[2] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[2],pResult:= aResultList[2]); 
    aTaskInfo[3] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[3],pResult:= aResultList[3]); 
    aTaskInfo[4] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[4],pResult:= aResultList[4]); 
    aTaskInfo[5] := CmpIecTask.IecTaskGetInfo3(hIecTask := ahTaskHandle[5],pResult:= aResultList[5]); 
    
    gModbusTCP.DiPLC_CycTime[0] := DWORD_TO_DINT(aTaskInfo[0]^.dwCycleTime);
    gModbusTCP.DiPLC_CycTime[1] := DWORD_TO_DINT(aTaskInfo[1]^.dwCycleTime);
    gModbusTCP.DiPLC_CycTime[2] := DWORD_TO_DINT(aTaskInfo[2]^.dwCycleTime);
    gModbusTCP.DiPLC_CycTime[3] := DWORD_TO_DINT(aTaskInfo[3]^.dwCycleTime);
    gModbusTCP.DiPLC_CycTime[4] := DWORD_TO_DINT(aTaskInfo[4]^.dwCycleTime);
    gModbusTCP.DiPLC_CycTime[5] := DWORD_TO_DINT(aTaskInfo[5]^.dwCycleTime);
    


    閫氳繃IecTaskGetFirst鎶撳彇Task鍙ユ焺锛岄厤鍚圛ecTaskGetNext鑾峰彇涓嬩竴涓傞氳繃IecTaskGetInfo2寰楀埌瀵瑰簲Task淇℃伅銆
    濡備笂杩扮▼搴忎腑aTaskInfo[0]^.dwCycleTime 灏辨槸瀹炴椂鎵弿鍛ㄦ湡銆傚湪aTaskInfo[0]^. 涓嬭繕鏈変互涓嬪父瑙勭殑
    • dwAverageCycleTime :骞冲潎鎵弿鍛ㄦ湡鏃堕棿
    • dwCycleCount : 鎵弿鍛ㄦ湡璁℃暟
    • dwMaxCycleTime : 鏈澶ф壂鎻忓懆鏈
    • dwMinCycleTime : 鏈澶ф壂鎻忓懆鏈
    • 鏇村璇疯嚜琛岀Щ姝ュ畼缃戝府鍔
    • https://content.helpme-codesys.com/en/libs/CmpIecTask/Current/Task_Info2.html#id1

    缁撳熬
    杩欎釜鍔熻兘閰嶅悎瑙︽懜灞忎笂鏄剧ず锛屽彲鏈夋晥寰楀府蹇欐帓鏌ユ帶鍒跺櫒鐨勫疄闄呯▼搴忚繍琛屾儏鍐点傛湁闇瑕佺殑鐩存帴CV澶ф硶鍗冲彲~鎷胯蛋涓嶈阿~






    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鍥炲

    浣跨敤閬撳叿 涓炬姤

    鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

    鏈増绉垎瑙勫垯

    椤堕儴qrcode搴曢儴
    鍏虫敞閰峰痉缃戣闃呭彿锛岃幏鍙栨洿澶氳祫璁紒

    QQ|灏忛粦灞|鎵嬫満鐗|Archiver|閰峰痉璁哄潧 ( 鑻廔CP澶16065247鍙-1 )|缃戠珯鍦板浘

    GMT+8, 2025-1-23 03:24 , Processed in 0.172221 second(s), 61 queries .

    閰峰痉缃

    © 2001-2013 Hicodesys. 鎶鏈敮鎸 by 閰峰痉缃

    蹇熷洖澶 杩斿洖椤堕儴 杩斿洖鍒楄〃