CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1632|鍥炲: 0

CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    寮蹇
    2017-11-20 22:07
  • 绛惧埌澶╂暟: 2 澶

    [LV.1]鍒濇潵涔嶅埌

    鍙戣〃浜 2023-4-12 22:57:34 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡

    浠婂ぉ缁х画鎴戜滑鐨勫皬鐧芥暀绋嬶紝鑰侀笩灏变笉瑕佸湪杩欐氮璐规椂闂翠簡

    鍓嶉潰涓鏈熸垜浠浜咰ODESYS宸ョ▼鐨勫熀鏈粍鎴愶紝鎴戞兂缁忚繃鍑犳湡鐨勫涔犲ぇ瀹跺簲璇ュ濡備綍浣跨敤CODESYS鐨勫紑鍙戠幆澧冩湁浜嗗熀鏈殑浜嗚В锛屼粠杩欎竴鏈熷紑濮嬫垜浠粙缁嶄竴涓婥ODESYS鐨凷T璇█鐩稿叧鐨勫熀纭鐭ヨ瘑銆傛湰鏈熶富瑕佷粙缁嶄竴涓婼T涓殑涓昏鍏抽敭瀛楀拰鍙橀噺绫诲瀷锛屼互鍙婅繖浜涚被鍨嬩娇鐢紝椤轰究浼氫粙缁嶄竴涓婥ODESYS涓嶤璇█鐨勪竴浜涗娇鐢ㄤ笂鐨勫樊寮傘

    涓銆佸熀鏈彉閲忕被鍨

    CODESYS鐨凷T鍙橀噺绫诲瀷璺熷叾瀹冪紪绋嬭瑷绫讳技锛屽寘鎷熀鏈被鍨嬨佹暟缁勩佹灇涓俱佺粨鏋勩佽仈鍚堢瓑锛岃繕鏈夋寚閽堛佸紩鐢紝鍙﹀鍔熻兘鍧椾篃绠楁槸涓涓被鍨嬨

    1.鍩烘湰绫诲瀷

    鍩烘湰鏁版嵁绫诲瀷濡備笅琛細

    寰俊鍥剧墖_20230420124618.png


    杩欓噷闇瑕佹敞鎰忕殑鏄疌ODESYS鐨勫熀鏈暟鎹被鍨嬩笌C璇█绫讳技锛屼絾鏄湪瀛楅暱涓婃湁宸埆銆侰ODESYS涓殑INT鍦32浣嶅钩鍙颁笂榛樿涓16浣嶏紝鑰孋璇█鐨刬nt鍦32浣嶅钩鍙颁笂榛樿涓32浣嶃傚彟澶栧浜庢诞鐐规暟锛孯EAL涓嶤璇█鐨刦loat瀵瑰簲锛孡REAL涓嶤璇█鐨刣ouble瀵瑰簲銆

    2.鏁扮粍

    鏁扮粍瀹氫箟鐨勫舰寮忓涓嬶細

    鍙橀噺鍚 : ARRAY[0..N] OF 鍙橀噺绫诲瀷;

    鍙橀噺鍚 : ARRAY[0..N,0..M] OF 鍙橀噺绫诲瀷;

    娉ㄦ剰锛

    锛1锛夊彉閲忓悕涓嶅尯鍒嗗ぇ灏忓啓銆

    锛2锛夊彉閲忕被鍨嬪彲浠ユ槸鍩烘湰绫诲瀷銆佺粨鏋勩佽仈鍚堟垨鑰呭姛鑳藉潡銆

    锛3锛夋暟缁勫彲浠ヤ笅鏍囧彲浠0寮濮嬶紝涔熷彲浠ヤ笉浠0寮濮嬶紙杩欎竴鐐规瘮C璇█鏂逛究锛夈

    锛4锛塏鍜孧鍙互鐢ㄥ父閲忔潵浠f浛銆

    鏁扮粍鍒濆鍖栨柟寮忥細

    rPos : ARRAY[0..6] OF LREAL:=[7(5.0)];

    rPos : ARRAY[0..6, 0..6] OF LREAL:=[7(5.0), 7(7.0)];

    rPos : ARRAY[0..2] OF LREAL:=[5.0, 6.0, 7.0];

    rPos : ARRAY[0..2, 0..2] OF LREAL:=[5.0, 6.0, 7.0, 8.0, 9.0, 10.0];

    娉ㄦ剰锛

    锛1锛夐粯璁や細鍒濆鍖栦负0銆

    锛2锛塁ODESYS杩樻湁涓涓暟缁勭殑鏁扮粍鐨勫畾涔夋柟寮忎篃鍙互瀹氫箟澶氱淮鏁扮粍銆

    鏁扮粍瀹氫箟濡備笅锛

    aiPoints : ARRAY[1..2,1..3] OF INT := [1,2,3,4,5,6];

    CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-1.png

    浜岀淮鏁扮粍鐨勬暟缁勫畾涔夊涓嬶細

    ai2Boxes : ARRAY[1..2] OF ARRAY[1..3] OF INT := [ [1, 2, 3], [ 4, 5, 6]];

    077f07911d1041bc98e331714507db64.png

    杩欓噷闇瑕佹敞鎰忎笉瑕佹妸鏁扮粍鐨勫紩鐢ㄦ柟寮廰iPoints[1, 2]鍜宎i2Boxes[1][2]娣锋穯浜嗭紝杩欎袱绉嶅紩鐢ㄦ柟寮忔槸瀵瑰簲涓嶅悓鐨勫畾涔夋柟寮忋

    3.鏋氫妇

    鏋氫妇鐢辩敤鎴峰畾涔夌殑鏁版嵁绫诲瀷锛屽畾涔夊悗鍙互鍦ㄦ暣涓伐绋嬩腑浣跨敤銆傛灇涓惧畾涔夊彲浠ュ儚鍔熻兘鍧楀拰鍑芥暟涓鏍峰湪鈥淎pplication脿娣诲姞瀵硅薄鈥濅腑閫夋嫨娣诲姞銆

    TYPE ErrID :

    (

    name1 :=0,



    );

    END_TYPE

    娉ㄦ剰锛

    锛1锛夊湪鏋氫妇澹版槑涓紝閫氬父鑷冲皯澹版槑2涓垚鍛樸

    锛2锛夋灇涓剧殑鏁版嵁绫诲瀷榛樿涓篒NT锛屼絾鐢ㄦ埛鍙互鎸囧畾鍏朵粬鏁版嵁绫诲瀷銆傛敮鎸佺殑绫诲瀷鍖呮嫭锛欼NT | UINT | SINT | USINT | DINT | UDINT | LINT | ULINT | BYTE | WORD | DWORD | LWORD

    4.缁撴瀯鍜岃仈鍚

    缁撴瀯鍜岃仈鍚堟槸鐢辩敤鎴峰畾涔夌殑鏁版嵁绫诲瀷锛屽皢涓嶅悓鐨勫彉閲忕粍鍚堟垚涓涓嫭绔嬪崟鍏冦傜粨鏋勫拰鑱斿悎涔熷彲浠ュ湪鈥淎pplication脿娣诲姞瀵硅薄鈥濅腑娣诲姞銆

    缁撴瀯鐨勫畾涔夋柟寮忓涓嬶細

    TYPE name:

    STRUCT



    END_STRUCT

    END_TYPE

    鑱斿悎鐨勫畾涔夋柟寮忓涓嬶細

    TYPE name :

    UNION



    END_UNION

    END_TYPE

    娉ㄦ剰锛

    锛1锛夌粨鏋勫畾涔夊悗锛岀粨鏋勫悕绉板湪鏁翠釜宸ョ▼涓彲浠ヤ綔涓哄熀鏈暟鎹被鍨嬫潵瀹氫箟鍙橀噺銆佹暟缁勬垨鎸囬拡绛夈

    锛2锛夌粨鏋勪篃鍙互浣滀负鍏朵粬缁撴瀯鐨勬垚鍛樸

    锛3锛夊彲浠ラ氳繃EXTENDS鎵╁睍鐜版湁缁撴瀯锛屾柟寮忓涓嬶細

    TYPE name EXTENDS basename :

    STRUCT

       鈥

    END_STRUCT

    END_TYPE

    鎵╁睍鍚庣殑缁撴瀯鍚屾椂鎷ユ湁name鍜宐asename缁撴瀯鐨勬垚鍛樸

    锛4锛夌粨鏋勮繕鏈変竴涓笓灞炴暟鎹被鍨嬧淏IT鈥濓紝鐢ㄤ簬瀹氫箟浣嶅彉閲忥紝鍏跺煎彧鑳芥槸TRUE鍜孎ALSE銆

    5.鎸囬拡

    鎸囬拡鐢ㄤ簬鍦ㄨ繍琛屾椂瀛樺偍瀵硅薄鐨勫唴瀛樺湴鍧銆傚畾涔夋柟寮忓涓嬶細

    name: POINTER TO 鏁版嵁绫诲瀷/缁撴瀯/鍔熻兘鍧;

    瀹炰緥濡備笅锛

    a : INT;

    b : INT;

    pt : POINTER TO INT;

    pt := ADR(a); //鍙橀噺a鐨勫湴鍧璧嬪肩粰鎸囬拡pt

    b := pt^; //鎶奱鐨勫艰祴鍊肩粰b

    娉ㄦ剰锛

    锛1锛夋寚閽堝湪瀹氫箟鏄繀闇鎸囧畾绫诲瀷锛屼笉鍚岀被鍨嬫寚閽堜笉鑳戒簰鐩歌浆鎹€

    锛2锛夋寚閽堟湰韬槸DWORD绫诲瀷銆

    锛3锛夋寚鍚慖O鐨勬寚閽堜細鎶ラ敊銆

    锛4锛夋寚閽堟寚鍚戠殑鏁版嵁鍙互閫氳繃[]鏉ヨ繘琛岀储寮曡闂傜储寮曠粍浠剁殑鏁版嵁绫诲瀷鍜屽ぇ灏忕敱瀹氫箟鐨勬暟鎹被鍨嬪喅瀹氾紝绱㈠紩璁块棶鏄氳繃灏嗙储寮曠浉鍏崇殑鍋忕Щ閲廼*SIZEOF锛堬紲base type锛烇級娣诲姞鍒版寚閽堢殑鍦板潃鏉ュ疄鐜扮殑銆

    姝g‘鏂瑰紡锛歱iData := (piData + i * SIZEOF(INT))^;

    閿欒鏂瑰紡锛歱iData != (piData + i)^

    6.寮曠敤

    寮曠敤闅愬紡寮曠敤鍙︿竴涓璞°傝闂椂锛屽紩鐢ㄨ闅愬紡鍙栨秷寮曠敤锛屽洜姝や笉闇瑕佺壒娈婄殑鍐呭杩愮畻绗锛堝鎸囬拡锛夈傚畾涔夋柟寮忓涓嬶細

    name : REFERENCE TO <data type> ;

    娉ㄦ剰锛

    锛1锛夌紪璇戝櫒鐗堟湰>= V3.3.0.0锛屽紩鐢ㄩ粯璁や細鍒濆鍖栥

    锛2锛夋渶濂戒笉瑕佸璁惧杈撳叆杩涜寮曠敤锛屾病鏈夊啓鏉冮檺浼氳缂栬瘧鍣ㄦ姤璀︺

    锛3锛夊紩鐢ㄧ被鍨嬩笉鑳界敤浣滄暟缁勩佹寚閽堟垨寮曠敤鐨勫熀绫诲瀷銆

    锛4锛変笉鑳藉BIT绫诲瀷杩涜寮曠敤銆

    浠ヤ笅涓哄紩鐢ㄧ殑閿欒鐢ㄦ硶锛

    CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-3.png

    鍦ㄥ嚱鏁版垨鍔熻兘鍧椾紶閫掑弬鏁版椂锛屽彲浠ヤ娇鐢ㄥ紩鐢ㄤ粠鑰岄伩鍏嶄娇鐢ㄦ寚閽堛

    7.鍔熻兘鍧

    鍔熻兘鍧楀簲璇ヨ鏄敱鐢ㄦ埛瀹氫箟鐨勪竴涓嫭绔嬬殑鍔熻兘鍗曞厓锛岀被浼间簬C++ 鐨勭被銆傚畠鏄竴涓叿鏈夊畬鏁村姛鑳界殑妯″潡锛屼娇鐢ㄦ椂璺熷畾涔夊悇绉嶅彉閲忕被鍨嬩竴鏍烽渶瑕佸厛澹版槑瀹炰緥鎵嶈兘浣跨敤銆傚姛鑳藉潡鐨勫畾涔夊悓鏍峰彲浠ュ湪鈥淎pplication脿娣诲姞瀵硅薄鈥濅腑娣诲姞銆

    鍏跺疄杩5銆6銆7杩欏嚑涓唴瀹规垜鍦ㄥ啓鐨勬椂鍊欎竴鐩寸姽璞涓嶈璁诧紝灏ゅ叾鏄寚閽堬紝瀵逛簬鏂版墜鏉ヨ瀹屽叏鍙互涓嶇敤锛屼互閬垮厤鍑洪敊^o^銆備负浜嗕繚鎸佸唴瀹圭殑瀹屾暣鎬э紝涓婇潰杩樻槸鍋氫竴涓畝鍗曠殑浠嬬粛銆

    浜屻佸彉閲忎綔鐢ㄥ煙

    甯哥敤鐨勫彉閲忎綔鐢ㄥ煙鍖呮嫭鍏ㄥ眬鍙橀噺銆佸眬閮ㄥ彉閲忋侀潤鎬佸彉閲忕瓑銆

    1.鍏ㄥ眬鍙橀噺

    鍏ㄥ眬鍙橀噺閫氬父鍦ㄦ暣涓▼搴忚寖鍥村唴瀹氫箟锛屼細鏀惧湪鈥淎pplication鈥濇爲涓嬮潰銆傚叾娣诲姞鏂规硶鏄湪鈥淎pplication鈥濅笂鐐瑰彸閿紝鍦ㄢ滄坊鍔犲璞♀濅腑閫夋嫨鈥滃叏灞鍙橀噺鍒楄〃鈥︹濄傚湪寮瑰嚭鐨勭獥鍙d腑杈撳叆鍏ㄥ眬鍙橀噺鐨勫畾涔夊煙鍚嶇О锛岄粯璁ゆ槸鈥淕VL鈥濄

    CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-4.png

    鍦ㄥ乏渚ц澶囨爲鈥淎pplication鈥濅笅浼氬鍔犫淕VL鈥濓紝鍙屽嚮鎵撳紑鍚庡彲浠ョ湅鍒帮細

    CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-5.png

    鍏ㄥ眬鍙橀噺鐨勫畾涔夊繀椤绘槸鍦ㄥ瓧娈碘淰AR_GLOBAL鈥ND_VAR鈥濅箣鍐呫傚叏灞鍙橀噺鍦ㄦ暣涓伐绋嬭寖鍥村唴鏈夋晥锛屽畾涔夊悗宸ョ▼鍐呮墍鏈夌殑绋嬪簭銆佸嚱鏁般佸姛鑳藉潡閮藉彲浠ヨ闂傝繖閲岄渶瑕佹敞鎰忕殑鏄紝鍦ㄥ叏灞鍙橀噺涓婃柟鏈変竴涓畯瀹氫箟鈥渰attribute 'qualified_only'}鈥濓紝鍏朵綔鐢ㄦ槸闄愬畾鍏ㄥ眬鍙橀噺鐨勪娇鐢ㄥ繀椤绘寚鏄庡畾涔夊煙锛屽嵆涓婇潰鏂板缓鍏ㄥ眬鍙橀噺鏃惰緭鍏ョ殑鍚嶇О鈥淕VL鈥濄傛瘮濡備笂鍥句腑瀹氫箟鐨勨渞Point鈥濆彉閲忓湪绋嬪簭涓娇鐢ㄦ椂闇瑕佸啓鈥淕VL.rPoint鈥濓紝鍚﹀垯浼氭姤閿欍傚鏋滆寰楄繖鏍风敤璧锋潵楹荤儲锛屽彲浠ユ妸杩欎釜瀹忔敞閲婃帀锛岃繖鏍峰彲浠ョ洿鎺ヤ娇鐢ㄢ渞Point鈥濄

    闇瑕佹敞鎰忕殑鏄鏋滃湪绋嬪簭鍧椾腑灞閮ㄥ彉閲忎笌鍏ㄥ眬鍙橀噺閲嶅悕锛屽垯鍦ㄨ鍧椾腑浼樺厛浣跨敤灞閮ㄥ彉閲忋傚缓璁湪浣跨敤鏃跺眬閮ㄥ彉閲忓敖閲忎笉瑕佷笌鍏ㄥ眬鍙橀噺閲嶅悕锛岃涔堝氨缁欏叏灞鍙橀噺鎸囨槑瀹氫箟鍩燂紝杩欐牱鏂逛究鍖哄垎銆

    瀵逛簬缂栬瘧鍣ㄧ増鏈>=3.2.0.0锛孋ODESYS鎬绘槸鍦ㄦ湰鍦癙OU鍙橀噺涔嬪墠鍒濆鍖栧叏灞鍙橀噺銆

    2.灞閮ㄥ彉閲

    灞閮ㄥ彉閲忛氬父鍦ㄧ▼搴忋佸嚱鏁版垨鍔熻兘鍧楀唴閮ㄥ畾涔夈傚眬閮ㄥ彉閲忕殑瀹氫箟蹇呴』鏄湪瀛楁鈥淰AR鈥ND_VAR鈥濅箣鍐呫傛瘮濡備笂涓鏈熷伐绋嬮噷闈ain鍑芥暟鐨勫彉閲忓畾涔夐兘灞炰簬灞閮ㄥ彉閲忋

    CODESYS寮鍙戞暀绋6-鍏抽敭瀛楀強鍙橀噺绫诲瀷-6.png

    灞閮ㄥ彉閲忓彧鍦ㄥ畾涔夌殑绋嬪簭鍧楄寖鍥村唴鏈夋晥銆

    3.闈欐佸彉閲

    闈欐佸彉閲忕殑瀹氫箟蹇呴』鏄湪瀛楁鈥淰AR_STAT鈥ND_VAR鈥濅箣鍐呫

    娉ㄦ剰锛

    锛1锛塁ODESYS鍦ㄧ涓娆¤皟鐢ㄦ瘡涓潡鏃跺垵濮嬪寲闈欐佸彉閲忋

    锛2锛夐潤鎬佸彉閲忓彧鑳戒粠澹版槑鍙橀噺鐨勫懡鍚嶇┖闂翠腑璁块棶锛岀被浼糃璇█涓殑闈欐佸彉閲忋

    锛3锛夊綋搴旂敤绋嬪簭绂诲紑鍧楁椂锛岄潤鎬佸彉閲忎繚鐣欏叾鍊笺備緥濡傦紝鍙互浣跨敤闈欐佸彉閲忎綔涓哄嚱鏁拌皟鐢ㄧ殑璁℃暟鍣ㄣ

    4.杈撳叆/杈撳嚭鍙橀噺

    杈撳叆/杈撳嚭鍙橀噺鏄▼搴忓潡(POU)鎺ュ彛鐨勪竴閮ㄥ垎锛岀敤浜庡0鏄庣▼搴忓潡鐨勮緭鍏/杈撳嚭鍙橀噺銆

    瀹氫箟鏂瑰紡濡備笅锛

    鍏抽敭瀛 name

    VAR_IN_OUT

        <variable name> : <data type>;

    END_VAR

    鍏抽敭瀛楋細FUNCTION銆丗UNCTION_BLOCK銆丮ETHOD銆丳RG

    娉ㄦ剰锛

    锛1锛夌▼搴忓潡璋冪敤鏃朵笉鑳界洿鎺ュ皢甯搁噺锛堟枃瀛楋級鎸囧畾缁橵AR_IN_OUT绫诲瀷鐨勫弬鏁般俈AR_IN_OUT鍙橀噺閫氳繃寮曠敤鏂瑰紡浼犻掞紙绫讳技C璇█鐨勫紩鐢級锛岀洿鎺ヤ娇鐢ㄥ搴旂殑鍙橀噺锛屽湪绋嬪簭鍧楀唴閮ㄤ笉浼氱敓鎴愬壇鏈

    锛2锛塚AR_IN_OUT鍙橀噺鍦ㄥ叾浣跨敤鐨勭▼搴忓潡鍐呮槸鍙鍙啓鐨勶紝鍐呴儴瀵瑰彉閲忕殑淇敼鍦ㄧ▼搴忓潡鎵ц瀹屾垚鍚庝細淇濈暀銆

    锛3锛塚AR_IN_OUT鍙橀噺涓嶈兘閫氳繃鈥滃姛鑳藉潡瀹炰緥鍚嶇О鈥濈洿鎺ヨ繙绋嬭鎴栧啓銆傚姛鑳藉潡涓彧鏈塚AR_INPUT鍜孷AR_OUTPUT鍙橀噺鍙互杩欐牱浣跨敤銆

    锛4锛夊鏋滃瓧绗︿覆鍙橀噺浣滀负鍙傛暟浼犻掞紝鍒欏疄闄呭彉閲忓拰褰㈠紡鍙橀噺鐨勯暱搴﹀簲璇ョ浉鍚屻傚惁鍒欙紝浼犻掔殑瀛楃涓插彲鑳戒細琚棤鎰忔搷浣溿俈AR_OUTPUT CONSTANT鍙傛暟涓嶄細鍑虹幇姝ら棶棰樸

    锛5锛夌▼搴忓潡璋冪敤鏃朵笉鑳藉皢浣嶅彉閲忕洿鎺ユ寚瀹氱粰VAR_IN_OUT绫诲瀷鐨勫弬鏁帮紝鍥犱负浣嶅彉閲忔病鏈夌洿鎺ョ殑鍐呭瓨鍦板潃锛屾棤娉曢氳繃寮曠敤鏂瑰紡浼犻掋備綅鍙橀噺鐨勪紶閫掗渶瑕侀氳繃涓涓腑闂村彉閲忋

    5.鍔熻兘鍧楄緭鍏ュ拰杈撳嚭鍙橀噺

    杈撳叆杈撳嚭鍙橀噺鐢ㄤ簬鍔熻兘鍧楃殑杈撳叆鍜岃緭鍑哄畾涔夈傝緭鍏ュ彉閲忕殑瀹氫箟蹇呴』鏄湪瀛楁鈥淰AR_INPUT鈥ND_VAR鈥濅箣鍐呫傝緭鍑哄彉閲忕殑瀹氫箟蹇呴』鏄湪瀛楁鈥淰AR_OUTPUT鈥ND_VAR鈥濅箣鍐呫

    6.鍔熻兘鍧椾复鏃跺彉閲

    涓存椂鍙橀噺瀹氫箟蹇呴』鏄湪瀛楁鈥淰AR_TEMP鈥ND_VAR鈥濅箣鍐呫

    娉ㄦ剰

    锛1锛変复鏃跺彉閲忓彧鑳藉湪绋嬪簭鍧楀拰鍔熻兘鍧椾腑浣跨敤銆

    锛2锛夋瘡娆¤皟鐢ㄥ潡鏃讹紝CODESYS閮戒細鍒濆鍖栦复鏃跺彉閲忋

    涓夈佸彉閲忎繚鎸佺被鍨

    1.甯搁噺

    甯搁噺鍙橀噺鍦ㄥ叏灞鍙橀噺鍒楄〃鎴栫紪绋嬪璞$殑澹版槑閮ㄥ垎涓0鏄庛傚湪瀹炵幇涓紝甯搁噺鍙橀噺鍙互閫氳繃瀹炰緥璺緞浠ュ彧璇绘柟寮忚闂傚ぇ閮ㄥ垎鏃跺欐槸鐢ㄦ潵瀹氫箟涓浜涢渶瑕佹敼浣嗘槸涓嶇粡甯告敼鐨勫笺

    瀹氫箟鏂瑰紡濡備笅锛

    浣滅敤鍩 CONSTANT

        name : 鏁版嵁绫诲瀷 := 鍒濆鍊;

    END_VAR

    浣滅敤鍩燂細VAR銆乂AR_INPUT銆乂AR_STAT銆乂AR_GLOBAL

    VAR_GLOBAL锛氬叏灞甯搁噺锛屽湪鏁翠釜宸ョ▼涓湁鏁堛

    VAR锛氬眬閮ㄥ父閲忥紝浠呭湪瀹氫箟鐨勭▼搴忓潡鍐呮湁鏁堛

    VAR_STAT锛氶潤鎬佸彉閲

    娉ㄦ剰鍦ㄨ繍琛岃繃绋嬩腑甯搁噺鍊间笉鑳戒慨鏀广

    2.淇濈暀鍙橀噺

    淇濈暀鍙橀噺鐢卞叧閿瓧RETAIN澹版槑銆備繚鐣欏彉閲忓湪鐑惎鍔ㄥ悗浼氫繚鐣欏叾鍊硷紝浣嗗湪閲嶆柊鍔犺浇绋嬪簭銆佷笅杞芥垨鍐峰惎鍔ㄥ悗涓嶄細淇濈暀銆

    瀹氫箟鏂瑰紡濡備笅锛

    浣滅敤鍩 RETAIN

        <identifier>: <data type>;

    END_VAR

    浣滅敤鍩熺被鍨嬶細VAR銆乂AR_INPUT銆乂AR_OUTPUT銆乂AR_IN_OUT銆乂AR_STAT銆乂AR_GLOBAL

    涓嶅厑璁镐娇鐢ˋT鍏抽敭瀛楀垎閰嶈緭鍏ャ佽緭鍑烘垨鍐呭瓨鍦板潃銆

    3.鎸佷箙鍙橀噺

    鎸佷箙鍙橀噺鐢盤ERSISTENT鍏抽敭瀛楀0鏄庛傛寔涔呭彉閲忎細瀛樺偍鍦ㄥ閮ㄦ枃浠朵腑锛屽洜姝や細涓鐩翠繚鐣欍

    鍏ㄥ眬鎸佷箙鍙橀噺瀹氫箟鏂瑰紡濡備笅锛

    VAR_GLOBAL PERSISTENT RETAIN

        <identifier> : <data type> (:= <initialization>)?;

    <instance path to POU variable>

    END_VAR

    绋嬪簭鍧椾腑鐨勫畾涔夋柟寮忓涓嬶細

    浣滅敤鍩 PERSISTENT RETAIN

        name : <data type>;

    END_VAR

    浣滅敤鍩燂細VAR銆乂AR_INPUT銆乂AR_OUTPUT銆乂AR_IN_OUT銆乂AR_STAT銆乂AR_GLOBAL

    娉ㄦ剰锛

    锛1锛変笉鍏佽浣跨敤AT鍏抽敭瀛楀垎閰嶈緭鍏ャ佽緭鍑烘垨鍐呭瓨鍦板潃銆

    锛2锛夊湪鎸佷箙鍙橀噺鍒楄〃涓娇鐢ㄤ笉鑳戒娇鐢ㄦ寚閽堬紙POINTER TO鏁版嵁绫诲瀷锛夈傞噸鏂颁笅杞藉簲鐢ㄧ▼搴忔椂锛屾寚閽堢被鍨嬬殑浣嶇疆鍙兘浼氭敼鍙橈紝灏嗕細瀵艰嚧涓嶅彲棰勬枡鐨勭粨鏋溿

    鍥涖佸悗璁

    鍥犱负鏄粙缁峉T鐨勫熀纭鐭ヨ瘑锛屾墍浠ヤ笂闈㈡妸鐩稿叧鐨勮钀介兘鎵簡涓涓嬶紝搴旇璇撮渶瑕佺敤鍒扮殑鍦版柟閮借繃浜嗕竴涓嬨傛柊鎵嬪湪鐪嬬殑鏃跺欙紝濡傛灉鍙戠幇鐜板湪鐢ㄤ笉鍒扮殑鍙互鍏堣烦杩囷紝鍙湅鑷繁鎰熷叴瓒g殑灏卞ソ浜嗐傚疄闄呬笂CODESYS鎻愪緵浜嗗湪绾垮府鍔╂枃妗o紝杩欐槸涓涓娇鐢–ODESYS鐨勭櫨绉戝叏涔︺備絾鏄ぇ閮ㄥ垎璧勬枡鏄嫳鏂囩殑锛岃屼笖鏈夊緢澶氬啓鐨勭湡鐨勪笉澶ソ鎳傦紙灏辨槸閭g鍗曡瘝鍏ㄨ璇嗭紝浠涔堟剰鎬濅笉鐭ラ亾锛燂紒锛佹劅瑙夎嫳璇叏閮界櫧瀛︿簡锛屽ソ灏村艾~~~锛夈傝繖涔熸槸涓轰粈涔堜細鏈夎繖浜涙枃绔犵殑鍘熷洜涔嬩竴锛屽笇鏈涘澶у鏈夊府鍔o^銆
    鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺
    鐗堟潈澹版槑锛氭湰鏂囦负CSDN鍗氫富銆--鑾悕--銆嶇殑鍘熷垱鏂囩珷锛岄伒寰狢C 4.0 BY-SA鐗堟潈鍗忚锛岃浆杞借闄勪笂鍘熸枃鍑哄閾炬帴鍙婃湰澹版槑銆
    鍘熸枃閾炬帴锛歨ttps://blog.csdn.net/halps/article/details/128466241


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

    浣跨敤閬撳叿 涓炬姤

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

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-23 20:33 , Processed in 0.150782 second(s), 59 queries .

    閰峰痉缃

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

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