示例#1
0
        public void FindSCI()
        {
            for (int i = 0; i < SCIPorts.Length; i++)
            {
                sci = new SCI(SCIPorts[i], 115200);
                if (sci.SCIOpen())
                {
                    sci.SCISendFrameData(ref userShake);

                    Thread.Sleep(500);
                    if (sci.SCIReceiveData(ref recvData))
                    {
                        if (recvData.Length == 0 || !System.Text.Encoding.Default.GetString(recvData).Contains("I am an KL36"))
                        {
                            sci.Close();
                            continue;
                        }
                        if (System.Text.Encoding.Default.GetString(recvData).Contains("I am an KL36"))   //记录UART_User串口的Com号
                        {
                            PublicVar.g_SCIComNum = SCIPorts[i];
                            sci.Close();
                            break;                                                              //找到UART_User串口后,跳出循环
                        }
                    }
                }
            }
        }
示例#2
0
 public void UartConfrim()
 {
     sci = new SCI(PublicVar.g_SCIComNum, PublicVar.g_SCIBaudRate);
     if (sci.SCIOpen())
     {
         sci.SCISendFrameData(ref uartON);
     }
     sci.Close();
 }
示例#3
0
 internal V_SCI(SeamlessViewsContext Context, SCI SCI)
     : base(Context)
 {
     _SCIKEY      = SCI.SCIKEY;
     _CAMPUS_NAME = SCI.CAMPUS_NAME;
     _CAMPUS_TYPE = SCI.CAMPUS_TYPE;
     _SCHOOL_NAME = SCI.SCHOOL_NAME;
     _SCHOOL_TYPE = SCI.SCHOOL_TYPE;
 }
示例#4
0
 public UC_ADC()
 {
     InitializeComponent();
     sci = new SCI(PublicVar.g_SCIComNum, PublicVar.g_SCIBaudRate);
     if (sci.SCIOpen())
     {
         sci.SCISendFrameData(ref uartOFF);
     }
     sci.Close();
 }
示例#5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.comboBox1.Text != "")
     {
         PublicVar.g_SCIBaudRate = int.Parse(this.comboBox1.Text);
         button1.Visible         = true;
     }
     sci = new SCI(PublicVar.g_SCIComNum, PublicVar.g_SCIBaudRate);
     if (sci.SCIOpen())//串口打开成功
     {
         this.label3.Text  = "已选择波特率为:" + comboBox1.Text + "\n";
         this.label3.Text += "设备可以正常连接,开始实验吧!";
         PublicVar.g_Uflag = 1;
         sci.SCISendFrameData(ref finshShake);
         sci.Close();
     }
 }
 public UC_ReceivedDataDisplay()
 {
     InitializeComponent();
     sci = new SCI(PublicVar.g_SCIComNum, PublicVar.g_SCIBaudRate);
     SetInt();
 }
示例#7
0
 public UC_SelectUart()
 {
     InitializeComponent();
     SCIPorts = SCI.SCIGetPorts();
 }
示例#8
0
 public UC_GPIO()
 {
     InitializeComponent();
     sci = new SCI(PublicVar.g_SCIComNum, PublicVar.g_SCIBaudRate);
 }