public void connect()
        {
            rm         = new Ivi.Visa.Interop.ResourceManager();
            accessMode = Ivi.Visa.Interop.AccessMode.NO_LOCK;
            // ファンクションジェネレータの製造番号
            string serial = TextBox_SerialNumber.Text;

            int    timeOut      = 0;
            string optionString = "";

            // デバイスと接続(USB)
            // WF1973の場合 "USB0::0x0D4A::0x000D::" としてください
            // WF1974の場合 "USB0::0x0D4A::0x000E::" としてください
            msg = (Ivi.Visa.Interop.IMessage)rm.Open(
                "USB0::0x0D4A::0x000E::" + serial + "::INSTR",
                accessMode,
                timeOut,
                optionString);

            // 周波数を5.0kHzに設定し、その値を問い合わせる
            msg.WriteString(":OUTP1:STAT OFF; " + "\n");
            msg.WriteString(":OUTP2:STAT OFF; " + "\n");
            msg.WriteString(":SOUR1:FUNC SIN \n");
            msg.WriteString(":SOUR2:FUNC SIN \n");

            Button1.Content = "切断";
            // デバイスを閉じる
            // msg.Close();
        }
Exemplo n.º 2
0
 public static bool Initialize()
 {
     RM  = new Ivi.Visa.Interop.ResourceManager();
     DMM = new Ivi.Visa.Interop.FormattedIO488();
     try
     {
         DMM.IO    = (Ivi.Visa.Interop.IMessage)RM.Open(AGI33220A_ADDRESS);
         Flag33220 = true;
         return(true);
     }
     catch
     {
         try
         {
             DMM.IO    = (Ivi.Visa.Interop.IMessage)RM.Open(AGI33511B_ADDRESS);
             Flag33220 = false;
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Exemplo n.º 3
0
        private void ButtonInitial_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.MessageBox.Show(
                "Make sure NOT to connect the current to be measured to the picoammeter.",
                "Zero Check",
                MessageBoxButtons.OK, MessageBoxIcon.Information);

            // Connect with K6487
            try
            {
                K6487.IO = (Ivi.Visa.Interop.IMessage)RM.Open(textPort.Text);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                    ex.Message,
                    "Error Opening Connection to Instrument",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                System.Runtime.InteropServices.Marshal.ReleaseComObject(K6487);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(RM);
                buttonStart.Content = "START";
                return;
            }

            // Timeout: 10s
            K6487.IO.Timeout = 10000;
            // Show the information of K6487
            K6487.WriteString("*IDN?");
            temp   = K6487.ReadString();
            Title += ": " + temp;

            // Setup K6487
            K6487.WriteString("*RST");
            K6487.WriteString("*CLS");
            K6487.WriteString("FUNC 'CURR'");
            K6487.WriteString("SYST:ZCH ON");
            K6487.WriteString("RANG 2e-9");
            K6487.WriteString("INIT");
            K6487.WriteString("SYST:ZCOR:STAT OFF");
            K6487.WriteString("SYST:ZCOR:ACQ");
            K6487.WriteString("SYST:ZCOR ON");
            K6487.WriteString("CURR:RANG:AUTO ON");
            K6487.WriteString("SYST:ZCH OFF");
            K6487.WriteString("TRAC:TST:FORM DEL");
            // Filter
            K6487.WriteString("MED:RANK 5");
            K6487.WriteString("MED ON");
            K6487.WriteString("AVER:COUN 20");
            K6487.WriteString("AVER:TCON MOV");
            K6487.WriteString("AVER ON");
            // Trigger
            countTrigger = int.Parse(textTriggerCount.Text);
            K6487.WriteString(String.Format("TRIG:COUN {0}", countTrigger));

            var sts = 0;

            while (sts == 1)
            {
                K6487.WriteString("*OPC?");
                System.Threading.Thread.Sleep(1000);
                sts = K6487.ReadNumber();
            }

            buttonInitial.Content = "Re-initialize";
            buttonStart.IsEnabled = true;
        }