diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/vcxomeas.c	Mon May 22 22:00:36 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * This module contains the frequency measurement code for fc-rfcal-vcxo.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+
+extern char tsid_response[];
+
+float
+vcxo_freq_meas(dac, hint)
+	int dac;
+	char *hint;
+{
+	char cmd[80];
+	double meas;
+
+	printf("Performing frequency measurement at DAC=%d (%s)\n", dac, hint);
+	do_rfpw(AFC_DAC_VALUE, dac);
+	usleep(80000);
+	sprintf(cmd, "freq-meas %s\n", hint);
+	tsid_command(cmd);
+	atof(tsid_response + 1);
+	printf("Measured frequency offset %.2f Hz\n", meas);
+	return(meas);
+}