-
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
Instrument details
- Model: HP 54542C
- Communication: GPIB (address 7)
- Link to the documentation (if available): HP 54520C, 22C, 40C, 42C Programmer.pdf
Output of pyvisa-info
/usr/local/lib/python3.7/dist-packages/visa.py:23: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.
The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
FutureWarning,
Machine Details:
Platform ID: Linux-4.19.0-12-686-i586-with-debian-10.6
Processor:
Python:
Implementation: CPython
Executable: /usr/bin/python3
Version: 3.7.3
Compiler: GCC 8.3.0
Bits: 32bit
Build: Jul 25 2020 13:03:44 (#default)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
Binary library: Not found
py:
Version: 0.5.1
ASRL INSTR:
Please install PySerial (>=3.0) to use this resource type.
No module named 'serial'
USB INSTR:
Please install PyUSB to use this resource type.
No module named 'usb'
USB RAW:
Please install PyUSB to use this resource type.
No module named 'usb'
TCPIP INSTR: Available
TCPIP SOCKET: Available
GPIB INSTR: Available via Linux GPIB (b'4.3.3')
GPIB INTFC: Available via Linux GPIB (b'4.3.3')
I managed to get a screenshot as a HPGL file out of the scope after some fiddling, though I am not doing it by the book.
import pyvisa as visa
rm = visa.ResourceManager('@py')
lib = rm.visalib
instr = rm.open_resource('GPIB0::7::INSTR')
instr.read_termination = ''
instr.write_termination = '\n'
# 10 CLEAR 707 ! Initialize instrument interface
# 15 HARDcopy:mode plot
# 20 ON INTR 7,5 GOTO 160 ! Exit printing routine after SRQ
# 30 ENABLE INTR 7;2 ! Enable SRQ on bus #7
instr.write('*CLS?') # 40 OUTPUT 707;"*CLS" ! Clear status data structures
instr.write('*ESE 1') # 50 OUTPUT 707;"*ESE 1"! Enable OPC
instr.write('*SRE 32') # 60 OUTPUT 707;"*SRE 32" ! Enable Event Status Register
instr.write(':HARDCOPY:PAGE AUTOMATIC') # 70 OUTPUT 707;":HARDCOPY:PAGE AUTOMATIC"
instr.write(':HARDCOPY:LENGTH 12') # 80 OUTPUT 707;":HARDCOPY:LENGTH 12"
instr.write(':PLOT?;*OPC') # 90 OUTPUT 707;":PLOT?;*OPC" ! Set OPC when plot is complete
# TODO missing: 100 SEND 7;UNT UNL ! Clear bus
# TODO missing: 110 SEND 7;TALK 7 ! Scope to talk mode
# TODO missing: 120 SEND 7;LISTEN 1 ! Printer to listen mode
# Not implemented lib.gpib_control_atn(instr.session, visa.constants.VI_GPIB_ATN_DEASSERT) # 130 SEND 7;DATA ! Lower ATN line @ controller
# Not implemented instr.wait_for_srq()
plot = instr.read_raw()
with open("plot", 'wb') as f:
f.write(plot)
instr.close()
Please see the 'missing' and 'Not implemented' comments above.
How do I go about clearing the bus, explicitly putting the scope in talk mode, myself in listen mode, setting the ATN line and waiting for SRQ?
Also, does what I am doing above appear to be correct?
I guess the commented stuff (lines 10..30) are irrelevant as that is HP BASIC for the controller.
Metadata
Metadata
Assignees
Labels
No labels