I am attempting to load an arbitrary waveform to AFG1022. However, this does not appear to work at all.
AFG1022 version: 1.2.7
Python: 3.9.13 x64
PyVISA: 1.13
The default waveform in EMEM appears to be a parabola, 8192 points long. The waveform I am uploading is a TTL sequence (basically, square pulses, 0 V to 5 V). Channel 1 is set to a sine wave.
Initiating connection to the device goes normally, and I can execute other commands remotely. For example, set amplitude, frequency, etc. In those cases, the device responds as expected.
In the code example below,
afg
is the objected created in my code, and its property
afg._dev
is the PyVISA resource object, which allows sending actual commands. The object
ttl
is prepared by another function, and originally its data type is
float64
. I proceed like this:
>>> ttl_int = np.array(((ttl - ttl.min()) / (ttl.max() - ttl.min())) * 16382, dtype = '>u2')
>>> ttl_int.size
500
>>> afg.wvfm_setlen(500)
>>> afg.q_error()
[] # empty list indicates no errors
>>> afg.wvfm_qlen()
500 # EMEM length is 500 points
>>> afg._dev.write_binary_values('DATA EMEMORY,', ttl_int, datatype = 'H', is_big_endian = True, termination = '\n')
1020
>>> afg._dev.write('source1:func:shape emem')
At this point, the AFG1022 shows the waveform on Channel 1 is a parabola (not square), it also notes "Shape emem". A scope hooked up to the AFG also shows the output is a sequence of parabolas.
Also, if I try to query values of various points in EMEM, they all seem to come back as 0, even at positions that should be non-zero:
>>> afg.wvfm_qval(175)
0.0
>>> ttl_int[174]
16382
What is going on here? Am I missing some critical step in setting up the arb waveform?