| Line 1... |
Line 1... |
| 1 |
#!/usr/bin/python |
1 |
#!/usr/bin/python |
| 2 |
# |
2 |
# |
| 3 |
# Sample of measiring and correct frequency with ACOUNTER02A |
3 |
# Sample of measuring and frequency correction with ACOUNTER02A |
| 4 |
|
4 |
|
| 5 |
import time |
5 |
import time |
| 6 |
import datetime |
6 |
import datetime |
| 7 |
import sys |
7 |
import sys |
| 8 |
from pymlab import config |
8 |
from pymlab import config |
| Line 16... |
Line 16... |
| 16 |
|
16 |
|
| 17 |
port = eval(sys.argv[1]) |
17 |
port = eval(sys.argv[1]) |
| 18 |
#### Sensor Configuration ########################################### |
18 |
#### Sensor Configuration ########################################### |
| 19 |
|
19 |
|
| 20 |
cfg = config.Config( |
20 |
cfg = config.Config( |
| - |
|
21 |
i2c = { |
| 21 |
port = port, |
22 |
"port": port, |
| - |
|
23 |
}, |
| 22 |
bus = [ |
24 |
bus = [ |
| 23 |
{ |
25 |
{ |
| 24 |
"type": "i2chub", |
26 |
"type": "i2chub", |
| 25 |
"address": 0x70, |
27 |
"address": 0x70, |
| 26 |
"children": [ |
28 |
"children": [ |
| Line 30... |
Line 32... |
| 30 |
}, |
32 |
}, |
| 31 |
], |
33 |
], |
| 32 |
) |
34 |
) |
| 33 |
cfg.initialize() |
35 |
cfg.initialize() |
| 34 |
|
36 |
|
| 35 |
print "Frequency counter readout example \r\n" |
37 |
print "RMDS Station frequency management test software \r\n" |
| 36 |
fcount = cfg.get_device("counter") |
38 |
fcount = cfg.get_device("counter") |
| 37 |
fgen = cfg.get_device("clkgen") |
39 |
fgen = cfg.get_device("clkgen") |
| 38 |
time.sleep(0.5) |
40 |
time.sleep(0.5) |
| 39 |
frequency = fcount.get_freq() |
41 |
frequency = fcount.get_freq() |
| 40 |
rfreq = fgen.get_rfreq() |
42 |
rfreq = fgen.get_rfreq() |
| 41 |
hsdiv = fgen.get_hs_div() |
43 |
hsdiv = fgen.get_hs_div() |
| 42 |
n1 = fgen.get_n1_div() |
44 |
n1 = fgen.get_n1_div() |
| 43 |
fdco = 0 |
45 |
#fdco = 0 |
| 44 |
fxtal = 0 |
46 |
#fxtal = 0 |
| 45 |
regs = [0, 0, 0] |
47 |
#regs = [0, 0, 0] |
| 46 |
|
48 |
|
| 47 |
|
49 |
|
| 48 |
#### Data Logging ################################################### |
50 |
#### Data Logging ################################################### |
| 49 |
|
51 |
|
| 50 |
try: |
52 |
try: |