element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Test & Tools
  • Technologies
  • More
Test & Tools
Forum Impedance Analysis with the Keysight E5061B Network Analyzer with Labview or Command Expert
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Test & Tools to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 4 replies
  • Subscribers 352 subscribers
  • Views 1734 views
  • Users 0 members are here
  • e5061b
  • agilent
Related

Impedance Analysis with the Keysight E5061B Network Analyzer with Labview or Command Expert

Former Member
Former Member over 9 years ago

Dear sir,

 

Hope your are doing good,

 

I need some guidance on measuring impedance in the instrument using a software.

i have already requested agilent team but they sent VBA file i dont no how to use .VBA  files

Can you share some commands which can be sent from labview or hyperterminal so that i can plot data in labview

 

Thanking you,

 

Best Regards,

Venugopal

  • Sign in to reply
  • Cancel
  • michaelkellett
    0 michaelkellett over 9 years ago

    If you have an older version of Microsoft Excel you may be able to open the.vba file.

    Ask Agilent ( and remember to cal them Keysight until it changes next image) again - I'm sure thye can do better than this.

    Have you read the programming manual ?

     

    I think the reason that you find it hard to get Labview examples is that the entirely graphical nature of Labview makes it hard (impossible) to print listings in documentation. This is a reason (that you should consider carefully) for never using Labview but I understand that you might have no choice - in which case you have my sympathy.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago

    First question is do you have the drivers for Labview for your instrument !!

     

    Second, Keysight, Keithley and most other major vendors seem to be extreamly behind the times when it comes to the programming of their instruments, I too have found most examples to be in VB or where C# was involved it is still over 10 years old.

     

    I have been currently writing a program to talk to many of my instruments using Visual Studio Community addition and if you use the SCPI commands over a simple TCP/IP connection or Serial / USB then it is very easy to implements once you know the right SCPI commnads

     

    Now up unitll litterally 2 days ago I would have agreed with Michael on Labview but I was at a free 1 day presetation of it and actually was pretty impressed, even more so when I saw that you can get the full blown version for 50$ as a home addition and this is not a crippled version either, it has the restriction of NOT FOR COMMERCIAL USE but thats about it see here:-

    https://digilentinc.com/Products/Detail.cfm?NavPath=2,66,1457&Prod=LABVIEW-HE

    https://www.labviewmakerhub.com/

     

    Now 50$ for a massive kickstart into test and measurement is far better than weeks of dev work for very little moving forward of a home brew custom app.

     

    I loaded up the 45day free version to test out and it saw every network, USB, GPIB and even my Arduino as an instrument waiting to be controlled, and there is a special Arduino Sketch (Well HEX File actually) to make it an extension of the main environment... cool, it even found my 30year old HP meter and allowed it to be remote controlled too.

     

    A few weeks ago I would have said, nope, dont touch it unless your a student or work buys it for you but for 50$ im in like flyn. it is going to save me soo much time and I can still code in whatever language I want for those extras too.

     

    Bench Vue and the like are great but limited to their own brand and dont do any of the advanced features, this does it all and more, do I sound like im sold... you betcha

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to Robert Peter Oakes

    Thanks for the Quick Response,

     

    This instrument has device drivers for labview and also we can measure s- parameters in labview  whereas coming to z-parameters they didn't provided any vi's, I asked them about that they said it is not yet created and sent me a z-parameter .VBA file i don't know how to use it and correct scpi commands.

     

    Here i am attaching a link of scpi can you guide which are exact scpi commands can be sent through labview

    http://ena.support.keysight.com/e5061b/manuals/webhelp/eng/programming/command_reference/command_finder/command_finder_(meas)_scpi.htm

    one more thing i tried some basic commands for ex:*IDN,*RST then instr responded

     

                                                                                                                                   Thanking you,

    Best Regards,

    VenuGopal

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 9 years ago in reply to Former Member

    This is a sample of the C# code I am using to talk to a Keysight 34470DMM to give you an idea of how to use SCPI in C#, I have not tried doing this in LabView yet so cant help with that at the moment

     

    This may also help

    https://www.youtube.com/watch?v=uOvXHwkpfV8

    A video from Keysight showing how to talk to devices using SCPI and labview

     

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Threading;
    using System.Windows.Forms;
    using Ivi.Visa.Interop;
    using System.Windows.Forms.DataVisualization.Charting;
    
    
    namespace Keysight_34470A_Battery_Testing
    {
        public partial class Form1 : Form
        {
    
    
            ResourceManager rm = new ResourceManager(); //Open up a new resource manager
            FormattedIO488 myDmm = new FormattedIO488(); //Open a new Formatted IO 488 session
            string[] resource;
            char[] serperator = { ',', ';' };
            double RSense = 0.201; // actual value of resistor used to sense the current
    
    
            public Form1()
            {
                InitializeComponent();
                InitializeChart();
                InitializeBackgoundWorker();
    
    
            }
    
    
            // Set up the BackgroundWorker object by
            // attaching event handlers.
            private void InitializeBackgoundWorker()
            {
                backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
                backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
                backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            }
    
    
            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"));
                    StatusMessages.AppendText("Exception: Encountered system error(s)\n" + errStr);
                }
    
    
            }
    
    
            public int GetSamples(int count, int delay, string command, BackgroundWorker worker, DoWorkEventArgs e)
            {
                delay = delay * 1000; // set to mSeconds
                int x = 0;
                if (worker.CancellationPending)
                {
                    e.Cancel = true;
                }
                else
                {
                    string sample = string.Empty;
                    if (count == 0)
                    {
                        while (0==0  && worker.CancellationPending == false)
                        {
                            sample = DoCommandAndRead(command);
                            worker.ReportProgress(x, sample);
                            x++;
                            if (worker.CancellationPending == true) break;
                            Thread.Sleep(delay);
                        }
                    }
                    else
                    {
                        for ( x = 0; x < count; x++)
                        {
                            sample = DoCommandAndRead(command);
                            worker.ReportProgress(x, sample);
                            x++;
                            Thread.Sleep(delay);
                        }
                    }
                }
                return x;
            }
    
    
            public void RenderSample(int count, string DCVResultRatio)
            {
                CurrentCount.Text = (++count).ToString();
                StatusMessages.Text = "DCV Ratio Reading = " + DCVResultRatio; //report the DCV reading
                CheckDMMError(myDmm); //Check if the DMM has any errors
    
    
                string[] samples = DCVResultRatio.Split(serperator);
                //Add data points to the series
    
    
                double dataPointVolts = 0;
                double.TryParse(samples[2], out dataPointVolts);
                DataPoint objDataPointVolts = new DataPoint()
                { AxisLabel = "Volts", YValues = new double[] { dataPointVolts } };
                BatteryState.Series["Volts"].Points.Add(dataPointVolts);
    
    
                double dataPointAmps = 0;
                double.TryParse(samples[1], out dataPointAmps);
                dataPointAmps = dataPointAmps / RSense;
                DataPoint objDataPointAmps = new DataPoint()
                { AxisLabel = "Amps", YValues = new double[] { dataPointAmps } };
                BatteryState.Series["Amps"].Points.Add(dataPointAmps);
    
    
                // now calculate the power
                double dataPointPower = 0;
                dataPointPower = dataPointAmps * dataPointVolts;
                DataPoint objDataPointPower = new DataPoint()
                { AxisLabel = "Power", YValues = new double[] { dataPointPower } };
                BatteryState.Series["Power"].Points.Add(dataPointPower);
                return;
            }
    
    
            public string DoCommandAndRead(string command)
            {
                myDmm.WriteString(command, true);
                return myDmm.ReadString();
            }
    
    
            public void InitializeChart()
            {
                BatteryState.Legends.Add(new Legend() { Name = "Legend" });
                BatteryState.Legends[0].Docking = Docking.Bottom;
                BatteryState.ChartAreas[0].Name = "ChartArea";
                //Remove X-axis grid lines
                BatteryState.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
                //Remove Y-axis grid lines
                BatteryState.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
                //Chart Area Back Color
                BatteryState.ChartAreas[0].BackColor = Color.FromName("lightblue");
                BatteryState.Palette = ChartColorPalette.BrightPastel;
                BatteryState.ChartAreas[0].AxisY.Maximum = 10; // Max scale
    
    
                string series = string.Empty;
                BatteryState.Series.RemoveAt(0);
                series = "Volts";
                BatteryState.Series.Add(series);
                BatteryState.Series[series].ChartType = SeriesChartType.Line;
                series = "Amps";
                BatteryState.Series.Add(series);
                BatteryState.Series[series].ChartType = SeriesChartType.Line;
                series = "Power";
                BatteryState.Series.Add(series);
                BatteryState.Series[series].ChartType = SeriesChartType.Line;
    
    
                BatteryState.Series[0].YAxisType = AxisType.Primary;
                BatteryState.Series[1].YAxisType = AxisType.Secondary;
                BatteryState.ChartAreas[0].AxisY2.LineColor = Color.Transparent;
                BatteryState.ChartAreas[0].AxisY2.MajorGrid.Enabled = false;
                BatteryState.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True;
                BatteryState.ChartAreas[0].AxisY2.IsStartedFromZero = BatteryState.ChartAreas[0].AxisY.IsStartedFromZero;
            }
            private void startAsyncButton_Click(object sender, EventArgs e)
            {
                // Reset the text in the result label.
                StatusMessages.Text = string.Empty;
    
    
                // Disable the UpDown control until
                // the asynchronous operation is done.
                sampleCount.Enabled = false;
    
    
                // Disable the Start button until
                // the asynchronous operation is done.
                startAsyncButton.Enabled = false;
    
    
                // Enable the Cancel button while
                // the asynchronous operation runs.
                CancelAsyncButton.Enabled = true;
                resource = rm.FindRsrc("?*INSTR");
    
    
                string DutAddr = "TCPIP0::K-000000-00000.oakesclanhome::inst0::INSTR";
                myDmm.IO = (IMessage)rm.Open(DutAddr, AccessMode.NO_LOCK, 2000, ""); //Open up a handle to the DMM with a 2 second timeout
                myDmm.IO.Timeout = 6000; //You can also set your timeout by doing this command, sets to 3 seconds
    
    
                //First start off with a reset state
                myDmm.IO.Clear(); //Send a device clear first to stop any measurements in process
                myDmm.WriteString("*RST", true); //Reset the device
                myDmm.WriteString("*IDN?", true); //Get the IDN string               
                string IDN = myDmm.ReadString();
                SelectedDevice.Text = IDN; //report the DMM's identity
    
    
                //Configure for DCV AUTO range, Ratio Measurement and Auto resolution
                myDmm.WriteString("CONF:VOLT:DC:RAT AUTO", true);
                myDmm.WriteString("VOLT:RAT:SEC \"SENS:DATA\"", true);
    
    
                // Start the asynchronous operation.
                backgroundWorker1.RunWorkerAsync(new asyncParams((int)sampleCount.Value, (int)delay.Value, "READ?;DATA2?"));
    
    
            }
           
            // This event handler is where the actual,
            // potentially time-consuming work is done.
            private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
            {
                // Get the BackgroundWorker that raised this event.
                BackgroundWorker worker = sender as BackgroundWorker;
                asyncParams myArgs = e.Argument as asyncParams;
                // Assign the result of the computation
                // to the Result property of the DoWorkEventArgs
                // object. This is will be available to the
                // RunWorkerCompleted eventhandler.
                e.Result = GetSamples(myArgs.count, myArgs.delay, myArgs.command, worker, e);
            }
            // This event handler updates the progress bar.
            private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
            {
                RenderSample(e.ProgressPercentage, e.UserState as String);
            }
            // This event handler deals with the results of the
            // background operation.
            private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
            {
                // First, handle the case where an exception was thrown.
                if (e.Error != null)
                {
                    MessageBox.Show(e.Error.Message);
                }
                else if (e.Cancelled)
                {
                    // Next, handle the case where the user canceled
                    // the operation.
                    // Note that due to a race condition in
                    // the DoWork event handler, the Cancelled
                    // flag may not have been set, even though
                    // CancelAsync was called.
                    StatusMessages.AppendText("Canceled");
                }
                else
                {
                    // Finally, handle the case where the operation
                    // succeeded.
                    StatusMessages.AppendText("Succeeded\n Samples= ");
                    StatusMessages.AppendText(e.Result.ToString());
                }
    
    
                // Enable the UpDown control.
                sampleCount.Enabled = true;
    
    
                // Enable the Start button.
                startAsyncButton.Enabled = true;
    
    
                // Disable the Cancel button.
                CancelAsyncButton.Enabled = false;
            }
            private void CancelAsyncButton_Click(object sender, EventArgs e)
            {
                // Cancel the asynchronous operation.
                backgroundWorker1.CancelAsync();
                // Disable the Cancel button.
                CancelAsyncButton.Enabled = false;
            }
    
    
            private void ScanDevices_Click(object sender, EventArgs e)
            {
                FormattedIO488 myResource = new FormattedIO488(); //Open a new Formatted IO 488 session
                    // Reset the text in the result label.
                    StatusMessages.Text = string.Empty;
                resource = rm.FindRsrc("?*INSTR");
                foreach (string myDevice in resource)
                {
    
    
                    myResource.IO = (IMessage)rm.Open(myDevice, AccessMode.NO_LOCK, 2000, ""); //Open up a handle to the DMM with a 2 second timeout
                    myResource.IO.Timeout = 6000; //You can also set your timeout by doing this command, sets to 3 seconds
    
    
                    //First start off with a reset state
                    myResource.IO.Clear(); //Send a device clear first to stop any measurements in process
                    myResource.WriteString("*IDN?", true); //Get the IDN string               
                    string IDN = myResource.ReadString();
                    StatusMessages.AppendText("Device:" + myDevice + "  IDN=" + IDN + "\n"); //report the DMM's identity
    
    
                }
            }
        }
    
    
        public class asyncParams
        {
            public int count = 0;
            public int delay = 0;
            public string command = string.Empty;
            public asyncParams(int Count, int Delay, string Command)
            {
                count = Count;
                delay = Delay;
                command = Command;
            }
        }
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube