QDAC-II triangle wavesΒΆ
[1]:
from time import sleep
import numpy
from IPython.display import Image, display
from qcodes_contrib_drivers.drivers.QDevil import QDAC2
qdac_addr = '192.168.8.17'
qdac = QDAC2.QDac2('QDAC', visalib='@py', address=f'TCPIP::{qdac_addr}::5025::SOCKET')
from qcodes.instrument_drivers.rigol import RigolDS1074Z
rigol_addr = '192.168.8.199'
scope = RigolDS1074Z('rigol', visalib='@py', address=f'TCPIP::{rigol_addr}::INSTR')
Connected to: QDevil QDAC-II (serial:3, firmware:10-1.4) in 0.22s
Connected to: RIGOL TECHNOLOGIES DS1104Z (serial:DS1ZA171812151, firmware:00.04.03) in 0.09s
[2]:
scope.write('*rst')
qdac.reset()
[3]:
def capture():
scope.write('stop')
scope.write(":disp:data?")
bmpdata = scope.visa_handle.read_raw()[2+9:]
image = Image(data=bmpdata)
display(image)
[4]:
# Connect scope ch 3 to qdac ch 3
scope.write('chan1:disp off')
scope.write('chan3:disp on')
scope.write('chan3:bwl on')
scope.write('chan3:prob 1')
scope.write('chan3:scal 0.05')
scope.write('chan3:offs 0.0')
scope.write('trig:edge:sour chan3')
scope.write('trig:edge:level 0.05')
scope.write('tim:scal 2e-4')
scope.write('tim:offs 0')
[5]:
triangle = qdac.ch03.triangle_wave()
[6]:
scope.write('run')
triangle.start()
[7]:
sleep(1)
capture()
[7]:
scope.write('chan1:disp off')
scope.write('chan3:disp on')
scope.write('chan3:bwl on')
scope.write('chan3:prob 1')
scope.write('chan3:scal 0.5')
scope.write('chan3:offs 0.0')
scope.write('trig:edge:sour chan3')
scope.write('trig:edge:level 0.2')
scope.write('tim:scal 100e-6')
scope.write('tim:offs 0')
[8]:
triangle = qdac.ch03.triangle_wave(
period_s=200e-6,
span_V=1,
offset_V=0,
duty_cycle_percent=75
)
[9]:
scope.write('run')
triangle.start()
[11]:
sleep(1)
capture()
[10]:
scope.write('run')
triangle.abort()
[11]:
triangle = qdac.ch03.triangle_wave(
period_s=200e-6,
span_V=1,
duty_cycle_percent=20,
repetitions=4,
slew_V_s=50000
)
qdac.errors()
[11]:
'0, "No error"'
[12]:
scope.write('tim:offs 400e-6')
scope.write('sing')
sleep(2)
triangle.start()
[14]:
sleep(1)
capture()
[13]:
# Connect osc ch 4 to qdac out trigger 4
trigger = triangle.period_start_marker()
qdac.ext4.width_s(2e-5)
qdac.ext4.source_from_trigger(trigger)
scope.write('chan4:disp on')
scope.write('chan4:bwl on')
scope.write('chan4:prob 1')
scope.write('chan4:scal 1')
scope.write('chan4:offs -2')
qdac.errors()
[13]:
'0, "No error"'
[14]:
scope.write('sing')
sleep(3)
triangle.start()
[17]:
sleep(1)
capture()