Line 1... |
Line 1... |
1 |
#!/usr/bin/python |
1 |
#!/usr/bin/python |
2 |
# |
2 |
# |
3 |
# Utility for setting frequency of Si570 |
3 |
# Utility for setting frequency of Si570 without a frequency measurement. |
- |
|
4 |
# The factory calibration is used for changing the frequency. |
- |
|
5 |
# This utility reset the Si570 to factory default 10 MHz first and than set a new frequency. |
- |
|
6 |
# |
- |
|
7 |
# This utility use an USBI2C01A module. |
- |
|
8 |
# (c) MLAB 2014 |
4 |
|
9 |
|
5 |
import time |
10 |
import time |
6 |
import datetime |
11 |
import datetime |
7 |
import sys |
12 |
import sys |
8 |
from pymlab import config |
13 |
from pymlab import config |
Line 29... |
Line 34... |
29 |
}, |
34 |
}, |
30 |
], |
35 |
], |
31 |
) |
36 |
) |
32 |
cfg.initialize() |
37 |
cfg.initialize() |
33 |
|
38 |
|
34 |
fgen = cfg.get_device("clkgen") |
39 |
fgen = cfg.get_device("clkgen") |
35 |
sys.stdout.write("Frequency will be set to " + sys.argv[2] + " MHz.\r\n") |
40 |
sys.stdout.write("Frequency will be set to " + sys.argv[2] + " MHz.\r\n") |
36 |
fgen.reset() |
41 |
fgen.reset() # Reset Si570 to 10 MHz |
37 |
time.sleep(3) |
42 |
time.sleep(3) |
38 |
fgen = cfg.get_device("clkgen") |
43 |
fgen = cfg.get_device("clkgen") # Reopen CP2112 |
39 |
fgen.set_freq(10., float(eval(sys.argv[2]))) |
44 |
fgen.set_freq(10., float(eval(sys.argv[2]))) # Set frequency |
40 |
sys.stdout.write("Done.\r\n") |
45 |
sys.stdout.write("Done.\r\n") |
41 |
sys.stdout.flush() |
46 |
sys.stdout.flush() |
42 |
sys.exit(0) |
47 |
sys.exit(0) |
43 |
|
48 |
|