Exemple #1
1
        public void CheckDMMError(FormattedIO488 myDmm)
        {
            myDmm.WriteString("SYST:ERR?", true);
            string errStr = myDmm.ReadString();

            if (errStr.Contains("No error")) //If no error, then return
            {
                return;
            }
            //If there is an error, read out all of the errors and return them in an exception
            else
            {
                string errStr2 = "";
                do
                {
                    myDmm.WriteString("SYST:ERR?", true);
                    errStr2 = myDmm.ReadString();
                    if (!errStr2.Contains("No error"))
                    {
                        errStr = errStr + "\n" + errStr2;
                    }
                } while (!errStr2.Contains("No error"));
                throw new Exception("Exception: Encountered system error(s)\n" + errStr);
            }
        }
Exemple #2
0
        private void InitializeU3606A(string ConnectString)
        {
            bool devReady = false;
            string idnTemp;

            ioMultiMeterCntrl = new FormattedIO488Class();   // Create the formatted I/O object

            devReady = U3606A_Connect(ConnectString);
            if (devReady == false)
            {
                throw new Exception("Connect to U3606A failed on " + ConnectString);
            }
            else
            {
                ioMultiMeterCntrl.WriteString("*RST", true);              // Reset
                ioMultiMeterCntrl.WriteString("*CLS", true);              // Clear
                ioMultiMeterCntrl.WriteString("*IDN?", true);             // Read ID string
                idnTemp = ioMultiMeterCntrl.ReadString();

                Trace.WriteLine("Connect to U3606A suceess! U3606A IDN: " + idnTemp.ToString());

                ioMultiMeterCntrl.WriteString("SYST:BEEP:STAT OFF", true);

                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.0001", true); // 10mA range with 100uA resolution

                ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.000001", true);  // 10mA range with 1uA resolution
            }
        }
Exemple #3
0
        //Open the VISA session using a socket port:
        //  VSA on a PC:                        Port=5025
        //  VSA on an X-Series Signal Analyzer: Port=5024



        #region constructors
        public ScpiDemo(string openString)
        {
            IVisaSession session = null;

            try
            {
                session       = ioMgr.Open(openString, AccessMode.NO_LOCK, 3000, "");
                instrument.IO = (IMessage)session;
                instrument.IO.SendEndEnabled = false;
                instrument.IO.Timeout        = 10000;               //in milliseconds
                instrument.IO.TerminationCharacterEnabled = true;   //Defaults to false

                //Determine whether the VSA process is running
                bool isCreated = false;
                instrument.WriteString("*IDN?");
                IdnString = instrument.ReadString();
            }
            catch (COMException ex)
            {
                Console.WriteLine("Failed to connect to the VSA SCPI interface.");
                Console.WriteLine("   Ensure that the SCPI interface has been started from the");
                Console.WriteLine("      VSA=>Utilities=>SCPI Configuration menu.");
                Console.WriteLine("   Refer to the SCPI Getting Started documentation for instructions on enabling SCPI.");
                Console.WriteLine("Details:");
                Console.WriteLine(ex.Message);

                Console.WriteLine("Press enter to exit demo");
                Console.ReadLine();

                return;
            }
        }
