From f8fcb642dabca11870886c53dfdff66c86774db0 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:32:30 -0700 Subject: Added skeleton HRPT decoder block --- gr-noaa/lib/noaa_hrpt_decoder.cc | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gr-noaa/lib/noaa_hrpt_decoder.cc (limited to 'gr-noaa/lib/noaa_hrpt_decoder.cc') diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc new file mode 100644 index 000000000..7aa815c5c --- /dev/null +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 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 3, 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., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#define SYNC1 0x0284 +#define SYNC2 0x016F +#define SYNC3 0x035C +#define SYNC4 0x019D +#define SYNC5 0x020F +#define SYNC6 0x0095 + +noaa_hrpt_decoder_sptr +noaa_make_hrpt_decoder() +{ + return gnuradio::get_initial_sptr(new noaa_hrpt_decoder()); +} + +noaa_hrpt_decoder::noaa_hrpt_decoder() + : gr_sync_block("noaa_hrpt_decoder", + gr_make_io_signature(1, 1, sizeof(short)), + gr_make_io_signature(0, 0, 0)) +{ + d_word_count = 0; +} + +int +noaa_hrpt_decoder::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned short *in = (const unsigned short*)input_items[0]; + + int i = 0; + while (i < noutput_items) { + unsigned short word = in[i++]; + } + + return i; +} -- cgit From 751e1a0608cb51525f78fe5476be46ef6e461774 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 20 Sep 2009 19:57:30 -0700 Subject: Dumps HRPT frames to text file similar to specification document --- gr-noaa/lib/noaa_hrpt_decoder.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gr-noaa/lib/noaa_hrpt_decoder.cc') diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc index 7aa815c5c..4fae0173d 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -58,6 +58,19 @@ noaa_hrpt_decoder::work(int noutput_items, int i = 0; while (i < noutput_items) { unsigned short word = in[i++]; + d_word_count++; + fprintf(stderr, "%5u: ", d_word_count); + for (int pos = 0; pos < 10; pos++) { + char ch = (word & (1 << 9)) ? '1' : '0'; + word = word << 1; + fprintf(stderr, "%c ", ch); + } + fprintf(stderr, "\n"); + + if (d_word_count == 11090) { + d_word_count = 0; + fprintf(stderr, "\n"); + } } return i; -- cgit From 7c4b43a1a4b3ff6c99fe96805f8d4518a22eb0a5 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Wed, 23 Sep 2009 11:40:19 -0700 Subject: Split HRPT script into live receive and post-processing Cleanup debug info Created 'demod_hrpt_file.py' Updated 'usrp_rx_hrpt.py' with GUI, USRP, and config file --- gr-noaa/lib/noaa_hrpt_decoder.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-noaa/lib/noaa_hrpt_decoder.cc') diff --git a/gr-noaa/lib/noaa_hrpt_decoder.cc b/gr-noaa/lib/noaa_hrpt_decoder.cc index 4fae0173d..8cfaa913c 100644 --- a/gr-noaa/lib/noaa_hrpt_decoder.cc +++ b/gr-noaa/lib/noaa_hrpt_decoder.cc @@ -59,17 +59,17 @@ noaa_hrpt_decoder::work(int noutput_items, while (i < noutput_items) { unsigned short word = in[i++]; d_word_count++; - fprintf(stderr, "%5u: ", d_word_count); + //fprintf(stderr, "%5u: ", d_word_count); for (int pos = 0; pos < 10; pos++) { char ch = (word & (1 << 9)) ? '1' : '0'; word = word << 1; - fprintf(stderr, "%c ", ch); + //fprintf(stderr, "%c ", ch); } - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); if (d_word_count == 11090) { d_word_count = 0; - fprintf(stderr, "\n"); + //fprintf(stderr, "\n"); } } -- cgit