From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Agilent 34401A remote MIN-MAX function troubles

Solved!
Go to solution

This would probably be better suited over on the Keysight forums, but I thout I would post it here too.

 

We have been using Agilent 34401A meters in our lab for years, mainly because we can silence the beep during Math/MIN-MAX readings. Recently we have needed to push towards more automated testing, so I dusted off my labview skills.

 

I wrote a test VI in Labview 2014 Ver 14.0. I can send commands and read measurements. But I have run into trouble when it came time to implement the Math function. Ideally I would like the remote commands be similar to our front panel operation: enable math, run tests for an indeterminate time, then read the min/max values after test is finished.

My VI sends the following commands:

*RST

*CLS

CALC:FUNC AVER

TRIG:SOURCE IMM

SAMP:COUN 500

CALC:STAT ON

INIT

 

Then my test VI waits for 10 seconds and sends the following commands

CALC:AVERAGE:MIN?

CALC:AVERAGE:MAX?

 

But the last two commands timeout. As far as I can tell, the meter is busy filling the 500 samples and will not respond to and commands. After 2 minutes for so, the meter finishes its readings and then throws Error - 410, "Query INTERUPTED". If I change the sample number the meter finishes is reading before the 10 second delay and will most likely miss important samples during actual lab tests. If I change the test VI delay to 2 minutes, the last two commands do not timeout and give correct min/max readings, but why wait 2 minutes if the actual test might only last 10 seconds.

 

Has anybody implemented the MIN-MAX function on the 34401A? I need the math function to run indefinitely and interrupt it once my tests are complete.

 

Thank you for any help,

~Pard

 

0 Kudos
Message 1 of 5
(4,251 Views)

Hi Pard,

 

Its really hard to give advice without seeing your code.  Just seeing the SCPI commands, and not how/when they are sent or how you handle the timing makes it hard to guess at the solution.  So, advice rather than a quick fix.

 

Ideally you wouldn't use a fixed wait time in your code, you would use the instruments status register model and service requests to inform you that the instrument has finished gathering data and is now ready to transfer it to you. Have a read at how to do this here..

http://www.ni.com/product-documentation/2927/en/

 

It might seem daunting at first, but once you get used to using SRQs you save yourself lots of wasted time and gain control over the instruments.  

 

The other approach for this particular instrument is to look at the LabVIEW driver.  There are driver VIs that comes pre-installed in LabVIEW for the Agilent/Keysight 34401a.  It has an example that does exactly what you want; setup a measurement, enable MATH, measure N samples, wait until finished, read measurement data and MATH values.  Use the LabVIEW menu item "Help/Find Examples.." then search for Agilent and you get a list of examples for the 34401a. 

 

If the driver isn't pre-installed in LabVIEW 2014 then you can download it here.. http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=014E7F05D12C6F8BE0440003BA7CCD... )

 

Have a look at "<LabVIEW di>\instr.lib\Agilent 34401\Examples\Agilent 34401 Read Math Measurement.vi"

 

If you want to debug or improve existing code, then post it here.

Craig

 

 

0 Kudos
Message 2 of 5
(4,221 Views)

Thank you for your response Craig. It has been helpful but I am still stuck.


This is a long post so I will so here is the summery 1) Not sure I am using SQRs correctly, additionally SQR won’t work because I want to interrupt the meter not wait for it finish readings 2) Some documentation says I can interrupt meter with a device clear message 3) The NI device driver sets a set sample size and a delay of 10 seconds and breaks if I increase sample size 4) I need to send a “device clear” message over GPIB but have been unsuccessful.

 

Now for the detailed post:

  1. The fixed 10 second time delay is just something I use to imitate my systems test completion and interrupt the meter's average measurements. My actual lab test run for unknown amounts of time (a few seconds to a few hours). Once I get the meter working, I will implement the working snippet into my full program loop.
  2. Seems the Keysight forums are having issues with their login, so NI is my main resource at the moment,.
  3. I am doing my development on an offline machine. We are not allowed USB drives to transfer to our online machines. So screenshots are going to be hard to come by. For timing, I send each command one at a time with a 100ms delay. If the command has a "?" character then I also perform a port read after another 100mS delay. I have not had issues reading/writing commands. With all the delays, I can do a continuous read loop of ~2.5samples/second.
  4. I did download the driver for the 34401A and was surprised to find a hardcoded sample size of 10 and a 10 second times. After 10 seconds the VI reports min/max. If I change the samples size, the VI times out, sounds familiar.
  5. I spent yesterday playing around with implementing SQRs. I am not sure I am doing it correctly. I use the INIT command to start my measurements. This does not place anything on the output buffer. I tried reading the Standard Event register and the Status register before, during, and after the meter is taking measurements. I have the same issue as before. I can read the registers before and after the meter is sampling, but during the sampling I get a timeout then the meters faults once it is finished. I am not sure this is the route I want to take because I don't want to wait for the meter to finish taking readings if my system has completed its test (i.e. my test took 10 seconds, but the meter needs to finish another 400 samples).
  6. I changed my initialization commands a little:

*RST

*CLS

CALC:FUNC AVER

SAMP:COUN 1

TRIG:SOUR IMM

TRIG:COUN INF

DATA:FEED RDG_STORE, ""

CAL:STAT ON

INIT

So setting TRIG:COUN INF makes the meter continuously sample (much better than having a sample count of 500 for a many hour test). Setting DATA:FEED RDG_STORE, "" makes it so readings taken using the INIT are not stored.

 

One page 131 of the 34401A manual it says "The IINFinite parameter instructs the multimeter to continuously accept triggers (you must send a device clear to return to the "idle" state)." On page 160 it talks about Using Device Clear to Halt Measurements... send a <Ctrl+C> over RS232 and a device clear over IEEE-488 (I think it is the DCL). On page 76, it says "The following statement shows how to send a device clear over the GPIB interface using BASIC. CLEAR 722 IEEE-488 Device Clear". But none of these commands are listed in the command summery starting on page 105.

 

This is the desired operation. Set the meter to run continuously, stop it once my system is ready, then read the min-max values. I have been unsuccessful in sending a device clear message. I have tried:

*RST

*CLS

CLEAR 722

DCL

*DCL

*OPC

*OPC?

0x03 (the EOT or <Ctrl+C> ascii character)

All commands timeout and then fault with either "Query INTERUPTED" or "Undefined HEAD".

 

 

Thanks again!

0 Kudos
Message 3 of 5
(4,170 Views)
Solution
Accepted by topic author Pardner

Well, serves me right. Spend hours writing up a message for a support forum when I should have spent more time reading about GPIB.

 

The device clear isn't a message; it's a bus function. Labview has a function block for it:

http://zone.ni.com/reference/en-XX/help/371361R-01/lvinstio/gpib_clear/

 

Now my meter can sit there for hours sampling away, calculating the running min/max/average, throwing away samples, and then I use the device clear function and the meter stops. Send a query for the min/max and I get good data back!

 

Thank you for bearing with me!

0 Kudos
Message 4 of 5
(4,155 Views)

Not a waste, you've document the process for the next person.  Also, I find the act of writing up a long question forces one to organize their thoughts and consider a few more things.  The act of describing the problem to someone else is often the solution. Nice work!

 

Also, you can use the VISA Clear instead of the GPIB CLR you linked to.  They do the same thing, but the VISA clear allows you to do over any bus (GPIB, LAN, USB, serial, etc..)

 

Craig

0 Kudos
Message 5 of 5
(4,140 Views)