Exemple #4
0
        private static Measurement TakeMeasurement(FormattedIO488 src, FormattedIO488 gen, int measurement, AmplitudeCalibration AmpCal)
        {
            // HP 3325B drifts so Check to see if the user wants amplitude calibration
            if (AmpCal == AmplitudeCalibration.On)
            {
                gen.WriteString("AC;");
                System.Threading.Thread.Sleep(2000);
            }

            // Take a THD reading
            src.WriteString(@":INIT;", true);
            System.Threading.Thread.Sleep(6000);
            src.WriteString(@":SENSe:DISTortion:THD?;", true);
            System.Threading.Thread.Sleep(1000);
            double thd = src.ReadNumber();

            //src.WriteString(@": INIT;");
            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 2,2;", true);
            System.Threading.Thread.Sleep(1000);
            double harm2 = src.ReadNumber();

            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 3,3;", true);
            System.Threading.Thread.Sleep(1000);
            double harm3 = src.ReadNumber();

            src.WriteString(@":SENSe:DISTortion:HARMonic:MAGNitude? 4,4;", true);
            System.Threading.Thread.Sleep(1000);
            double harm4 = src.ReadNumber();

            return(new Measurement(measurement, thd, harm2, harm3, harm4, DateTime.Now));
        }
        public bool InitializeU2751A_WELLA(string ConnectString)
        {
            bool   devReady = false;
            string idnTemp;

            ioRelayWellACntrl = new FormattedIO488();     // Create the formatted I/O object
            devReady          = U2751A_WellA_Connect(ConnectString);
            if (devReady == false)
            {
                devReadyStatus = false;
                //throw new Exception("Connect to U2751A_WELLA failed on " + ConnectString);
                //MessageBox.Show("Connect to U2751A_WELLA failed on " + ConnectString);
            }
            else
            {
                devReadyStatus = true;
                ioRelayWellACntrl.WriteString("*RST", true);        // Reset
                ioRelayWellACntrl.WriteString("*CLS", true);        // Clear
                ioRelayWellACntrl.WriteString("*IDN?", true);       // Read ID string
                idnTemp = ioRelayWellACntrl.ReadString();

                IDN_SwitchA = idnTemp;

                OnAgilentMessage(new AgilentMessageEventArgs("Connect to U2751A WellA suceess! U2751A WellA IDN: " + idnTemp.ToString()));
            }

            return(devReadyStatus);
        }
        public virtual bool Initialize(out string outMessage)
        {
            IVisaSession session = null;

            try
            {
                session       = ioMgr.Open(m_openString, AccessMode.NO_LOCK, 3000, "");
                instrument.IO = (IMessage)session;
                instrument.IO.SendEndEnabled = false;
                instrument.IO.Timeout        = 10000;               //in milliseconds
                instrument.IO.TerminationCharacterEnabled = true;   //Defaults to false

                //Determine whether the VSA process is running
                bool isCreated = false;
                instrument.WriteString("*IDN?");
                IdnString  = instrument.ReadString();
                outMessage = string.Empty;
                return(true);
            }
            catch (COMException ex)
            {
                outMessage = ex.Message;
                return(false);
            }
        }
Exemple #7
0
        private void InitializeU3606A(string ConnectString)
        {
            bool   devReady = false;
            string idnTemp;

            ioMultiMeterCntrl = new FormattedIO488Class();   // Create the formatted I/O object

            devReady = U3606A_Connect(ConnectString);
            if (devReady == false)
            {
                throw new Exception("Connect to U3606A failed on " + ConnectString);
            }
            else
            {
                ioMultiMeterCntrl.WriteString("*RST", true);              // Reset
                ioMultiMeterCntrl.WriteString("*CLS", true);              // Clear
                ioMultiMeterCntrl.WriteString("*IDN?", true);             // Read ID string
                idnTemp = ioMultiMeterCntrl.ReadString();

                Trace.WriteLine("Connect to U3606A suceess! U3606A IDN: " + idnTemp.ToString());


                ioMultiMeterCntrl.WriteString("SYST:BEEP:STAT OFF", true);

                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.0001", true); // 10mA range with 100uA resolution

                ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.000001", true);  // 10mA range with 1uA resolution
            }
        }
Exemple #8
0
        public bool OpenPort()
        {
            string addrtype, option;

            option = "";
            try
            {
                if (addr.Length < 5)
                {
                    MessageBox.Show("Incorrect address: Check address", "SwitchCommandCenter Class Error");
                    return(false);
                }
                else
                {
                    addrtype = addr.Substring(0, 4);
                }
                if (addrtype == "GPIB")
                {
                    data_logger.IO = (IMessage)mgr.Open(addr, AccessMode.NO_LOCK, 2000, option);
                }
                else
                {
                    MessageBox.Show("No Resources found");
                }
                data_logger.WriteString("*IDN?", true);
                currmsg = data_logger.ReadString();
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "\nPort Couldn't be Opened at SwitchCommandCenter", "SwitchCommandCenter");
                return(false);
            }
        }
