コード例 #1
0
        private void setUartConfigButton_Click(object sender, EventArgs e)
        {
            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;

            switch (uartParityComboBox.Text)
            {
            case "None":
                uartParity = 0;
                break;

            case "Odd":
                uartParity = 1;
                break;

            case "Even":
                uartParity = 2;
                break;

            default:
                break;
            }

            string ipstr    = ipAddrTextBox.Text;
            string gpibAddr = "inst29";


            VXI11Class remote_inst = new VXI11Class(gpibAddr, ipstr);

            remote_inst.uartSetConfig(dataRate, uartNumbit, uartParity, uartStopbit, msgTimeout_ms, byteTimeout_us);
            remote_inst.close();
        }