FreeCalypso > hg > fc-rfcal-tools
annotate autocal/vcxomeas.c @ 71:784ce9f3a80a
fc-rfcal-txcheck: spec and error values added to the output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 Jul 2017 06:58:36 +0000 |
parents | 5226dbaa5333 |
children | b06532c9642f |
rev | line source |
---|---|
24
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the frequency measurement code for fc-rfcal-vcxo. |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdlib.h> |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <unistd.h> |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <rvinterf/l1tm.h> |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <rvinterf/exitcodes.h> |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 extern char tsid_response[]; |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 float |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 vcxo_freq_meas(dac, hint) |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 int dac; |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char *hint; |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char cmd[80]; |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 double meas; |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 printf("Performing frequency measurement at DAC=%d (%s)\n", dac, hint); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 do_rfpw(AFC_DAC_VALUE, dac); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 usleep(80000); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 sprintf(cmd, "freq-meas %s\n", hint); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 tsid_command(cmd); |
25
5226dbaa5333
autocal/vcxomeas.c: brown paper bag
Mychaela Falconia <falcon@freecalypso.org>
parents:
24
diff
changeset
|
26 meas = atof(tsid_response + 1); |
24
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 printf("Measured frequency offset %.2f Hz\n", meas); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 return(meas); |
0b6881281d86
fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 } |