commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3703 - gnuradio/branches/developers/jcorgan/pager/gr-


From: jcorgan
Subject: [Commit-gnuradio] r3703 - gnuradio/branches/developers/jcorgan/pager/gr-pager/src
Date: Tue, 3 Oct 2006 19:43:47 -0600 (MDT)

Author: jcorgan
Date: 2006-10-03 19:43:47 -0600 (Tue, 03 Oct 2006)
New Revision: 3703

Modified:
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
Log:
Added resampler block to allow channel rate to vary, but always gets
resampled to 16000.


Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py       
2006-10-03 23:45:13 UTC (rev 3702)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/flex_demod.py       
2006-10-04 01:43:47 UTC (rev 3703)
@@ -19,10 +19,12 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-from gnuradio import gr, optfir
+from gnuradio import gr, gru, optfir, blks
 from math import pi
 import pager_swig
 
+chan_rate = 16000
+
 class flex_demod:
     """
     FLEX pager protocol demodulation block.
@@ -32,6 +34,7 @@
 
     Flow graph (so far):
 
+    RSAMP    - Resample incoming stream to 16000 sps
     QUAD     - Quadrature demodulator converts FSK to baseband amplitudes  
     LPF      - Low pass filter to remove noise prior to slicer
     SLICER   - Converts input to one of four symbols (0, 1, 2, 3)
@@ -45,17 +48,30 @@
     @type sample_rate: integer
     """
 
+
     def __init__(self, fg, channel_rate, queue):
-        k = channel_rate/(2*pi*4800)        # 4800 Hz max deviation
+        k = chan_rate/(2*pi*4800)        # 4800 Hz max deviation
         QUAD = gr.quadrature_demod_cf(k)
        self.INPUT = QUAD
                
-        taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60)
+       if channel_rate is not chan_rate:
+               interp = gru.lcm(channel_rate, chan_rate)/channel_rate
+               decim  = gru.lcm(channel_rate, chan_rate)/chan_rate
+               RESAMP = blks.rational_resampler_ccf(fg, interp, decim)
+               print "Channel interpolation is", interp
+               print "Channel decimation is", decim
+               self.INPUT = RESAMP
+               
+        taps = optfir.low_pass(1.0, chan_rate, 3200, 6400, 0.1, 60)
         LPF = gr.fir_filter_fff(1, taps)
         SLICER = pager_swig.slicer_fb(.001, .00001) # Attack, decay
-       SYNC = pager_swig.flex_sync(channel_rate)
-        fg.connect(QUAD, LPF, SLICER, SYNC)
+       SYNC = pager_swig.flex_sync(chan_rate)
 
+       if channel_rate is not chan_rate:
+            fg.connect(RESAMP, QUAD, LPF, SLICER, SYNC)
+       else:
+           fg.connect(QUAD, LPF, SLICER, SYNC)
+
        DEINTA = pager_swig.flex_deinterleave()
        PARSEA = pager_swig.flex_parse(queue)
 

Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py        
2006-10-03 23:45:13 UTC (rev 3702)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py        
2006-10-04 01:43:47 UTC (rev 3703)
@@ -76,14 +76,14 @@
 
         USRP = usrp_source_c(self,          # Flow graph
                     options.rx_subdev_spec, # Daugherboard spec
-                   250,                    # IF decimation ratio gets 256K 
if_rate
+                   256,                    # IF decimation ratio gets 250K 
if_rate
                     options.gain,           # Receiver gain
                     options.calibration)    # Frequency offset
         USRP.tune(options.frequency)
 
         if_rate = USRP.rate()
-        channel_rate = 32000                # Oversampled by 10 or 20
-        channel_decim = if_rate // channel_rate
+        channel_rate = 25000                
+        channel_decim = int(if_rate / channel_rate)
        
         CHAN_taps = optfir.low_pass(1.0,          # Filter gain
                                     if_rate,      # Sample rate
@@ -102,7 +102,7 @@
                         1.0,               # Initial gain
                         1.0)               # Maximum gain
        
-        FLEX = pager.flex_demod(self, 32000, queue)
+        FLEX = pager.flex_demod(self, 25000, queue)
 
         self.connect(USRP, CHAN, AGC, FLEX.INPUT)
        
@@ -127,9 +127,9 @@
     try:
         fg.start()
        while 1:
-           if not queue.empty_p():
-               msg = queue.delete_head_nowait() # Non-blocking read
-               print join(split(msg.to_string(), chr(128)), '|')
+           msg = queue.delete_head() # Blocking read
+           fields = split(msg.to_string(), chr(128))
+           print join(fields, '|')
 
     except KeyboardInterrupt:
         fg.stop()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]