plc鎵弿鍛ㄦ湡璇诲彇婧愮爜-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1416|鍥炲: 0

plc鎵弿鍛ㄦ湡璇诲彇婧愮爜

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    寮蹇
    2024-1-16 20:35
  • 绛惧埌澶╂暟: 4 澶

    [LV.2]鍋跺皵鐪嬬湅I

    鍙戣〃浜 2021-8-20 15:33:18 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡

    FUNCTION_BLOCK PlcCycle
    VAR_OUTPUT
            plc_Cycle : REAL;//PLC鎵弿鍛ㄦ湡
    END_VAR
    VAR
            init: BOOL;
            tx: DWORD;
            last: DWORD;
    END_VAR

    绋嬪簭
    (* read system timer *)
    tx := T_PLC_US();

    IF NOT init THEN
            init := TRUE;
            plc_Cycle := 0.0;
    ELSE
            plc_Cycle := (DWORD_TO_REAL(tx - last)*1.0E-6)*1000;
    END_IF;
    last := tx;



    绋嬪簭閲岀敤鍒扮殑鍑芥暟
    FUNCTION T_PLC_US : DWORD
    VAR CONSTANT
            debug : BOOL := 0;
            N : INT := 0;
            offset : DWORD := 0;
    END_VAR
    VAR
            tx : TIME;
    END_VAR

    tx := TIME();
    T_PLC_US := TIME_TO_DWORD(Tx)*1000;

    IF debug THEN
            T_PLC_US := (SHL(T_PLC_US,N) OR SHL(DWORD#1,N)-1) + OFFSET;
    END_IF;

    璇勫垎

    鍙備笌浜烘暟 1閰峰竵 +10 鏀惰捣 鐞嗙敱
    admin + 10 涓鐪嬪氨鏄寰楅珮绔佸ぇ姘斻佷笂妗f锛.

    鏌ョ湅鍏ㄩ儴璇勫垎

    +10
    涓嶈禐涓涓紵
    1235
    鍥炲

    浣跨敤閬撳叿 涓炬姤

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

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-23 22:50 , Processed in 0.185685 second(s), 54 queries .

    閰峰痉缃

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

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