I want to access Agilent Device N3301A using python. In purpose to connect to GPIB port I am using a GPIB to USB adapter from National Instruments. I have installed PyVisa, Agilent Connection Expert as well.
The code which I used in python is
import sys
# create visa object
import visa
dcel = visa.instrument('GPIB::17::INSTR')
print dcel.ask('*idn?')
This code does not works. Please, explain?
Another useful tool is the Agilent Connection Expert. This will show you whether you have GPIB connections or not. Your code will not work if you are not connected by the connection you are specifying. This software will tell you the address and whether it is under GPIB0, GPIB1... etc. I have used in the past:
import visa
from subprocess import Popen, PIPE
rm = visa.ResourceManager()
siggen = rm.get_instrument("GPIB1::19")
siggen.write("OUTP:STAT ON")
then you can write any SCPI command that works with your device. There's manuals on each one. I don't know what your device is, so I haven't tried yours, but it works on my signal generator. I hope this helps!