Mercurial > ~darius > hgwebdir.cgi > pyinst
annotate acqsweep.py @ 85:60ad91b4c67c default tip
Add 'quick' option to use a faster sweep time with no averaging.
Useful for testing the hardware is setup correctly without having to wait 3 minutes.
author | Daniel O'Connor <doconnor@gsoft.com.au> |
---|---|
date | Mon, 21 Oct 2024 14:12:50 +1030 |
parents | 7386f2888508 |
children |
rev | line source |
---|---|
68
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
2 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
3 # Copyright (c) 2021 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
4 # Daniel O'Connor <darius@dons.net.au>. All rights reserved. |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
5 # |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
6 # Redistribution and use in source and binary forms, with or without |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
7 # modification, are permitted provided that the following conditions |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
8 # are met: |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
9 # 1. Redistributions of source code must retain the above copyright |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
10 # notice, this list of conditions and the following disclaimer. |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
11 # 2. Redistributions in binary form must reproduce the above copyright |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
12 # notice, this list of conditions and the following disclaimer in the |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
13 # documentation and/or other materials provided with the distribution. |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
14 # |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
15 # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
18 # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
25 # SUCH DAMAGE. |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
26 # |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
27 |
69
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
28 import sys |
68
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
29 import usb |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
30 import usb488 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
31 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
32 # |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
33 # Tested with a Rigol DSG815 connected via USB |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
34 # |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
35 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
36 def main(): |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
37 u = usb488.USB488Device() |
69
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
38 res = u.ask('*IDN?') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
39 print('Found device ID: ' + res) |
68
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
40 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
41 setup(u) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
42 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
43 def freqsetup(u, swstart, swstop, swpoints, swoffset, swlevel): |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
44 '''Setup a frequency sweep''' |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
45 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
46 # Output off |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
47 wrcheck(u, ':OUTP:STATE', 'OFF') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
48 # Single sweep |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
49 wrcheck(u, ':SWE:MODE', 'SING') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
50 # Frequency sweep |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
51 wrcheck(u, ':SWE:STATE', 'FREQ') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
52 # Step (not list) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
53 wrcheck(u, ':SWE:TYPE', 'STEP') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
54 # In single sweep so it starts when SOU:SWE:EXE is sent |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
55 wrcheck(u, ':SWE:SWE:TRIG:TYPE', 'AUTO') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
56 # Sweep a point every external trigger |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
57 wrcheck(u, ':SWE:POIN:TRIG:TYPE', 'EXT') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
58 # Sweep up |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
59 wrcheck(u, ':SWE:DIR', 'FWD') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
60 # Ramp (vs triangle) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
61 wrcheck(u, ':SWE:STEP:SHAP', 'RAMP') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
62 # Linear sweep |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
63 wrcheck(u, ':SWE:STEP:SPAC', 'LIN') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
64 # Start/stop/points in sweep |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
65 wrcheck(u, ':SWE:STEP:STAR:FREQ', '%fHz' % (swstart + swoffset,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
66 wrcheck(u, ':SWE:STEP:STOP:FREQ', '%fHz' % (swstop + swoffset,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
67 wrcheck(u, ':SWE:STEP:POIN', '%d' % (swpoints,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
68 # Output level |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
69 wrcheck(u, ':SWE:STEP:STAR:LEV', '%fdBm' % (swlevel,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
70 wrcheck(u, ':SWE:STEP:STOP:LEV', '%fdBm' % (swlevel,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
71 wrcheck(u, ':LEV', '%fdBm' % (swlevel,)) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
72 |
69
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
73 def powersetup(u, swstart, swstop, swpoints, swfreq, swoffset): |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
74 '''Setup a power sweep''' |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
75 |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
76 # Output off |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
77 wrcheck(u, ':OUTP:STATE', 'OFF') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
78 # Single sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
79 wrcheck(u, ':SWE:MODE', 'SING') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
80 # Level sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
81 wrcheck(u, ':SWE:STATE', ' LEV') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
82 # Step (not list) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
83 wrcheck(u, ':SWE:TYPE', 'STEP') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
84 # In single sweep so it starts when SOU:SWE:EXE is sent |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
85 wrcheck(u, ':SWE:SWE:TRIG:TYPE', 'AUTO') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
86 # Sweep a point every external trigger |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
87 wrcheck(u, ':SWE:POIN:TRIG:TYPE', 'EXT') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
88 # Sweep up |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
89 wrcheck(u, ':SWE:DIR', 'FWD') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
90 # Ramp (vs triangle) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
91 wrcheck(u, ':SWE:STEP:SHAP', 'RAMP') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
92 # Linear sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
93 wrcheck(u, ':SWE:STEP:SPAC', 'LIN') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
94 # Start/stop/points in sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
95 wrcheck(u, ':LEV', '%fdBm' % (swstart,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
96 wrcheck(u, ':SWE:STEP:STAR:LEV', '%fdBm' % (swstart,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
97 wrcheck(u, ':SWE:STEP:STOP:LEV', '%fdBm' % (swstop,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
98 wrcheck(u, ':SWE:STEP:POIN', '%d' % (swpoints,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
99 # Output frequency |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
100 wrcheck(u, ':SWE:STEP:STAR:FREQ', '%fHz' % (swfreq + swoffset,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
101 wrcheck(u, ':SWE:STEP:STOP:FREQ', '%fHz' % (swfreq + swoffset,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
102 wrcheck(u, ':FREQ', '%fHz' % (swfreq,)) |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
103 # Level sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
104 |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
105 # XXX: need to send this twice for some reason |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
106 # isn't needed for frequency sweep |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
107 wrcheck(u, ':SWE:STATE', ' LEV') |
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
108 |
68
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
109 def arm(u): |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
110 # Output on |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
111 wrcheck(u, ':OUTP:STATE', 'ON') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
112 # Arm it |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
113 u.chkcmd(':SWE:EXEC') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
114 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
115 def wrcheck(u, name, value): |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
116 '''Helper function to set a value then read it back and print it out''' |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
117 u.chkcmd(name + ' ' + value) |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
118 readval = u.ask(name + '?') |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
119 print(name + ' -> ' + readval + ' (' + value + ')') |
69
7386f2888508
Make function more configurable
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
68
diff
changeset
|
120 #sys.stdin.readline() |
68
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
121 |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
122 if __name__ == '__main__': |
f95db5ea2fe1
Add example code to configure a Rigol DSG815 for a frequency sweep
Daniel O'Connor <doconnor@gsoft.com.au>
parents:
diff
changeset
|
123 main() |