Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
adc-testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
misc
adc-testing
Commits
a900b08a
Commit
a900b08a
authored
Aug 19, 2011
by
Federico Asara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agilent 33250A Waveform Generator control module via RS232.
parent
c54e6c48
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
+76
-0
Agilent33250A.py
Pain/Agilent33250A/Agilent33250A.py
+59
-0
SineWaveform.py
Pain/Agilent33250A/SineWaveform.py
+12
-0
__init__.py
Pain/Agilent33250A/__init__.py
+5
-0
No files found.
Pain/Agilent33250A/Agilent33250A.py
0 → 100644
View file @
a900b08a
import
Generic.Generator
as
gen
import
time
from
SineWaveform
import
*
def
Property
(
func
):
return
property
(
**
func
())
"""This class should manage the Agilent 33250A waveform generator"""
class
Agilent33250A
(
gen
.
Generator
):
def
__init__
(
self
,
device
=
"/dev/ttyUSB0"
,
bauds
=
57600
,
to
=
2
,
interCharTimeout
=
1
):
gen
.
Generator
.
__init__
(
self
,
device
=
device
,
bauds
=
bauds
,
to
=
to
,
interCharTimeout
=
interCharTimeout
)
def
command
(
self
,
what
):
if
type
(
what
)
is
str
:
what
=
(
what
,
)
return
sum
(
map
(
lambda
x
:
self
.
write
(
"
%
s
\n
"
%
x
),
what
))
@
Property
def
output
():
doc
=
"Output status of the generator"
def
fget
(
self
):
self
.
command
(
"OUTP?"
)
output
=
self
.
read
(
2
)[
0
]
return
output
==
"1"
def
fset
(
self
,
status
):
if
type
(
status
)
is
not
bool
:
return
self
.
command
(
"OUTP
%
d"
%
(
1
if
status
else
0
))
return
locals
()
# legacy
def
lsine
(
self
,
frequency
,
amplitude
,
dc
=
0
,
freqm
=
'HZ'
,
ampm
=
'VPP'
,
dcm
=
'V'
):
self
.
command
(
"APPL:SIN
%.2
f
%
s,
%.2
f
%
s,
%.2
f
%
s"
%
(
frequency
,
freqm
,
amplitude
,
ampm
,
dc
,
dcm
))
def
sweep
(
self
,
interval
,
waves
,
callback
=
None
):
for
w
in
waves
:
self
.
command
(
w
.
apply
())
time
.
sleep
(
interval
)
if
callback
is
not
None
:
callback
(
f
)
# legacy
def
lsweep
(
self
,
interval
,
frequencies
,
amplitude
,
dc
=
0
,
freqm
=
'HZ'
,
ampm
=
'VPP'
,
dcm
=
'V'
,
callback
=
None
):
for
f
in
frequencies
:
self
.
sine
(
f
,
amplitude
,
dc
,
freqm
,
ampm
,
dcm
)
time
.
sleep
(
interval
)
if
callback
is
not
None
:
callback
(
f
)
Pain/Agilent33250A/SineWaveform.py
0 → 100644
View file @
a900b08a
import
Generic.SineWaveform
as
sw
class
SineWaveform
(
sw
.
SineWaveform
):
def
apply
(
self
):
return
"APPL:SIN
%
f
%
s,
%
f
%
s,
%
f
%
s"
%
(
self
.
_freq
[
0
],
self
.
_freq
[
1
],
\
self
.
_amp
[
0
],
self
.
_amp
[
1
],
\
self
.
_dc
[
0
],
self
.
_dc
[
1
])
Pain/Agilent33250A/__init__.py
0 → 100644
View file @
a900b08a
__author__
=
"Federico"
__date__
=
"$Aug 17, 2011 4:43:08 PM$"
# PAIn: Python ADC Interface
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