What is PyVISA?
VISA (Virtual Instrument Software Architecture) is a universal driver for controlling measuring instruments over various interfaces such as USB, GPIB, Ethernet, and others. It allows you to control instruments using SCPI (Standard Commands for Programmable Instruments) commands. For example, the command "MEASUREMENT:FREQUENCY?"
retrieves the signal frequency on an oscilloscope.
PyVISA is a Python wrapper for the VISA driver, enabling you to control instruments using Python. Here's an example of how to use PyVISA:
import pyvisa # The resource manager gives you access to all connected instruments rm = pyvisa.ResourceManager() # Open a connection to the oscilloscope oscilloscope = rm.open_resource('INTERFACE::VID::PID::SN::INSTR') # Instrument's VISA address # Set time scale to 1 ms/div oscilloscope.write('HORIZONTAL:SCALE 0.001') # Set vertical scale for Channel 1 to 1 V/div oscilloscope.write('CH1:SCALE 1.0')
This is an unofficial documentation that focuses on practical use. For the official version, visit here. It should be a smooth journey if you follow these pages in order.