Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL Blocking
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Conv TTL Blocking
Commits
5b4205ea
Commit
5b4205ea
authored
Feb 15, 2017
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pulsegen: Comments
parent
ee00d300
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
pulsegen.py
software/utils/pulsegen.py
+16
-2
No files found.
software/utils/pulsegen.py
View file @
5b4205ea
...
...
@@ -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
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment