summaryrefslogtreecommitdiff
path: root/gr-atsc/src/python/fpll.py
diff options
context:
space:
mode:
authorcswiger2007-04-23 10:45:42 +0000
committercswiger2007-04-23 10:45:42 +0000
commitd049678e49aefaa823ce45bd9310e2e43c93e1cf (patch)
treeed7b5a030611df1e4ca916bf19717a165e1bab9f /gr-atsc/src/python/fpll.py
parentaaf51ed7d99ba7cb9badd38c15e8643425b8bf78 (diff)
downloadgnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.tar.gz
gnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.tar.bz2
gnuradio-d049678e49aefaa823ce45bd9310e2e43c93e1cf.zip
Fixed atsc_field_sync_demux to consume input even when not creating
output. Added python files to make a complete 2.x atsc receiver, but it is not fully working. It will happily produce the exact same amount of transport stream output as a working system but has errors in the data. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5081 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-atsc/src/python/fpll.py')
-rwxr-xr-xgr-atsc/src/python/fpll.py84
1 files changed, 84 insertions, 0 deletions
diff --git a/gr-atsc/src/python/fpll.py b/gr-atsc/src/python/fpll.py
new file mode 100755
index 000000000..0788d0fb0
--- /dev/null
+++ b/gr-atsc/src/python/fpll.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+from gnuradio import gr, atsc
+import math
+
+def main():
+
+ fg = gr.flow_graph()
+
+ u = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_2")
+
+ input_rate = 19.2e6
+ IF_freq = 5.75e6
+
+
+ # 1/2 as wide because we're designing lp filter
+ symbol_rate = atsc.ATSC_SYMBOL_RATE/2.
+ NTAPS = 279
+ tt = gr.firdes.root_raised_cosine (1.0, input_rate, symbol_rate, .115, NTAPS)
+ # heterodyne the low pass coefficients up to the specified bandpass
+ # center frequency. Note that when we do this, the filter bandwidth
+ # is effectively twice the low pass (2.69 * 2 = 5.38) and hence
+ # matches the diagram in the ATSC spec.
+ arg = 2. * math.pi * IF_freq / input_rate
+ t=[]
+ for i in range(len(tt)):
+ t += [tt[i] * 2. * math.cos(arg * i)]
+ rrc = gr.fir_filter_fff(1, t)
+
+ fpll = atsc.fpll()
+
+ pilot_freq = IF_freq - 3e6 + 0.31e6
+ lower_edge = 6e6 - 0.31e6
+ upper_edge = IF_freq - 3e6 + pilot_freq
+ transition_width = upper_edge - lower_edge
+ lp_coeffs = gr.firdes.low_pass (1.0,
+ input_rate,
+ (lower_edge + upper_edge) * 0.5,
+ transition_width,
+ gr.firdes.WIN_HAMMING);
+
+ lp_filter = gr.fir_filter_fff (1,lp_coeffs)
+
+ alpha = 1e-5
+ iir = gr.single_pole_iir_filter_ff(alpha)
+ remove_dc = gr.sub_ff()
+
+ out = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_3")
+ # out = gr.file_sink(gr.sizeof_float,"/mnt/sata/atsc_data_float")
+
+ fg.connect(u, fpll, lp_filter)
+ fg.connect(lp_filter, iir)
+ fg.connect(lp_filter, (remove_dc,0))
+ fg.connect(iir, (remove_dc,1))
+ fg.connect(remove_dc, out)
+
+ fg.run()
+
+
+if __name__ == '__main__':
+ main ()
+
+
+