Exemple #9
0
 public virtual string Initial(string Adress)
 {
     try
     {
         this.Adress = Adress;
         rm          = new ResourceManager();
         Device      = new FormattedIO488();
         Device.IO   = (IMessage)rm.Open(Adress, AccessMode.NO_LOCK, 2000, "");
         Device.IO.Clear();
         Device.WriteString("*IDN?");
         string RD = Device.ReadString();
         Name         = RD;
         Model        = Name.Split(',')[1];
         SerialNumber = RD;
         if (Model == "U2000A")
         {
             //Device.WriteString("CAL:ZERO:TYPE INT");
             //Device.WriteString("CAL:ALL");
             //Device.WriteString("*OPC?");
             //int i = 0;
             //while(Conversion.Val(Device.ReadString())==0)
             //{
             //    i++;
             //    if (i > 10000000) break;
             //}
             Device.WriteString("UNIT:POW W");
         }
         return("Ok_" + RD);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
 public void SetChannelVoltage(double voltage, int ch)
 {
     lock (ioVoltCntrl)
     {
         string chVoltage = voltage.ToString();
         string chNum     = ch.ToString();
         ioVoltCntrl.WriteString("VOLT " + chVoltage + ", (@" + chNum + ")", true);
     }
 }
        // Sil butonu
        private void button2_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (gpibDevice != null)
                {
                    gpibDevice.WriteString("*RST");
                    gpibDevice.WriteString("*CLS");
                }
            }
            catch
            {
            }


            try
            {
                if (gpibDevice2 != null)
                {
                    gpibDevice2.WriteString("*RST");
                    gpibDevice2.WriteString("*CLS");
                }
            }
            catch
            {
            }



            comboBox1.Text = "";
            comboBox2.Text = "";
            comboBox3.Text = "";
            comboBox4.Text = "";


            textBox3.Clear();
            textBox4.Clear();
            textBox1.Clear();

            label9.Visible = false;

            pictureBox9.Visible = false;
            pictureBox7.Visible = false;
            pictureBox5.Visible = false;
            pictureBox3.Visible = false;
            pictureBox1.Visible = false;

            listbox.Items.Clear();
            listBox2.Items.Clear();

            gucler.Clear();                       //güç ve frekans listesini silmek için kullandım.
            frekanslar.Clear();
            matrix.Clear();

            label9.Visible  = false;
            label19.Visible = false;
        }
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.IsEnabled = false;

                if (Connect(tbIP_Address.Text))
                {
                    inst.WriteString("*IDN?");
                    String strIdn = inst.ReadString();
                    MessageBox.Show("Connected" + Environment.NewLine + strIdn);

                    btnReset.IsEnabled = true;
                    //SetAutoScale.Enabled = true;
                    //GetError.Enabled = true;
                    btnStart.IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                //Reset.Enabled = false;
                btnStart.IsEnabled = false;
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
            }
            finally
            {
                this.IsEnabled = true;
            }
        }
