Products > Test Equipment
UNI-T UTG932/UTG962 200MSa/s Function Arbitrary Waveform Generator
eTobey:
What is "[15:]" for?
aix:
--- Quote from: eTobey on October 04, 2024, 07:36:08 am ---What is "[15:]" for?
--- End quote ---
It removes a header from the received message. I took it from some code posted earlier in the thread. It never comes into play though since the read call never returns.
adeuring:
--- Quote from: aix on October 03, 2024, 12:48:58 pm ---Here's the code:
import pyvisa
pyvisa.log_to_screen()
ADDR = "USB0::26198::2100::AWG1523500244::0::INSTR"
rm = pyvisa.ResourceManager()
sgen = rm.open_resource(ADDR)
sgen.write("*IDN?")
print(sgen.read())
sgen.write("Display:Data?")
disp = sgen.read_raw()[15:] # <<< HANGS HERE
--- End quote ---
I think you forgot a colon at the start of the display command. Try
sgen.write(":Display:Data?")
renaatd:
Well, the UTG962 is rather strict on what it accepts. I'm using this to read the display, and it works:
self.inst.write(":DISP?")
data = self.inst.read_binary_values(
datatype="B",
is_big_endian=False,
header_fmt="ieee",
expect_termination=True,
)
Just tried with "Display:Data?" in combination with read_binary_values, and it returns some data, but different from ":DISP?". Also tried with ":Disp?" and that causes a timeout. So I guess it's better to stick with ":DISP?".
aix:
--- Quote from: adeuring on October 05, 2024, 11:24:46 am ---I think you forgot a colon at the start of the display command. Try
sgen.write(":Display:Data?")
--- End quote ---
I tried and it made no difference, but thanks for the suggestion!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version