codesys缁忓吀涓枃甯姪-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇

codesys缁忓吀涓枃甯姪

  [澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    寮蹇
    2019-11-6 12:47
  • 绛惧埌澶╂暟: 18 澶

    [LV.4]鍋跺皵鐪嬬湅III

    鍙戣〃浜 2023-1-2 10:39:24 | 鏄剧ず鍏ㄩ儴妤煎眰
    鐪嬬湅鏄粈涔堜笢瑗匡紝娌℃湁浠嬬粛锛屼粈涔堥兘涓嶇煡閬擄紝鎴戝彧鑳藉洖澶嶇湅鐪嬶紝濂戒簡鍧忎簡閮藉緱鐪嬬湅锛屼笉濂戒篃瑕佺湅鐪嬶紝鐪嬬湅鏄粈涔堜笢瑗裤
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鏉ヨ嚜瀹夊崜瀹㈡埛绔鏉ヨ嚜瀹夊崜瀹㈡埛绔
  • TA鐨勬瘡鏃ュ績鎯
    濂嬫枟
    2023-10-17 09:22
  • 绛惧埌澶╂暟: 16 澶

    [LV.4]鍋跺皵鐪嬬湅III

    鍙戣〃浜 2023-1-4 15:16:50 | 鏄剧ず鍏ㄩ儴妤煎眰
    666666666666666666666666666666666666666
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
  • TA鐨勬瘡鏃ュ績鎯
    寮蹇
    2023-4-2 20:28
  • 绛惧埌澶╂暟: 5 澶

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

    鍙戣〃浜 2023-3-18 21:10:28 | 鏄剧ず鍏ㄩ儴妤煎眰
    浣犲ソ锛岄偅涓増鏈殑
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒

    璇ョ敤鎴蜂粠鏈鍒

    鍙戣〃浜 2023-3-22 22:43:12 | 鏄剧ず鍏ㄩ儴妤煎眰
    璋㈣阿妤间富鐨勬棤绉佸鐚
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒

    璇ョ敤鎴蜂粠鏈鍒

    鍙戣〃浜 2023-3-23 09:17:34 | 鏄剧ず鍏ㄩ儴妤煎眰
    hHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒

    璇ョ敤鎴蜂粠鏈鍒

    鍙戣〃浜 2023-4-7 10:15:10 | 鏄剧ず鍏ㄩ儴妤煎眰
    666kanyixia
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒

    璇ョ敤鎴蜂粠鏈鍒

    鍙戣〃浜 2023-6-14 02:02:52 | 鏄剧ず鍏ㄩ儴妤煎眰
    瀛︿範浜嗭紝鎰熻阿
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
  • TA鐨勬瘡鏃ュ績鎯
    濂嬫枟
    2023-8-24 14:50
  • 绛惧埌澶╂暟: 5 澶

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

    鍙戣〃浜 2023-6-24 14:44:16 | 鏄剧ず鍏ㄩ儴妤煎眰

    OPC閫氳鍗忚涓撻
    涓撴爮鏀跺綍璇ュ唴瀹
    16 绡囨枃绔3 璁㈤槄
    璁㈤槄涓撴爮
    http://www.dqjsw.com.cn/dianqi/OPC/310.html
    OPC DA瀹㈡埛绔殑涓夌瀹炵幇鏂瑰紡
    鏃堕棿:2009-09-30 鏉ユ簮:鏈煡 缂栬緫:鐢垫皵鑷姩鍖栨妧鏈綉 鐐瑰嚮:301娆 瀛椾綋璁剧疆: 澶 涓 灏


    1  寮曡█
        OPC(OLE for Process Control)鏄竴涓伐涓氭爣鍑嗭紝浠栨槸璁稿涓栫晫棰嗗厛鐨勮嚜鍔ㄥ寲鍜岃蒋銆佺‖浠跺叕鍙镐笌寰蒋鍏徃鍚堜綔鐨勭粨鏅躲傜鐞嗚鏍囧噯鐨勭粍缁囨槸OPC鍩洪噾浼氥傝鍩洪噾浼氱殑浼氬憳鍗曚綅鍦ㄤ笘鐣岃寖鍥村唴瓒呰繃150涓紝鍖呮嫭浜嗕笘鐣屼笂鍑犱箮鍏ㄩ儴鐨勬帶鍒剁郴缁熴佷华鍣ㄤ华琛ㄥ拰杩囩▼鎺у埗绯荤粺鐨勪富瑕佷緵搴斿晢銆侽PC鎶鏈缓绔嬩簡涓缁勭鍚堝伐涓氭帶鍒惰姹傜殑鎺ュ彛瑙勮寖锛屽皢鐜板満淇″彿鎸夌収缁熶竴鐨勬爣鍑嗕笌SCADA銆丠MI绛夎蒋浠舵棤缂濊繛鎺ヨ捣鏉ワ紝鍚屾椂灏嗙‖浠跺拰搴旂敤杞欢鏈夋晥鍦板垎绂诲紑銆傚彧瑕佺‖浠跺紑鍙戝晢鎻愪緵甯︽湁OPC鎺ュ彛鐨勬湇鍔″櫒锛屼换浣曟敮鎸丱PC鎺ュ彛鐨勫鎴风▼搴忓潎鍙噰鐢ㄧ粺涓鐨勬柟寮忓涓嶅悓纭欢鍘傚晢鐨勮澶囪繘琛屽瓨鍙栵紝鏃犻』閲嶅寮鍙戦┍鍔ㄧ▼搴忋傚鏋滃笇鏈涘皢鏁版嵁寮曞叆鏁版嵁搴撹繘琛岀粺璁″垎鏋愶紝灏辫杩涜瀹㈡埛绔紑鍙戙
    2  瀹㈡埛绋嬪簭鐨勮璁℃柟娉曚笌姣旇緝
        瀹㈡埛绋嬪簭鐨勮璁′富瑕佹槸鎸囧鎴风▼搴忎腑OPC鎺ュ彛閮ㄥ垎鐨勮璁°傚鎴风▼搴忔湰韬彲浠ュ畬鎴愬緢澶氬鏉傜殑鏁版嵁澶勭悊涓庢樉绀哄姛鑳斤紝浣嗛渶瑕侀氳繃OPC鎺ュ彛閮ㄥ垎璁块棶OPC鏈嶅姟鍣紝瀵圭幇鍦烘暟鎹繘琛屽瓨鍙栥
        寮鍙慜PC銆丏ata銆丄ccess銆丆lient涔嬪墠锛岃寮勬竻鏈嶅姟鍣ㄧ殑澶т綋鎯呭喌锛屾瘮濡傞渶瑕佽闂殑鏈嶅姟鍣ㄦ槸鍚︽彁渚涜嚜鍔ㄥ寲鎺ュ彛銆佹湇鍔″櫒鐨凮PC鐨勭増鏈瓑锛屽埌鐩墠涓烘锛孫PC鏈1.0鍜2.0涓や釜鐗堟湰锛屼袱涓増鏈殑鎺ュ彛瀹氫箟涓嶅悓锛2.0鐗堟槸瀵1.0鐨勬敼杩涳紝浣嗕笉鍏煎銆
        OPC瀹㈡埛绔殑涓昏浠诲姟锛
        鈶犲垱寤烘湇鍔″櫒瀵硅薄銆
        鈶″缓绔嬩笌鏈嶅姟鍣ㄧ殑杩炴帴銆
        鈶㈡祻瑙圤PC鏈嶅姟鍣ㄧ殑鍔熻兘銆傚鎴风▼搴忛渶瑕佸垱寤篛PC鍩洪噾浼氭彁渚涚殑OPC鏈嶅姟鍣ㄦ祻瑙堝櫒瀵硅薄锛圤PCServerList锛夊啀閫氳繃璇ュ璞$殑IOPCServerList鎺ュ彛鑾峰緱OPC鏈嶅姟鍣ㄥ悕绉扮殑鍒楄〃锛涘彲浠ラ氳繃鏋氫妇娉ㄥ唽琛ㄤ腑鍖呭惈鈥淥PC鈥濆瓙閿殑绋嬪簭鍚嶆潵娴忚绗﹀悎OPC鏁版嵁瀛樺彇瑙勮寖鐨勬湇鍔″櫒锛屼絾鏁堢巼杈冧綆銆
        鈶i氳繃OPC鎺ュ彛璇诲啓鏁版嵁銆
        鈶ゆ柇寮杩炴帴銆
        娉ㄦ剰浜嬮」锛
        璁捐鏃堕渶瑕佹敞鎰廜PC瀵硅薄鐨刅ARAINT缁撴瀯绫诲瀷銆佸紩鐢ㄨ鏁伴棶棰樸佸唴瀛樼鐞嗛棶棰樺拰澶勭悊閿欒杩斿洖浠g爜闂銆傜敱浜庝竴涓狾PC瀹㈡埛绋嬪簭鍙兘涓庡涓狾PC鏈嶅姟鍣ㄧ浉杩烇紝鍥犳璁捐鏃朵篃鏈濂介噰鐢ㄥ绾跨▼锛屽悓鏃朵笌澶氫釜OPC鏈嶅姟鍣ㄧ▼搴忚繘琛屼氦鎹互淇濊瘉杈冮珮鐨勯氫俊鏁堢巼銆傚彟澶栧鎴风▼搴忎腑OPC鎺ュ彛閮ㄥ垎濡備綍涓庡叾瀹冨姛鑳芥ā鍧楄繘琛屾暟鎹氦鎹㈤渶瑕佹牴鎹疄闄呮儏鍐典粩缁嗚冭檻銆
    2.1 浣跨敤MFC鐨凜OM搴撳嚱鏁板紑鍙慜PC瀹㈡埛绔
        鐩存帴浣跨敤COM搴撳嚱鏁板紑鍙慜PC瀹㈡埛绔紝鏄渶鍩烘湰涔熸槸鏈鐏垫椿鐨勬柟寮忥紝杩欑寮鍙戞柟寮忛毦搴﹀拰宸ヤ綔閲忛兘澶э紝瑕佹眰寮鍙戜汉鍛樺OPC瑙勮寖鍜孋OM鎶鏈師鐞嗗張姣旇緝娣卞叆鐨勪簡瑙c傛棭浜涙椂鍊橵isualC++缂栬瘧鍣ㄨ繕涓嶆敮鎸佹ā鏉匡紝鍥犳锛屽畠浠笉寰椾笉鍊熷姪闈炴ā鏉跨殑鍏跺畠鎵嬫鏉ュ皢COM鍔熻兘鎺哄叆绫讳腑銆侻icrosoft閫氳繃鍔犲叆涓浜涜櫄鍑芥暟鍒癈CmdTarget绫诲拰涓浜涘畯涓В鍐充簡杩欎釜闂锛屼娇寰楀湪MFC涓疄鐜癈OM鎺ュ彛鏈変簡鍙兘銆
        瀹㈡埛瑕佸垱寤轰竴涓狢OM瀵硅薄棣栧厛搴斿緱鍒扮被鍘傚璞★紝鍐嶇敱绫诲巶瀵硅薄鍒涘缓COM瀵硅薄銆備负浜嗗疄鐜扮被鍘傚璞★紝MFC鎻愪緵浜嗕竴涓氱敤鐨勭被鍘侰OleObjectFactory锛屽叾浠嶤CmdTarget娲剧敓锛屽苟瀹炵幇浜咺classFactory2鎺ュ彛銆傚湪COleObjectFactory鐨勬垚鍛樹腑锛屾渶涓昏鐨勬槸瀵硅薄鐨勭被鏍囪瘑绗︼紙CLSID锛夊拰绫诲瀷淇℃伅锛岀被鍘傜殑CreateInstance鎴愬憳鍑芥暟鍒╃敤杩欎簺淇℃伅鍦ㄨ繍琛屼腑鍒涘缓COM瀵硅薄銆
        OPCServer搴旂敤绋嬪簭鍖呮嫭浜嗕竴涓猄erver瀵硅薄銆佸涓狦roup瀵硅薄銆佸涓狪tem瀵硅薄锛孲erver瀵硅薄瀹炵幇IOPCServer鎺ュ彛锛汫roup瀵硅薄瀹炵幇IOPCItemMgt銆両OPCSyncIO鎺ュ彛锛汭tem瀵硅薄涓嶅疄鐜颁换浣曟帴鍙o紝鍙槸寤虹珛涓庢暟鎹簮鐨勮繛鎺ャ
        鏁版嵁閫氫俊鏄氳繃OPC瀹㈡埛瀵筄PC鏈嶅姟鍣ㄧ殑澶氭璋冪敤瀹屾垚鐨勩侽PC瀹㈡埛棣栧厛瑕侀氳繃绫诲巶瀵硅薄鍒涘缓OPCServer瀵硅薄锛岀敱OPCGroup瀵硅薄鐨処Unknown鎺ュ彛鏌ヨ鍒癐OPCServer鎺ュ彛锛屽啀閫氳繃璋冪敤杩欎竴鎺ュ彛鏍规嵁瀹㈡埛闇瑕佸鍔犲涓狾PCGroup瀵硅薄锛涜繖鏍稯PC瀹㈡埛灏卞彲浠ラ氳繃鍒涘缓鐨凮PCGroup瀵硅薄璋冪敤IOPCItemMgt鎺ュ彛澧炲姞瀹為檯鏁伴噺鐨処tem瀵硅薄锛涘嵆鍒涘缓OPCItem瀵硅薄锛涙帴鐫閫氳繃璋冪敤OPCGroup瀵硅薄鐨処OPCSyncIO鎺ュ彛鎴愬憳鍑芥暟Read鍜學rite鍚屾璇诲啓璇ョ粍鎵鍖呭惈鐨処tem瀵硅薄鐨勫睘鎬э紝鍗冲疄闄呮暟鎹硷紱鏈鍚嶰PC瀹㈡埛鍦ㄩ鍑烘椂閲婃斁鎵鏈夌殑鎺ュ彛骞朵緷娆″垹闄PCItem銆丱PCGroup鍜孫PCServer瀵硅薄銆
        瀹㈡埛绔▼搴忎笌OPC鏁版嵁瀛樺彇鏈嶅姟鍣ㄨ繛鎺ョ殑杩囩▼锛
        姝ラ1锛氬垵濮嬪寲COM搴撱
        hr=CoInitialize(NULL);
        if(FAILED(HR))
        {
           AfxMessageBox(鈥淐oInitialize fail!鈥)
                   return true;
         }
        鈥︹.
        CoUninitialize();
        return FALSE;
        姝ラ2锛氬垱寤篠erver瀵硅薄锛堜互涓嬩唬鐮佸潎鐣ュ幓鍙橀噺瀹氫箟銆佸嚭閿欏鐞嗙瓑閮ㄥ垎锛夈
        CLSIDFromProgID(PROGRAM_ID,&clsid);
        HRESULT hr=CoCreateInstance   (clsid,NULL,CLSCTX_INPROC_SERVER,IID_IUnknown,reinterpret_cast<void**>(&m_pUnknown));
        if(FAILED(hr))
        MessageBox(鈥渃an't create server鈥);
        return TRUE;
        姝ラ3锛氳幏寰桰OPCServer 鎺ュ彛銆
        m_pUnknown->QuertyIterface(IID_IOPCServer,( void**)(&m_pServer));
        姝ラ4锛氭坊鍔犵粍
        m_pServer->AddGroup(鈥淕ROUP鈥,TURE,CLIENT_RATE,1,NULL,NULL,O,&m_hGroup,&revisedUpdateRate,ID_IOPCItemMgt,(LPUNKNOWN*)(&m_pItemMgt));
        姝ラ5锛氭坊鍔犲叾浠栨帴鍙
        m_pItemMgt->QueryInterface(IID_IOPCSyncIO, ( void**)(&m_pSyncIO));
        m_pItemMgt->QueryInterface(IID_IOPCASyncIO, ( void**)(&m_pASyncIO));
        鍒╃敤IOPCServer鎺ュ彛锛屽彲浠ュ疄鐜板鍔犳垨鍒犻櫎缁勫璞$瓑绠$悊鍔熻兘锛涘埄鐢↖OPCItemMgt鎺ュ彛鍦ㄧ粍涓彲浠ュ疄鐜板鍔(IOPCItemMgt::AddItems()銆佸垹闄(IOPCItemMgt:eleteItems())鍙婄鐞嗛」绛夊姛鑳斤紝鍒╃敤IOPCSyncIO鍜孖OPCASyncIO鍙繘琛屾暟鎹殑鍚屾鎴栧紓姝ヨ鍐欐搷浣滐紝涓嶅璧樿堪銆
    2.2 閫氳繃鍒涘缓鍖呰绫诲疄鐜板鎴风
        鍒╃敤#import浼寚浠ゅ紩鍏ョ被鍨嬪簱锛岀紪杈戝櫒浠庣被鍨嬪簱涓鍙栦俊鎭苟涓斿垱寤哄寘瑁呯被銆備笉浠呭彲浠ュ绫诲瀷搴撴枃浠讹紙.tlb锛変娇鐢#import鎸囦护锛屼篃鍙互瀵圭粍浠禗LL鎴朎XE鏂囦欢锛岀敋鑷虫敮鎸佺被鍨嬪簱鐨勫鍚堟枃浠跺拰LoadTypeLib鍑芥暟鍙互鐞嗚В鐨勪换浣曞叾浠栨枃浠舵牸寮忎娇鐢#import鎸囦护銆#import鎸囦护灏嗕骇鐢熶袱涓枃浠讹紝浠栦滑浣嶄簬杈撳嚭璺緞锛屽拰绫诲瀷搴撳叿鏈夌浉鍚岀殑鍚嶇О锛屽悗缂鍒嗗埆涓衡.tlh鈥濆拰鈥.tli鈥濄傜敤#import鎸囦护寮曞叆绫诲瀷搴撴椂锛屽湪StdAfx.h鏂囦欢涓坊鍔狅細#import 鈥...\...\OPCServer\OPCServer.tlb鈥漒锛屽叾浠栨楠や唬鐮佺被浼糃OM搴撳嚱鏁板紑鍙戞柟寮忋
        鍖呰绫诲皝瑁呬簡COM搴撳嚱鏁帮紝Visual C++瀹㈡埛绋嬪簭閫氳繃鍖呰绫昏闂粍浠舵彁渚涚殑灞炴у拰鏂规硶銆傝櫧鐒朵腑闂村浜嗕竴灞傦紝浣嗗瀹㈡埛绋嬪簭寮鍙戜汉鍛樻潵璇达紝鍗存柟渚垮浜嗐#import鎸囦护鍒╃敤浜嗕竴涓柊鐨勭被锛歘com_ptr_t锛屼篃琚垚涓烘櫤鑳芥寚閽堬紝鏄竴涓ā鏉跨被锛屽畠灏佽浜嗘帴鍙f寚閽堝苟鎻愪緵浜嗕竴浜涙柟娉曞拰閲嶈浇鎿嶄綔绗︽潵绠鍖栨寚閽堢殑鎿嶄綔銆傛櫤鑳芥寚閽堣嚜鍔ㄦ墽琛孋OM鐨凜oCreateInstance鍜孮uertyIterface銆丄ddRef鍜孯elease鍑芥暟銆傝瀹炵幇寮傚父澶勭悊锛屽彲浣跨敤try/catch鍧椼傚湪catch鍧椾腑锛屽紓甯稿璞$被鍨嬩负_com_error瀵硅薄銆俖com_error绫诲皝瑁呬簡HERSULT閿欒浠g爜鍜孖errorInfo鎺ュ彛鎻愪緵鐨勭浉鍏崇幆澧冧俊鎭傜敤#import浼寚浠わ紝浣垮緱鍦╒isual C++涓娇鐢ㄤ唬鐮佺粍浠跺拰鍦╒BA涓竴鏍锋柟渚匡紝鑰屼笖涓嶉渶瑕佸湪宸ョ▼涓缁勪欢杩涜婧愪唬鐮佺淮鎶ゃ
    2.3 鍒╃敤绗笁鏂圭殑鍔ㄦ佽繛鎺ュ簱鎴栧伐鍏峰寘蹇熷紑鍙慜PC瀹㈡埛绔
        浜掕仈缃戜笂鏈変竴浜汷PC瀹㈡埛绔拰鏈嶅姟鍣ㄧ殑寮鍙戝伐鍏峰寘锛圱oolKit锛夛紝鍒╃敤杩欎簺宸ュ叿鍖呭彲浠ュ揩閫熷湴寮鍙慜PC绋嬪簭锛屼絾杩欎簺宸ュ叿鍖呭ぇ澶氶渶瑕佷粯璐广侳actory Soft杩樺紑鍙戜簡姣旇緝閫氱敤鐨勬湇鍔″櫒鍜屽鎴风鐨勫揩閫熷紑鍙戝伐鍏凤紝鏂囩尞[4]浠嬬粛浜嗘妸瀹冪敤浜庡厛杩涙帶鍒惰蒋浠跺钩鍙扮殑寮鍙戝拰搴旂敤鎯呭喌锛屼絾杩欎釜寮鍙戝伐鍏蜂环鏍兼槀璐碉紝涓嶉傚悎涓皬鍨嬬郴缁熺殑鑷富寮鍙戙備篃鏈変竴浜涙槸鍏嶈垂鐨勫鎴风绋嬪簭鍜屽彲浜х敓浠跨湡鏁版嵁鐨勬湇鍔″櫒绋嬪簭浠ュ強涓浜涙祴璇曡瘎浠峰伐鍏枫傛瘮濡俉intech OPC Server Client Develop Kit (1.0)锛屽叾婧愪唬鐮佸彲浠http://www.csdn.nethttp://www.win-tech.com /index.htm 涓嬭浇锛岃В鍘嬬缉鍚庨渶娉ㄦ剰鍥涗釜鏂囦欢锛歐Tclient.dll銆乄tclient lib鏂囦欢銆乄TclientAPI.h銆乄tclient Word鏂囨。銆俉TclientAPI.h 瀹氫箟浜嗛儴鍒咥PI鍑芥暟锛岃繖浜汚PI鍑芥暟鐨勫疄鐜颁互DLL鐨勫舰寮忓皝瑁呰捣鏉ワ紝璇﹁WTclient DLL User
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

    鏈増绉垎瑙勫垯

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

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

    GMT+8, 2024-11-24 01:56 , Processed in 0.163135 second(s), 87 queries .

    閰峰痉缃

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

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