Exemple #13
0
 private void Reset()
 {
     try
     {
         _myVisaEq.WriteString("*CLS; *RST", true);
     }
     catch (Exception ex)
     {
         throw new Exception("N6700B: Initialize -> " + ex.Message);
     }
 }
        public bool InitializeU3606A(string ConnectString)
        {
            string idnTemp;

            ioMultiMeterCntrl = new FormattedIO488();   // Create the formatted I/O object

            if (ConnectString == "")
            {
                //MessageBox.Show("Error Due to invalid instrument alias: " + ConnectString);
                //return "Error Due to invalid instrument alias: null";
                devReadyStatus = false;
                return(devReadyStatus);
            }

            _connectString = ConnectString;

            devReadyStatus = U3606A_Connect(ConnectString);
            if (devReadyStatus)
            {
                ioMultiMeterCntrl.WriteString("*RST", true);              // Reset
                ioMultiMeterCntrl.WriteString("*CLS", true);              // Clear
                ioMultiMeterCntrl.WriteString("*IDN?", true);             // Read ID string
                idnTemp = ioMultiMeterCntrl.ReadString();

                IDN_MultiMeter = idnTemp;

                Trace.WriteLine("Connect to U3606A suceess! U3606A IDN: " + idnTemp.ToString());
                //MessageBox.Show("Connect to U3606A suceess! U3606A IDN: " + idnTemp.ToString());

                ioMultiMeterCntrl.WriteString("SYST:BEEP:STAT OFF", true);

                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.000001", true); // 10mA range with 1uA resolution
                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.01,0.0000001", true);  // 10mA range with 0.1uA resolution

                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.1,0.00001", true); // 100mA range with 10uA resolution
                //ioMultiMeterCntrl.WriteString("CONF:CURR 0.1,0.000001", true);  // 100mA range with 1uA resolution

                ioMultiMeterCntrl.WriteString("CONF:CURR 1,0.0001", true);  // 1A range with 100uA resolution
                //ioMultiMeterCntrl.WriteString("CONF:CURR 1,0.00001", true);  // 1A range with 10uA resolution;

                /*
                 * By my test, "CONF:CURR 1, 0.00001" can't set resolution to 10uA.
                 * But use the following command can't reset resolution to 10uA
                 */
                //ioMultiMeterCntrl.WriteString("CURR:RES 1E-05", true);

                //ioMultiMeterCntrl.WriteString("CONF:CURR 3,0.001", true);  // 3A range with 1mA resolution
                //ioMultiMeterCntrl.WriteString("CONF:CURR 3,0.0001", true);  // 3A range with 100uA resolution; By my test it is not supported

                //return "Connect to U3606A Successfully!!! U3606A IDN: " + idnTemp.ToString();
            }

            return(devReadyStatus);
        }
Exemple #15
0
 public void RESET()
 {
     try
     {
         myVisaSa.WriteString("*CLS; *RST", true);
     }
     catch (Exception ex)
     {
         throw new Exception("Equip66321: RESET -> " + ex.Message);
     }
 }
Exemple #16
0
        public void button1_Click(object sender, EventArgs e)
        {
            string srcAddress = label1.Text;

            src.IO         = (IMessage)rMgr.Open(srcAddress, AccessMode.NO_LOCK, 2000, "");
            src.IO.Timeout = 12000;
            sendstring     = textBox1.Text;
            src.WriteString(sendstring + "\n");//("*IDN?\n");
            textBox2.AppendText(textBox1.Text + "\r\n");
            textBox1.Text = "";
            //  textBox2.Text = src.ReadString();
        }
 void IIPowerSensor.Initialize(int chNo)
 {
     try
     {
         _myVisaPm.WriteString("SYST:PRES DEF", true);
         bool dummy = OPERATION_COMPLETE();
     }
     catch (Exception ex)
     {
         throw new Exception("E4417A: Initialize -> " + ex.Message);
     }
 }
Exemple #18
0
 public void Send(string cmd)
 {
     if (VisaIo != null)
     {
         VisaIo.WriteString(cmd);
     }
 }
 static void Instrument_Write(FormattedIO488 instrument_control_object, string command)
 {
     /*
      *  Purpose: Used to send commands to the instrument.
      *
      *  Parameters:
      *      instrument_control_object - The reference to the instrument object created external to this function. It is passed
      *                                  in by reference so that it retains all values upon exiting this function, making it
      *                                  consumable to all other calling functions.
      *
      *      command - The command string issued to the instrument in order to perform an action.
      *
      *  Returns:
      *      None
      *
      *  Revisions:
      *      2019-06-04      JJB     Initial revision.
      */
     if (echo_command == true)
     {
         Console.WriteLine("{0}", command);
     }
     instrument_control_object.WriteString(command + "\n");
     return;
 }
