Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
FMC TDC 1ns 5cha - Software
Commits
a17498f6
Commit
a17498f6
authored
Oct 15, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tst: improve SCPI interface
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
ee464348
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
conftest.py
pytest/conftest.py
+19
-13
No files found.
pytest/conftest.py
View file @
a17498f6
...
...
@@ -26,40 +26,46 @@ class SCPI(PulseGenerator):
import
pyvisa
self
.
mgr
=
pyvisa
.
ResourceManager
()
self
.
instr
=
self
.
mgr
.
open_resource
(
self
.
id
)
self
.
instr
.
query_delay
=
10
self
.
instr
.
query_delay
=
0
self
.
instr
.
timeout
=
10000
self
.
instr
.
read_termination
=
'
\n
'
self
.
instr
.
write_termination
=
'
\n
'
self
.
instr
.
write
(
"*RST"
)
self
.
wait_completion
(
)
self
.
instr
.
query_ascii_values
(
"*OPC?"
)
self
.
instr
.
write
(
"*CLS"
)
self
.
instr
.
write
(
"INITIATE:CONTINUOUS OFF"
)
self
.
instr
.
write
(
"OUTPUT:STATE OFF"
)
def
wait_completion
(
self
):
if
int
(
self
.
instr
.
query_ascii_values
(
"*OPC?"
)[
0
])
!=
1
:
raise
Exception
(
"Failed to reset the waveform generator"
)
def
disable
(
self
,
ch
):
self
.
instr
.
write
(
"OUTPUT:STATE OFF"
)
def
generate_pulse
(
self
,
ch
,
rel_time_us
,
period_ns
,
count
,
sync
):
import
pdb
;
pdb
.
set_trace
()
self
.
instr
.
write
(
"OUTPUT:STATE OFF"
)
self
.
instr
.
write
(
"SOURCE:VOLTAGE:LEVEL:IMMEDIATE:AMPLITUDE 5.0V"
)
# START Custom Agilent 33600A commands
self
.
instr
.
write
(
"SOURCE:BURST:STATE OFF"
)
# END Custom Agilent 33600A commands
self
.
instr
.
write
(
"SOURCE:VOLTAGE:LEVEL:IMMEDIATE:AMPLITUDE 2.5V"
)
self
.
instr
.
write
(
"SOURCE:VOLTAGE:LEVEL:IMMEDIATE:OFFSET 1.25V"
)
self
.
instr
.
write
(
"SOURCE:FUNCTION:SHAPE PULSE"
)
self
.
instr
.
write
(
"SOURCE:PULSE:WIDTH 100ns"
)
self
.
instr
.
write
(
"SOURCE:PULSE:PERIOD {:d}ns"
.
format
(
period_ns
))
# START Custom Agilent 33600A commands
self
.
instr
.
write
(
"SOURCE:BURST:STATE ON"
)
self
.
instr
.
write
(
"TRIGGER:DELAY {:d}e-6"
.
format
(
rel_time_us
))
burst_period_ns
=
int
(
count
/
(
1
/
period_ns
))
+
500
self
.
instr
.
write
(
"SOURCE:BURST:INTERNAL:PERIOD {:d}ns"
.
format
(
burst_period_ns
))
self
.
instr
.
write
(
"SOURCE:BURST:NCYCLES {:d}"
.
format
(
count
))
# self.instr.write("TRIGGER:DELAY {:d}us".format(rel_time_us)
)
self
.
instr
.
write
(
"SOURCE:BURST:STATE ON"
)
# END Custom Agilent 33600A commands
self
.
instr
.
write
(
"OUTPUT:STATE ON"
)
self
.
wait_completion
()
self
.
instr
.
query_ascii_values
(
"*OPC?"
)
self
.
instr
.
write
(
"INITIATE:IMMEDIATE"
)
if
sync
:
self
.
wait_completion
(
)
self
.
instr
.
query_ascii_values
(
"*OPC?"
)
class
FmcFineDelay
(
PulseGenerator
):
CHANNEL_NUMBER
=
4
...
...
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