20 lines
620 B
Python
20 lines
620 B
Python
import pyvisa
|
|
|
|
# Initialize the visa resource manager
|
|
rm = pyvisa.ResourceManager('C:\\Windows\\System32\\visa64.dll')
|
|
|
|
# Replace 'GPIB0::X::INSTR' with ypython -m visa infoour actual GPIB address
|
|
# This address is typically something like 'GPIB0::5::INSTR'
|
|
# You can use rm.list_resources() to find it.
|
|
instrument = rm.open_resource('GPIB0::1::INSTR') # replace with the actual address
|
|
|
|
# Send an identification query to the instrument
|
|
instrument.write('*IDN?')
|
|
response = instrument.read().strip()
|
|
|
|
# Print the response from the instrument
|
|
print("Instrument ID:", response)
|
|
|
|
# Close the connection
|
|
instrument.close()
|