Exemple #20
0
        private static double SetAndTakeSingleMeasurement(FormattedIO488 THDMeter, FormattedIO488 SigGen, double setVoltage, VoltUnits Units)
        {
            string dcOffset;

            if (Units == VoltUnits.Volts)
            {
                dcOffset = string.Format("OF {0:F3} VO; AC; ", setVoltage);
            }
            else
            {
                dcOffset = string.Format("OF {0:F3} MV; AC; ", setVoltage);
            }

            SigGen.WriteString(dcOffset, true);
            System.Threading.Thread.Sleep(1000);
            THDMeter.WriteString(@":READ?");
            double voltage = THDMeter.ReadNumber();

            if (Units == VoltUnits.Millivolts)
            {
                voltage *= 1000;
            }

            return(voltage);
        }
Exemple #21
0
        public static bool Write(byte address, string command)
        {
            resourceManager = new ResourceManager();
            ioObject        = new FormattedIO488();
            string addr = $"GPIB::{address.ToString()}::INSTR";

            try
            {
                ioObject.IO = (IMessage)resourceManager.Open(addr, AccessMode.NO_LOCK, 0, "");
                Thread.Sleep(20);
                ioObject.WriteString(data: command, flushAndEND: true);
                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                try { ioObject.IO.Close(); }
                catch { }
                try { Marshal.ReleaseComObject(ioObject); }
                catch { }
                try { Marshal.ReleaseComObject(resourceManager); }
                catch { }
            }
        }
Exemple #22
0
        private static void SetAndTakeSingleFrequencyMeasurement(FormattedIO488 THDMeter, FormattedIO488 SigGen, out string PassFailResult, out double voltage, VoltageFrequencyValue val)
        {
            switch (val.WaveType)
            {
            case Waves.Sine:
                SigGen.WriteString("FU1;", true);
                break;

            case Waves.Square:
                SigGen.WriteString("FU2;", true);
                break;

            case Waves.Triangle:
                SigGen.WriteString("FU3;", true);
                break;

            case Waves.PosRamp:
                SigGen.WriteString("FU4;", true);
                break;
            }

            var FreqStr = string.Format("FR {0:F9} ", val.SetFrequency);

            switch (val.FrequencyUnits)
            {
            case FreqUnits.Hz:
                FreqStr += "HZ;";
                break;

            case FreqUnits.KHz:
                FreqStr += "KH;";
                break;

            case FreqUnits.MHz:
                FreqStr += "MH;";
                break;
            }

            SigGen.WriteString(FreqStr, true);

            SigGen.WriteString("AM 1.0 VO;", true);

            var DCOffsetStr = string.Format("OF {0:F2} VO; AC;", val.SetPoint);

            SigGen.WriteString(DCOffsetStr, true);

            System.Threading.Thread.Sleep(2000);

            THDMeter.WriteString(@":READ?");
            voltage = THDMeter.ReadNumber();

            if ((voltage >= val.MinValue) & (voltage <= val.MaxValue))
            {
                PassFailResult = "Pass";
            }
            else
            {
                PassFailResult = "Fail";
            }
        }
Exemple #23
0
 /// <summary>
 /// 查询命令
 /// </summary>
 public double[] QueryBinary(string cmd)
 {
     double[] messageReCmd = null;
     messageBased.WriteString(cmd);
     messageReCmd = messageBased.ReadIEEEBlock(IEEEBinaryType.BinaryType_R8, false, true) as double[];
     if (messageReCmd == null)//容错机制
     {
         messageBased.WriteString(cmd);
         messageReCmd = messageBased.ReadIEEEBlock(IEEEBinaryType.BinaryType_R8, false, true) as double[];
         return(messageReCmd);
     }
     else
     {
         return(messageReCmd);
     }
 }
