08-16-2025 02:03 AM
I am trying to control my Impedance Analyser Keysight E4990A using LabVIEW and I think, I have built the logic completely. But on running the program after connecting to the instrument, it sweeps over a set of frequencies that i have given using a .csv file, and the output file contains only a set of zeroes over all the frequencies. I am trying to compute absoulute impedance and phase. I have also added a delay using flat sequence structure between executing and reading.
nly.
08-16-2025 02:08 AM
I have attached the VI for controlling the E4990A. I am also attaching the kind of output it is throwing always... please help me in getting the correct readings.
08-17-2025 01:29 PM
Hello, Prateek.
I have a number of suggestions for your problem with data acquisition from this VISA instrument.
The first thing to suggest is to connect your Instrument to your computer and run MAX, NI's Measurement and Automation Explorer. Identify the Interface connected to your VISA device and select it. You should be able to open a Test Panel on the right-hand Pane where you can set the VISA parameters (such as Baud Rate). Your manual for the Keysight device will tell you most of the settings you need. If it is like many such VISA peripherals I've used, you send a bunch of Commands, and use a "termination character (typically Line Feed (hex 0A) when you hit the "Enter" key, so you need to specify (when you set up VISA) to use a Termination Character.
Look at the Commands in your manual. There is probably one that asks the VISA device to "identify" itself. Go ahead and send it, then do a Buffer Read, which should get you a return String that says something like "Keysight E4990". Note that a single Read, because you are using a Termination character, will read (within reason!) as many characters as your device sends until it finishes the message by sending the <LF>.
If this works, go ahead and try to get it to send you, say, 10 readings of "whatever" (you may need to give it multiple commands to set it up and then say "Go"). Do another Buffer Read -- you should get either the first of 10 (in which case you need to do 9 more Reads) or all 10 with (or without!) some "separating character". You'll at least be able to verify that you can "talk to" your device and get data back from it.
Now all you have to do is write LabVIEW code to do the same thing you just did "manually".
So here's the next piece, about your LabVIEW code.
Bob Schor
08-18-2025 12:20 AM - edited 08-18-2025 12:33 AM
Hello! Thank you for getting back to me. I have already tried using the test panel and sending manual commands. In that case, the readings were correctly measured. After that, I removed the instrument drivers wherever I used them and replaced them with VISA. Then I assigned the terminal character property as per your instructions. You can have a look, still I am getting the same zero readings. Please, suggest something.
08-18-2025 10:44 AM
Hello, Prateek.
Thank you for including your code. The first three functions in your VI, which might be something related to an Instrument Driver, are not recognized by my system, and are clearly not the generic VISA Drivers.
On the Block Diagram, open Instrument I/O. From there, open VISA, then Bus Specific, then Serial, then Configure Port. This is where you set the VISA Parameters (as you did in the Test Panel in MAX.
Note that the path through the Block Diagram is for my installation of LabVIEW 2021. The menus might be slightly different in LabVIEW 2017.
Please remove the Frame Sequence structure inside the For Loop. Please straighten out the Error Line and (as much as possible) the other "horizontal" wires. Please get rid of so much blank space between functions -- everything should (ideally) fit on a single laptop screen. What are the two "0" characters that I cannot delete at the upper left of the Event Loop? They seem to be related to (unwired?) constants on the Block Diagram.
Aha! I found your error. I decided to "clean up" your Block Diagram. Look inside the For Loop with all the VISA commands, and look at the first two functions in that Loop, a Format into String and a VISA Write. Which one comes first? [The answer is you don't know, but probably the VISA Write, with an empty string as its input]. Why is this? Where did you not use the Error Line? What if you properly did use the Error Line?
There are some cases when you don't need to use the Error Line, but failing to use it can (and did) cause your code to fail. I'm attaching an Image of my cleaned-up version of your code. The blocks marked with ? are where you need to put the VISA routines that you've demonstrated seem to work, and you should be able to find (by comparing this with your code) where the Error Line was missing (and probably caused your routine to fail). I turned off the "Icon" mode for most Front Panel Controls (helps unclutter Block Diagram), and other comments include some (possibly wrong) assumptions on my part.
Bob Schor