Commit 5b4205ea authored by Projects's avatar Projects

pulsegen: Comments

parent ee00d300
......@@ -84,10 +84,14 @@ class PulseGen:
self.ser.close()
def ident(self):
""" Returns the identification string.
"""
self.ser.write(b'*IDN?\r\n')
return self.ser.readline().decode()
def reset(self):
""" Resets the device to the initial state.
"""
# reset to a known state
self.ser.write(b'OUTP OFF\r\n')
self.ser.write(b'*RST\r\n')
......@@ -96,6 +100,13 @@ class PulseGen:
self.ser.write(b'*CLS\r\n')
def pulse(self, count, freq, width, samples):
""" Configures the pulse burst signal.
:param count: Number of requested pulses
:param freq: Frequency of pulses [Hz]
:param width: Pulse duration [s]
:param samples: Number of samples used to generate an arbitrary waveform,
if needed
"""
# Select the way of generating pulses
# 33250A has a limit of 1e6 pulses in a single burst. To overcome this
# limitation, one can create an arbitrary waveform containing n pulses
......@@ -203,8 +214,9 @@ class PulseGen:
if error:
raise RuntimeError('Generator error(s) occurred: %s' % error_msg)
# print('Sending %d pulses (%g s) at %g Hz' % (real_count, width, freq * div))
def trigger(self):
""" Starts generating the configured pulse burst.
"""
# enable output for load = 50 ohms
self.ser.write(b'OUTP:LOAD 50\r\n')
self.ser.write(b'OUTP ON\r\n')
......@@ -213,6 +225,8 @@ class PulseGen:
self.ser.write(b'*TRG\r\n')
def wait(self):
""" Waits for the current operation to complete (blocking).
"""
# wait for the operation to complete
self.ser.write(b'*OPC?\r\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment