annotate autocal/vcxomeas.c @ 24:0b6881281d86

fc-rfcal-vcxo ready for first test
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 22:00:36 +0000
parents
children 5226dbaa5333
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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);
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 atof(tsid_response + 1);
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 }