Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Linear Voltage Ramp for Agilent U2722A

Go to solution

I am currently in the process of writing a LABVIEW VI in order to interface with an Agilent U2722A. I want to measure current continually while increasing voltage from 0V to a use defined maximum specifiying the step size and time step (a linear voltage sweep).


I have downloaded the applicable driver for this device which also inculdes an example used to output a voltage and then take measurments. My first problem is that when I run this VI the device times out. I think this problem MAY have something to do with the "triggered level" input. Which is being passed to the Configure Voltage Channel VI. I have included both the example and the Configure Voltage Channel Sub VI.


My lack of understanding for the other SubVIs (which are based off of SCPI commands being passed through VISA as strings) is also preventing me from making any progress. Particularly the configure sweep and configure trigger VIs.


Confgiure sweep takes in values for the number of points and the timestep. I am not sure how I am supposed to make use of this VI. Should I set this to the desired values and then use a loop to pass different values to the configure voltage channel with each iteration. Also, how is the timestep being measured? Do I need to configure a trigger to measure time between points or does the sweep function take care of that? I have included both the configure sweep VI and the Timestep VI as well.



0 Kudos
Message 1 of 14
Maximum of three attachements. Here is the last one.
0 Kudos
Message 2 of 14

Hello noob,

        Please make sure that you have Context Help enabled in the LabVIEW development environment (Ctrl + h), and then hover over the controls and VIs to get more information about them.  In most cases, the example should be able to run sucessfully with the default values, so please tell me more about the timeout issue that you are seeing.  Also, please take an NI-Spy capture of the timeout occuring and post the .spy file.

         If the context help information for the VIs and controls is not enough, please see if the instrument's manual has the information.  Let us know what you find out and if you have anymore questions.





0 Kudos
Message 3 of 14

I have already tried using context help and this provides very little details. If you open up these sub VI's you can see the SCPI command being written to the device. I have already consulted the agilent programmers reference guide included with the device and this did not provide much insight either.


When I try and open the NI-spy I get an error message that it is unable to located the DLL for my API and reccomends that I reinstall national instruments software for this API.


It seems that my problem in running the example VI occurs in the initialize VI when making use of the Clear VISA command. The error message is:

Error -1073807360 occurred at VISA Clear in Agilent>Agilent U2722 - DC Power Output DC Possible reason(s):

VISA:  (Hex 0xBFFF0000) Unknown system error (miscellaneous error). 

0 Kudos
Message 4 of 14

Hello noob,


It seems that an IO error occured at a very early point in the initialize VI. Could you confirm whether the "VISA Open" VI returned successfully? You can do that by running the VI in debug mode and place a probe on its error out terminal.



0 Kudos
Message 5 of 14

Hello noob,

      NI-Spy can be very useful.  I recommend that you download and install the November Device Driver DVD which will upgrade you to the current version of NI-VISA, NI-MAX, and NI-Spy.  Hopefully that will fix the NI-Spy issue.





0 Kudos
Message 6 of 14

I started the download for NI-SPY update, but that will take a while to dowload.


How do you run a VI in debug mode? I did a search in help and couldnt find any clear reference. When you say probe do you mean the error handler VI?




I have managed to get almost all aspects of this software working. Everything works fine the first time I run. The second time I will get an error message and have to turn of the device close the VI and then re-enable both and it will work fine. (I would still like to fix this problem)

0 Kudos
Message 7 of 14
Hello noob, You could enable "Start Single Stepping" in the toolbar to run the VI in single steps, thereby observing where the original error was generated. You could also place a probe, before running, on any wire by right clicking on it and select "Probe". Glad to know your finally made it work! However, what error did you get when running it the second time? -Clark
0 Kudos
Message 8 of 14

The first time I run the software it works how I want it to. If I try and run it a second time I get the following message:


Error -1074000000 occurred at Agilent U2722.lvlib:Error
Possible Reasons: Instrument reports:-420,"Query UNTERMINATED"+0,"No error"
Complete call chain: Agilent U2722.lvlib:Error, Agilent, Agilent


It will alternate between working fine and giving me this error message. If I disconect the power to the device and reconnect
between sweeps it will also work fine.




Also, I am having some doubts as to the timing of my measurments. Currently, I have a while loop generating all of the required points in my voltage sweep. Inside this loop I pass those voltages as they are generated to my set Voltage sub VI which links to my measure voltage and current sub VI. Inside the while loop is a wait timer set to wait 100ms between iterations. Is there a more accurate method of doing this?

0 Kudos
Message 9 of 14
Accepted by noob@labview

Looks like that you got another error related with instrument IO. Here is some reference for this error,  

-420, "Query UNTERMINATED" --------------------------

This error occurs when you addess the instrument to talk and it has nothing to say.


The most likely causes are:

1. Not sending a query. You must send a valid query to the instrument before addressing it to talk. This is true even of measuring instruments, such as the Model 2001. You cannot get a reading from the 2001 until you send it a query.

2. Sending an invalid query. If you have sent a query and still get this error, make sure that the instrument is processing the query without error. For example, sending an ill-formed query which generates an error -113, "Undefined header" and then addressing the instrument to talk will generate an error -420, "Query UNTERMINATED" as well.

3. Valid query following an invalid command.


Currently I dont have an instrumetn in hand so I can't figure out what exactly what the problem is, but would you mind pasting your code so we can look into it together?


The most accurate method is absolutely the one provided by hardware itself. Here it is "Interval" in Configure


Message 10 of 14