Products > Test Equipment
open source GPIB adapter
caiser01:
--- Quote from: dazz1 on December 15, 2023, 11:00:40 pm ---It appears that the resource string is unique to each adapter (I have only assembled one so far). If so, then the string should be physically readable on the adapter.
I haven't design the enclosure yet, but it would be easy to include a slot for a light card label with the printed resource string.
It seems sensible to make the label big enough to include space for the ID of the test equipment that the associated software is written for.
--- End quote ---
The resource string will be different for each different instrument you use the adapter with.
If you have the adapter's Auto ID feature enabled (it is by default), the resource string will contain the instrument's response to a *IDN? query. For example, when connected to my HP 53131A universal counter, the resource string is: USB0::0x03EB::0x2065::HEWLETT-PACKARD_53131A_0_3703::INSTR
If you're connected to an instrument that does not support the *IDN? query or if you disable the adapter's Auto ID feature, the resource string will look like this:
USB0::0x03EB::0x2065::GPIB_23_3423331363435161F191::INSTR
The part in bold is a serial number that should be unique to each adapter. The GPIB_nn part represents the GPIB address of the connected instrument. This will change for different instruments with different addresses.
dazz1:
Hi
I have been playing around with the code but it isn't working. I don't appear to have comms with the meter.
--- Code: ---# HP 3478A Multimeter simple read test
import pyvisa
print("Simple GPIB test for HP3478A multimeter")
print("Show the list of Resources")
rm = pyvisa.ResourceManager()
print(rm.list_resources())
# ID string for adapter 0: 'USB0::0x03EB::0x2065::GPIB_23_24238323232351C01171::INSTR'
print("Opening the Meter")
# Resource = GPIB-usb adapter 0. Different for each adapter.
multimeter = rm.open_resource('USB0::0x03EB::0x2065::GPIB_23_24238323232351C01171::INSTR')
# Write some text to display
multimeter.write('D2OK GPIB USB')
# Set function to DC volts (F1), auto-range (RA), trigger hold (T4), 4.5 digit (N4), auto-zero (Z1), internal trigger (T1)
multimeter.write('H1T1')
print("Reading the DC volts")
try:
while True:
print(float(multimeter.read().strip()))
except KeyboardInterrupt:
multimeter.clear()
multimeter.close()
rm.close()
--- End code ---
I usually add a lot of print statements to see what is working, and what isn't.
It isn't.
I get the following error messages:
--- Code: --->python gpib_test.py
Simple GPIB test for HP3478A multimeter
Show the list of Resources
('USB0::0x03EB::0x2065::GPIB_23_24238323232351C01171::INSTR', 'ASRL1::INSTR')
Opening the Meter
Traceback (most recent call last):
File "D:\gpib_test.py", line 19, in <module>
multimeter.write('H1T1')
...
--- End code ---
If the resource string is from the instrument and not the adapter, then the adapter must have comms with the instrument.
The "D2" command just writes a string to the display, but that is not happening.
The "H1T1" puts the meter into DC mode, continuous internal trigger, but it isn't.
That indicates I may have a hardware fault either in the instrument, or in the adapter.
R&S Tester does not find the usb-gpib adapter resource. I am not sure if installing NI-visa or py-visa has over-written something that R&S needs.
caiser01:
--- Quote from: dazz1 on December 16, 2023, 02:41:09 am ---R&S Tester does not find the usb-gpib adapter resource. I am not sure if installing NI-visa or py-visa has over-written something that R&S needs.
--- End quote ---
If you have multiple VISA implementations installed, we need to figure out which one pyvisa is grabbing.
What is the output when you run pyvisa-info from the command prompt?
dazz1:
--- Quote from: caiser01 on December 16, 2023, 03:22:29 pm ---...
What is the output when you run pyvisa-info from the command prompt?
--- End quote ---
--- Code: ---Machine Details:
Platform ID: Windows-10-10.0.19045-SP0
Processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel Python:
Implementation: CPython
Executable: G:\Programs\Python310\python.exe
Version: 3.12.1
Compiler: MSC v.1937 64 bit (AMD64)
Architecture: AMD64
Build: Dec 7 2023 22:03:25 (#tags/v3.12.1:2305ca5)
Unicode: UCS4
PyVISA Version: 1.14.1 Backends:
ivi:
Version: 1.14.1 (bundled with PyVISA)
#1: C:\WINDOWS\system32\visa32.dll:
found by: auto
architecture:
('x86', 64)
Vendor: Rohde & Schwarz GmbH
Impl. Version: 7340546
Spec. Version: 7340544
#2: C:\WINDOWS\system32\visa64.dll:
found by: auto
architecture:
('x86', 64)
Vendor: Rohde & Schwarz GmbH
Impl. Version: 7340546
Spec. Version: 7340544
--- End code ---
I can see it is grabbing the R&S visa (I have NI visa installed as well) but when I run R&S directly, it does not detect the usb-gpib adapter.
So I still don't know if I have a HW or SW fault.
I am writing a test program in C++ (another new language to me, although I have programmed in C-like languages eg.Java) that will sequentially pulse each port pin. It will help identify solder bridges or open circuits on the port pins.
It will be a separate stand-alone program usable on, or adaptable to, any AVR MCU.
caiser01:
--- Quote from: dazz1 on December 16, 2023, 08:52:34 pm ---I can see it is grabbing the R&S visa (I have NI visa installed as well) but when I run R&S directly, it does not detect the usb-gpib adapter.
--- End quote ---
That's weird given that when you run the Python script, it does detect the adapter.
Just for giggles, try adding this line after the open_resource line:
--- Code: ---multimeter.write_termination = '\n'
--- End code ---
If that doesn't work, try making it '\r\n'.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version