Codesys鈥斺斿惎鍔ㄥ欢鏃躲佸欢鏃跺惎鍔ㄧ數璺紙鍩虹鎸囦护鐨勫簲鐢級-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1035|鍥炲: 1

Codesys鈥斺斿惎鍔ㄥ欢鏃躲佸欢鏃跺惎鍔ㄧ數璺紙鍩虹鎸囦护鐨勫簲鐢級

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    鎱垫噿
    2017-11-9 20:49
  • 绛惧埌澶╂暟: 2 澶

    [LV.1]鍒濇潵涔嶅埌

    鍙戣〃浜 2023-11-22 15:25:11 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
    浠ヤ笅鍐呭灞炰簬涓汉鐞嗚В锛屽鏈夐敊璇杩庢寚姝c
    鏈瘒涓昏鏈変笁涓熀纭鐨勫皬妗堜緥锛屽垎鍒槸鍚姩寤舵椂鍏虫柇鐢佃矾銆佸欢鏃跺惎鍔ㄧ數璺佷互鍙婇棯鐑佽鏁板仠姝㈢數璺備富瑕佺敤鍒颁簡鍩虹鐨勪笌鎴栭潪鎸囦护浠ュ強瀹氭椂鍣ㄨ鏁板櫒鎸囦护锛屼唬鐮佺殑鐩稿簲閮ㄥ垎鍋氫簡娉ㄩ噴渚夸簬澶у鐞嗚В銆傚鏋滄湁涓嶆噦鐨勫湴鏂瑰彲浠ョ淇℃垜锛屼笅涓绡囧皢鎻愪緵鍑犱釜鍏充簬ST缂栫▼璇彞鎸囦护搴旂敤鐨勬渚嬪摝~
    鍚姩寤舵椂鍏虫柇鐢佃矾

    鎺у埗瑕佹眰锛氭寜涓嬬偣鍔ㄥ惎鍔ㄦ寜閽紝Q0.0鐐逛寒锛5s鍚庣伃鎺
    1. /********************鍙橀噺澹版槑************************/
    2. PROGRAM PLC_PRG
    3. VAR
    4.         BUTTON_ON: BOOL;          //鍚姩鎸夐挳
    5.         LED: BOOL;                //鐏
    6.              
    7.         TON0_PT: TIME := T#5S;    //瀹氭椂鍣0棰勮鍊
    8.         TON0_ET: TIME;            //瀹氭椂鍣0褰撳墠鍊
    9.         TON0_BASE: BOOL;          //瀹氭椂鍣ㄦ潯浠
    10.        
    11.         TON_0: TON;               //涓婂崌娌垮0鏄
    12.         R_TRIG_0: R_TRIG;         //瀹氭椂鍣ㄥ0鏄
    13. END_VAR
    14. /********************绋嬪簭缂栧啓************************/
    15. //鍚姩鎸夐挳涓婂崌娌
    16. R_TRIG_0(CLK:=BUTTON_ON, Q=> );
    17. //鐏捣淇濆仠
    18. LED := (R_TRIG_0.Q OR LED ) AND (NOT TON_0.Q);
    19. //瀹氭椂鍣ㄦ潯浠
    20. TON0_BASE := LED AND (NOT TON_0.Q);
    21. //瀹氭椂鍣ㄥ惎鍔
    22. TON_0(IN:=TON0_BASE , PT:=TON0_PT ,
    23.           Q=> ,ET=>TON0_ET);
    澶嶅埗浠g爜
    寤舵椂鍚姩鐢佃矾

    鎺у埗瑕佹眰锛氭寜涓婭0.0(鐐瑰姩鎸夐挳锛夛紝5S鍚庯紝Q0.0鐐逛寒
    1. /********************鍙橀噺澹版槑************************/
    2. PROGRAM PLC_PRG
    3. VAR
    4.         BUTTON_ON: BOOL;       //鍚姩鎸夐挳
    5.         BUTTON_ON_UP: BOOL;    //鍚姩鎸夐挳涓婂崌娌垮彉閲
    6.         BUTTON_OFF: BOOL;      //鍋滄鎸夐挳
    7.         LED: BOOL;             //鐏
    8.         TEMP: BOOL;            //涓棿鍙橀噺
    9.        
    10.         TON_IN: BOOL;          //瀹氭椂鍣0鍚姩淇″彿
    11.         TON_PT: TIME:=T#5S;    //瀹氭椂鍣0棰勮鍊
    12.         TON_ET: TIME;          //瀹氭椂鍣0褰撳墠鍊
    13.         TON_Q: BOOL;           //瀹氭椂鍣0杈撳嚭淇″彿
    14.        
    15.         R_TRIG_0: R_TRIG;      //涓婂崌娌垮0鏄
    16.         TON_0: TON;            //瀹氭椂鍣ㄥ0鏄
    17. END_VAR
    18. /********************绋嬪簭缂栧啓************************/
    19. //鍚姩鎸夐挳涓婂崌娌
    20. R_TRIG_0(CLK:=BUTTON_ON ,
    21.              Q=> );
    22. //鍚姩鎸夐挳鐨勪笂鍗囨部淇″彿鎺ラ歍EMP鍙橀噺銆傚苟瀵筎EMP鍙橀噺杩涜鑷攣銆
    23. //涓庝笂鍋滄鎸夐挳鐨勫父闂偣锛屽嵆褰撳仠姝㈡寜閽寜涓嬶紝TEMP鍙橀噺涓0.
    24. //杩欓噷涓嶄笌涓婂仠姝㈡寜閽殑甯搁棴鐐圭殑璇濇棤娉曟柇寮TEMP鍙橀噺锛屽鑷
    25. //鍦ㄥ惎鍔ㄤ笉鍒5S鐨勬椂鍊欙紝鐐瑰嚮鍋滄鎸夐挳锛岀伅杩樻槸浼氫寒銆
    26. TEMP := (TEMP OR R_TRIG_0.Q) AND (NOT BUTTON_OFF);
    27. TON_IN := TEMP AND (NOT BUTTON_OFF);
    28. //瀹氭椂鍣ㄦ寚浠
    29. TON_0(IN:=TON_IN , PT:=TON_PT ,
    30.           Q=>TON_Q , ET=>TON_ET );
    31. LED := TON_Q AND (NOT BUTTON_OFF);
    澶嶅埗浠g爜
    闂儊璁℃暟鍋滄鐢佃矾

    鎺у埗瑕佹眰锛氭寜涓婭0.0(鐐瑰姩鎸夐挳锛夛紝Q0.0闂笁娆″悗鐔勭伃銆
    1. /********************鍙橀噺澹版槑************************/
    2. PROGRAM PLC_PRG
    3. VAR
    4.         BUTTON_ON: BOOL;
    5.         BUTTON_ON_UP: BOOL;
    6.        
    7.         LED: BOOL;
    8.         TEMP0: BOOL;
    9.        
    10.         CTU0_RESET: BOOL;
    11.         CTU0_PV: WORD:=3;
    12.         CTU0_Q: BOOL;
    13.         CTU0_CV: WORD;
    14.        
    15.         TON0_PT: TIME:=T#1S;
    16.         TON1_PT: TIME:=T#1S;
    17.     TON0_IN: BOOL;
    18.         TON1_IN: BOOL;
    19.         TON0_ET: TIME;
    20.         TON1_ET: TIME;
    21.         TON0_Q: BOOL;
    22.         TON1_Q: BOOL;
    23.        
    24.         R_TRIG_0: R_TRIG;
    25.         TON_0: TON;
    26.         TON_1: TON;
    27.         TON_2: TON;
    28.         TON_3: TON;
    29.         TON_4: TON;
    30.         TON_5: TON;
    31.         CTU_0: CTU;
    32. END_VAR
    33. /********************绋嬪簭缂栧啓************************/
    34. //鍚姩鎸夐挳鐨勪笂鍗囨部銆
    35. R_TRIG_0(CLK:=BUTTON_ON, Q=>BUTTON_ON_UP );
    36. //鍚姩鎸夐挳鐨勪笂鍗囨部淇″彿鎺ラ歍EMP鍙橀噺銆傚苟瀵筎EMP鍙橀噺杩涜鑷攣銆
    37. TEMP0 := TEMP0 OR BUTTON_ON_UP;
    38. //涓嬮潰鏄竴涓尟鑽$數璺紝姣忔闂竴娆$伃涓娆″璁℃暟鍣ㄨ繘琛屽姞涓銆
    39. LED := TEMP0 AND ((NOT TON_0.Q) OR TON_1.Q) AND (NOT CTU0_Q);
    40. TON0_IN := TEMP0 AND (NOT TON_1.Q);
    41. TON1_IN := TEMP0 AND TON_0.Q;
    42. TON_0(IN:=TON0_IN , PT:=TON0_PT , Q=>TON0_Q , ET=>TON0_ET );   //浜1S
    43. TON_1(IN:=TON1_IN , PT:=TON1_PT , Q=>TON1_Q , ET=>TON1_ET ); //鐏1S
    44. //鍒╃敤鍚姩鎸夐挳鐨勪笂鍗囨部瀵硅鏁板櫒杩涜澶嶄綅锛屽惁鍒欑浜屾鍚姩鐨勮瘽鐏皢鏃犳硶闂儊銆
    45. CTU_0(CU:=TON_0.Q , RESET:=BUTTON_ON_UP , PV:=CTU0_PV , Q=>CTU0_Q , CV=>CTU0_CV );
    澶嶅埗浠g爜
    璋㈣阿澶у~

    鐐硅瘎

    瀛︿範鐢紝璋㈣阿  鍙戣〃浜 2024-4-17 15:48
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鍥炲

    浣跨敤閬撳叿 涓炬姤

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

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-27 11:59 , Processed in 0.157303 second(s), 54 queries .

    閰峰痉缃

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

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