AnsweredAssumed Answered

Oscilloscope GPIB

Question asked by irems3 on Jul 8, 2013
Latest reply on Jul 15, 2013 by irems3
The laboratory recently purchased two new oscilloscopes of a differing brand but I would prefer very much to use the $6,000 model from Agilent already in the laboratory. I like their products and want to outfit my own laboratory with one of their future makes. But I do not understand the differences in API content and when to use the necessary commands.

I would like to make a simple program in python to communicate with the HP54542A across national instruments GPIB-USB-HS connector using ni488.2 protocals. Agilent, National Instruments and Python are my favorite tools. I am very new in this area (scope communication) and could find nothing on the level of simplicity which I desired to implement for my Agilent scope. I think the API for the infiniium models is close/the same as for the HP54542A.

I went to pyVISA and ran a modified version of the starting program for their tektronics example. It worked perfectly...

import visa
from visa import instrument
my_instrument = instrument("GPIB0::7::INSTR")

Returning this in the command window:::::::::::::

I tried the next tektronics example for data acquisition and tried to modify the API for my Agilent scope...That is really where I am struggling. I do not understand the "commands" in the API for Agilent equipment. The order of commands required to  sequentially export acquired data, I need to better understand....

I do not know if my meager understanding will help but here is the tek script and here is the agilent script which I slightly modified using the API for the HP54542A.

from visa import instrument

keithley = instrument("GPIB::12")
keithley.write("*rst; status:preset; *cls")
interval_in_ms = 500
number_of_readings = 10

keithley.write("status:measurement:enable 512; *sre 1")
keithley.write("sample:count %d" % number_of_readings)
keithley.write("trigger:source bus")
keithley.write("trigger:delay %f" % (interval_in_ms / 1000.0))

keithley.write("trace:points %d" % number_of_readings)
keithley.write("trace:feed sense1; feed:control next")
voltages = keithley.ask_for_values("trace:data?")
print "Average voltage: ", sum(voltages) / len(voltages)
keithley.write("trace:clear; feed:control next")

from visa import instrument

HP = instrument("GPIB::7")
HP.write("*rst; status:preset; *cls")
interval_in_ms = 500
number_of_readings = 10

HP.write("status:measurement:enable 512; *sre 1")
HP.write("acquire:count %d" % number_of_readings)
HP.write("trigger:source bus")
HP.write("trigger:delay %f" % (interval_in_ms / 1000.0))
HP.write("acquire:points %d" % number_of_readings)

HP.write("trace:feed sense1; feed:control next")

voltages = HP.ask_for_values("trace:data?")
print "Average voltage: ", sum(voltages) / len(voltages)
HP.write("trace:clear; feed:control next")

So I noticed that the sample count and sample points were replaced (between Keithely 2000 DMM from TEK to HP54542A) by acquire count and acquire points. There was no trace:feed or feed:control or trace:data? commands in the API? There seemed to be some WAV:POIN command and WAV:DATA...I thought that trace is SCPI and common for most instruments? 

Mostly, the problem is I do not know what sequence of commands to use and why? I will try just about anything. I do not think agilent still supports HP equipment do they? If there were a generic python module to log data that were posted in pyVISA I know hundreds of people who would choose to use it...

Thank you for the help, I really appreciate it...