Visa Com Example In Python - Agilent Technologies Infiniium 90000 Series Programmer's Manual

Oscilloscopes
Hide thumbs Also See for Infiniium 90000 Series:
Table of Contents

Advertisement

VISA COM Example in Python

You can use the Python programming language with the "comtypes"
package to control Agilent oscilloscopes.
The Python language and "comtypes" package can be downloaded from the
web at
"http://starship.python.net/crew/theller/comtypes/", respectively.
To run this example with Python and "comtypes":
1
2
3
#
# Agilent VISA COM Example in Python using "comtypes"
# *********************************************************
# This program illustrates a few commonly used programming
# features of your Agilent Infiniium Series oscilloscope.
# *********************************************************
# Import Python modules.
# ---------------------------------------------------------
import string
import time
import sys
import array
from comtypes.client import GetModule
from comtypes.client import CreateObject
# Run GetModule once to generate comtypes.gen.VisaComLib.
if not hasattr(sys, "frozen"):
GetModule("C:\Program Files (x86)\IVI Foundation\VISA\VisaCom\
GlobMgr.dll")
import comtypes.gen.VisaComLib as VisaComLib
# Global variables (booleans: 0 = False, 1 = True).
# ---------------------------------------------------------
# =========================================================
# Initialize:
# =========================================================
def initialize():
# Get and display the device's *IDN? string.
idn_string = do_query_string("*IDN?")
print "Identification string '%s'" % idn_string
Agilent Infiniium 90000 Series Oscilloscopes Programmer's Reference
"http://www.python.org/"
Cut- and- paste the code that follows into a file named "example.py".
Edit the program to use the VISA address of your oscilloscope.
If "python.exe" can be found via your PATH environment variable, open
a Command Prompt window; then, change to the folder that contains
the "example.py" file, and enter:
python example.py
and
38
Sample Programs
1051

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents