11-11-2019 08:14 AM
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
Solved! Go to Solution.
11-11-2019
10:24 AM
- last edited on
12-18-2024
10:34 AM
by
Content Cleaner
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..
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
11-12-2019 08:45 AM
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:
*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!
11-12-2019
11:04 AM
- last edited on
12-18-2024
10:35 AM
by
Content Cleaner
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:
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/gpib-clear.html
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!
11-12-2019 01:52 PM - edited 11-12-2019 02:38 PM
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