Commit 7f4ae8c2 authored by Projects's avatar Projects

pulse_gen.py: Additional comments

parent c1ff389d
......@@ -11,7 +11,8 @@
#
# description:
# This script is used to configure an Agilent 33250A signal generator
# to generate an arbitrary burst of pulses via serial port interface.
# to generate an arbitrary burst of pulses via serial port interface
# (SCPI commands).
#
# Be sure that both the generator and the serial port have the same settings:
# - **RTS/CTS handshake enabled**
......@@ -19,6 +20,9 @@
# - parity bit disabled
# - 1 bit start, 1 bit stop,
#
# SCPI commands for the generator are described in the Agilent 33250A manual
# (http://cp.literature.agilent.com/litweb/pdf/33250-90002.pdf)
#
#===============================================================================
# GNU LESSER GENERAL PUBLIC LICENSE
#===============================================================================
......@@ -157,6 +161,7 @@ if(count <= MAX_COUNT):
ser.write(b'PULS:PER %G\r\n' % (1.0 / freq))
ser.write(b'FUNC:SHAP PULS\r\n')
else:
# store the original values to compare them against the requested ones
orig_count = count
orig_width = width
......@@ -227,7 +232,7 @@ ser.write(b'BURS:NCYC %d\r\n' % count)
ser.write(b'BURS:PHAS 0\r\n')
ser.write(b'BURS:STAT ON\r\n')
# check errors queue
# check errors queue and printout error messages if any
error = False
while True:
ser.write(b'SYST:ERR?\r\n')
......@@ -262,6 +267,7 @@ while True:
print('ERROR: Operation interrupted (status: %s)' % status)
break
# disable output
ser.write(b'OUTP OFF\r\n')
ser.close()
......
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