Commit 580b25d4 authored by Projects's avatar Projects

pulse_gen.py: block execution until the pulse burst is completed

parent 389c01b4
......@@ -134,16 +134,7 @@ ser.write(b'OUTP OFF\r\n')
ser.write(b'*RST\r\n')
# clear errors
while True:
ser.write(b'SYST:ERR?\r\n')
status = ser.readline().decode()
if status == '':
print('ERROR: Could not read the error queue')
sys.exit(2)
if status.startswith('+0'):
break
ser.write(b'*CLS\r\n')
###############################################################################
# Select the way of generating pulses
......@@ -257,8 +248,20 @@ ser.write(b'OUTP ON\r\n')
# trigger the output
ser.write(b'*TRG\r\n')
ser.write(b'*WAI\r\n')
# wait for the operation to complete
ser.write(b'*OPC?\r\n')
while True:
status = ser.readline().decode()
if len(status) > 0:
if not status.startswith('1'):
error = True
print('ERROR: Operation interrupted (status: %s)' % status)
break
ser.write(b'OUTP OFF\r\n')
ser.close()
print('Finished successfully')
if not error:
print('Finished successfully')
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