Exemple #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            var resourceString = ("GPIB0::" + GPIB.Text + "::INSTR");

            richTextBox1.Clear();
            richTextBox1.BackColor = Color.White;
            try
            {
                _io488Con.IO = (IMessage)_rm.Open(resourceString, AccessMode.NO_LOCK, 0);
                _io488Con.IO.Clear();
                _io488Con.WriteString(richTextBox2.Text);
                if (checkBox1.CheckState == CheckState.Checked)
                {
                    richTextBox1.Text = _io488Con.ReadString();
                }
                else
                {
                    richTextBox1.BackColor = Color.LimeGreen;
                    richTextBox1.Text      = @"Command Execution Completed";
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                _io488Con.IO.Close();
            }
        }
Exemple #25
0
 public void WriteVISACommand(string command)
 {
     try
     {
         instrument.IO = (IMessage)session;
         //instrument.IO.SendEndEnabled = false;
         //instrument.IO.Timeout = 1000;                       //in milliseconds
         //instrument.IO.TerminationCharacterEnabled = true;   //Defaults to false
         instrument.WriteString(command);
         //instrument.IO.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("WriteVISACommand(" + command + ") Error" + ex.Message);
     }
 }
Exemple #26
0
        private void button5_Click(object sender, EventArgs e)
        {
            ResourceManager rm;
            FormattedIO488  myDmm;

            rm    = new ResourceManager();
            myDmm = new FormattedIO488();
            string DutAddr = "USB0::0x2A8D::0x5418::MY57190037::0::INSTR";

            myDmm.IO = (IMessage)rm.Open(DutAddr, AccessMode.NO_LOCK, 2000, "");
            myDmm.IO.Clear();
            ////myDmm.WriteString("SYST:PRES");
            //myDmm.WriteString("INIT:CONT OFF");
            myDmm.WriteString("FETC1:POW:AC?");

            //myDmm.WriteString("MEAS2:POW:AC? -70DBM,1,(@1)");
            string Pow;

            Pow = "gdfdg";
            Pow = Pow + " ";
            Pow = myDmm.ReadString();
            double d;

            d = Conversion.Val(Pow);
            string k;

            k             = "ghg";
            k             = d.ToString("0.##E+0");
            textBox1.Text = k;
        }
Exemple #27
0
        public override string Visa_GPIBQuery(FormattedIO488 iO488, string cmdstr)
        {
            string VisaStr = string.Empty;

            iO488.WriteString(cmdstr, true);
            VisaStr = iO488.ReadString();
            return(VisaStr);
        }
 protected Int16 ReadStandardEventByte()
 {
     if (DriverIsReady)
     {
         try {
             _driver.WriteString("*ESR?");
             return((Int16)_driver.ReadNumber(IEEEASCIIType.ASCIIType_I2, true));
         }
         catch (Exception ex) {
             Close();
             throw ex;
         }
     }
     else
     {
         throw new System.InvalidOperationException("Cannot execute ReadStandardEventByte(). Driver not initialized or is closed.");
     }
 }
Exemple #29
0
 static void instrWrite(FormattedIO488 instr, string cmd)
 {
     if (echoCmd == true)
     {
         Console.WriteLine("{0}", cmd);
     }
     instr.WriteString(cmd + "\n");
     return;
 }
 void IISwitch.Initialize()
 {
     try
     {
         _myVisaEq.WriteString("*CLS; *RST", true);
     }
     catch (Exception ex)
     {
         throw new Exception("Agilent3499: Initialize -> " + ex.Message);
     }
 }
Exemple #31
0
        private void button1_Click(object sender, EventArgs e)
        {
            var rm   = new ResourceManager();
            var conn = new FormattedIO488();

            conn.IO = (IMessage)rm.Open(textboxAddress.Text);
            conn.IO.Clear();
            conn.WriteString("*IDN?", true);
            MessageBox.Show(conn.ReadString());
        }
