<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > C++builder串口通信設(shè)計(一)-串口接收數(shù)據(jù)

          C++builder串口通信設(shè)計(一)-串口接收數(shù)據(jù)

          作者: 時間:2016-11-28 來源:網(wǎng)絡(luò) 收藏
          一、安裝mscomm32.ocx控件

          1、復(fù)制mscomm32.ocx到windowssystem32下

          本文引用地址:http://www.ex-cimer.com/article/201611/322881.htm

          2、注冊

          二、在c++builder下引入mscomm32.ocx

          選擇菜單component->Import ActiveX Control,




          選擇“Microsoft Comm Control 6.0(Version1.1)”,點(diǎn)擊“install”



          然后可以在ActiveX控件組看到一個像電話的控件。

          三、建立應(yīng)用工程

          1、設(shè)計界面

          引入了mscomm32控件,memo1控件,Button1,Button2,RadioButton1和RadioButton2

          1) 其中memo1用于顯示串口接收內(nèi)容

          2)Button1用于控制串口的開啟和關(guān)閉,Button2用于終止應(yīng)用程序

          3)RadioButton1和RadioButton2用于選擇串口接收方式(類型)

          2、unit1.h內(nèi)容,其中紅色為引入的全局變量

          #include
          #include
          #include "MSCommLib_OCX.h"
          #include
          //---------------------------------------------------------------------------
          class TForm1 : public TForm
          {
          __published: // IDE-managed Components
          TMSComm *MSComm1;
          TMemo *Memo1;
          TButton *Button1;
          TButton *Button2;
          TGroupBox *GroupBox1;
          TRadioButton *RadioButton1;
          TRadioButton *RadioButton2;
          void __fastcall Button1Click(TObject *Sender);
          void __fastcall MSComm1Comm(TObject *Sender);
          void __fastcall Button2Click(TObject *Sender);
          void __fastcall FormCreate(TObject *Sender);
          void __fastcall RadioButton1Click(TObject *Sender);
          void __fastcall RadioButton2Click(TObject *Sender);
          private: // User declarations
          public: // User declarations
          __fastcall TForm1(TComponent* Owner);
          int type;//0--字符串,1---二進(jìn)制
          };
          //---------------------------------------------------------------------------
          extern PACKAGE TForm1 *Form1;
          //---------------------------------------------------------------------------
          #endif


          上一頁 1 2 下一頁

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();