示例#1
0
        private void getUartConfig_Click(object sender, EventArgs e)
        {
            string ipstr    = ipAddrTextBox.Text;
            string gpibAddr = "inst29";
            string resp;

            int        byteTimeout_us = Convert.ToInt32(byteTimeoutComboBox.Text);
            int        msgTimeout_ms  = Convert.ToInt32(msgTimeoutComboBox.Text);
            int        dataRate       = Convert.ToInt32(uartDataRateComboBox.Text);
            byte       uartStopbit    = Convert.ToByte(uartStpBitComboBox.Text);
            byte       uartNumbit     = Convert.ToByte(uartNumBitComboBox.Text);
            byte       uartParity     = 0;
            VXI11Class remote_inst    = new VXI11Class(gpibAddr, ipstr);

            remote_inst.uartGetConfig(ref dataRate, ref uartNumbit, ref uartParity, ref uartStopbit, ref msgTimeout_ms, ref byteTimeout_us);
            remote_inst.close();

            uartNumBitComboBox.Text   = Convert.ToString(uartNumbit);
            uartDataRateComboBox.Text = Convert.ToString(dataRate);
            uartStpBitComboBox.Text   = Convert.ToString(uartStopbit);
            msgTimeoutComboBox.Text   = Convert.ToString(msgTimeout_ms);
            byteTimeoutComboBox.Text  = Convert.ToString(byteTimeout_us);
            switch (uartParity)
            {
            case 0x00:
                uartParityComboBox.Text = "None";
                break;

            case 0x01:
                uartParityComboBox.Text = "Odd";
                break;

            case 0x02:
                uartParityComboBox.Text = "Even";
                break;
            }
        }