Exemple #32
0
        public void CheckDMMError(FormattedIO488 myDmm)
        {
            myDmm.WriteString("SYST:ERR?", true);
            string errStr = myDmm.ReadString();
            if (errStr.Contains("No error")) //If no error, then return
                return;
            //If there is an error, read out all of the errors and return them in an exception
            else
            {
                string errStr2 = "";
                do
                {
                    myDmm.WriteString("SYST:ERR?", true);
                    errStr2 = myDmm.ReadString();
                    if (!errStr2.Contains("No error")) errStr = errStr + "\n" + errStr2;

                } while (!errStr2.Contains("No error"));
                throw new Exception("Exception: Encountered system error(s)\n" + errStr);
            }
        }
Exemple #33
0
        public void InitializeU2722A(string ConnectString)
        {
            bool devReady = false;
            string idnTemp;

            ioVoltCntrl = new FormattedIO488Class();   // Create the formatted I/O object

            devReady = U2722A_Connect(ConnectString);
            if (devReady == false)
            {
                throw new Exception("Connect to U2722A failed on " + ConnectString);
            }
            else
            {
                ioVoltCntrl.WriteString("*RST", true);              // Reset
                ioVoltCntrl.WriteString("*CLS", true);              // Clear
                ioVoltCntrl.WriteString("*IDN?", true);             // Read ID string
                idnTemp = ioVoltCntrl.ReadString();                 

                OnAgilentMessage(new AgilentMessageEventArgs("Connect to U2722A suceess! U2722A IDN: " + idnTemp.ToString()));

                //VICD - Set line frequency to 50Hz (This effects measurement accuracy)
                //VICD - Future Dev - Low - Check U2722 for errors at initialization
                //VICD - Future Dev - Med - Add VOLT:LIM command to set a maximum output voltage
                ioVoltCntrl.WriteString("SYST:LFREQ F50HZ", true);
                // Set the inital voltage range to 20V
                ioVoltCntrl.WriteString("VOLT:RANG R20V, (@1)", true);
                ioVoltCntrl.WriteString("VOLT:RANG R20V, (@2)", true);
                ioVoltCntrl.WriteString("VOLT:RANG R20V, (@3)", true);
                // Set the initial output voltage to 0.0V
                ioVoltCntrl.WriteString("VOLT 0, (@1)", true);
                ioVoltCntrl.WriteString("VOLT 0, (@2)", true);
                ioVoltCntrl.WriteString("VOLT 0, (@3)", true);
                // VICD - Set the current ranges
                ioVoltCntrl.WriteString("CURR:RANG " + CURRENT_RANGE_CH1 + " , (@1)", true);
                ioVoltCntrl.WriteString("CURR:RANG " + CURRENT_RANGE_CH2 + " , (@2)", true);
                ioVoltCntrl.WriteString("CURR:RANG " + CURRENT_RANGE_CH3 + " , (@3)", true);
                // VICD - Set the current limits
                ioVoltCntrl.WriteString("CURR:LIM " + CURRENT_LIMIT_CH1 + " , (@1)", true);
                ioVoltCntrl.WriteString("CURR:LIM " + CURRENT_LIMIT_CH2 + " , (@2)", true);
                ioVoltCntrl.WriteString("CURR:LIM " + CURRENT_LIMIT_CH3 + " , (@3)", true);
            }
        }
Exemple #34
0
        public void InitializeU2651A(string ConnectString)
        {
            bool devReady = false;
            string idnTemp;

            ioSwitchCntrl = new FormattedIO488Class();    // Create the formatted I/O object

            devReady = U2651A_Connect(ConnectString);
            if (devReady == false)
            {
                throw new Exception("Connect to U2651A failed on " + ConnectString);
            }
            else
            {
                ioSwitchCntrl.WriteString("*RST", true);            // Reset
                ioSwitchCntrl.WriteString("*CLS", true);            // Clear
                ioSwitchCntrl.WriteString("*IDN?", true);           // Read ID string
                idnTemp = ioSwitchCntrl.ReadString();               

                OnAgilentMessage(new AgilentMessageEventArgs("Connect to U2651A suceess! U2651A IDN: " + idnTemp.ToString()));
            }
        }