예제 #1
0
        private void readButton_Click(object sender, EventArgs e)
        {
            string     ipstr       = ipAddrTextBox.Text;
            string     gpibAddr    = "inst" + gpibAddrTextBox.Text;
            string     cmd         = commandComboBox.Text;
            int        timeout_ms  = 0;
            VXI11Class remote_inst = new VXI11Class(gpibAddr, ipstr);
            //string resp = string.Empty;
            string readstring = string.Empty;

            byte[] resp = null;
            try
            {
                /*if (LockDeviceCheckBox.Checked)
                 * {
                 *  // device lock is requested, min 1000 ms is chosen for demo
                 *  //
                 *  if (Convert.ToInt32(timeOutTextBox.Text) >= 1000)
                 *  {
                 *      resp = remote_inst.read(Convert.ToInt32(timeOutTextBox.Text));
                 *  }
                 * }
                 * else
                 * {
                 *  resp = remote_inst.read();
                 * }*/
                resp = remote_inst.readBytes();
            }
            catch (VisaException ex)
            {
                readstring = ex.ErrorCode.ToString();
            }
            Console.WriteLine(resp);
            readstring            = System.Text.Encoding.ASCII.GetString(resp);
            responseTextBox.Text += readstring + "\r\n\r\n";
            remote_inst.close();
        }