Visa Example In Python (Pyvisa 1.5 And Older) - Keysight P9241 Scpi Programmer's Manual

Hide thumbs Also See for P9241:
Table of Contents

Advertisement

End Namespace

VISA Example in Python (PyVISA 1.5 and older)

You can use the Python programming language with the PyVISA package to
control Keysight Infiniium Series oscilloscopes.
The Python language and PyVISA package can be downloaded from the web at
http://www.python.org/
To run this example with Python and PyVISA:
1
2
3
# *********************************************************
# This program illustrates a few commonly-used programming
# features of your Keysight oscilloscope.
# *********************************************************
# Import modules.
# ---------------------------------------------------------
import visa
import string
import struct
import sys
# Global variables (booleans: 0 = False, 1 = True).
# ---------------------------------------------------------
debug = 0
# =========================================================
# Initialize:
# =========================================================
def initialize():
# Get and display the device's *IDN? string.
Keysight P9241/42/43A Oscilloscopes SCPI Programmer's Guide
End If
End Sub
Public Sub Close()
If m_nSession <> 0 Then
visa32.viClose(m_nSession)
End If
If m_nResourceManager <> 0 Then
visa32.viClose(m_nResourceManager)
End If
End Sub
End Class
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 http://pyvisa.sourceforge.net/, respectively.
38
Programming Examples
1279

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the P9241 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

P9242P9243a

Table of Contents