示例#1
0
def main ():
    parser = OptionParser (option_class=eng_option)
    parser.add_option ("-g", "--gain", type="eng_float", default=-1,
                       help="set front end gain to GAIN [0,1000]")
    parser.add_option ("-f", "--freq", type="eng_float", default=-1,
                       help="set front end center frequency to FREQ")
    parser.add_option ("-t", "--type", type="string", default="4937",
                       help="select eval board type {4937 or 4702}")
    parser.add_option ("-p", "--port", type="int", default=0,
                       help="parallel port eval board is attached to")
    (options, args) = parser.parse_args ()

    if options.type == "4937":
        front_end = gr.microtune_4937_eval_board (options.port)
    elif options.type == "4702":
        front_end = gr.microtune_4702_eval_board (options.port)
    else:
        raise RuntimeError, "Invalid board type.  Must be either -t 4937 or -t 4702"

    if options.gain != -1:
        front_end.set_AGC (options.gain)

    if options.freq != -1:
        if options.freq < 1e6:
            options.freq = options.freq * 1e6

        actual = front_end.set_RF_freq (options.freq)
        print "microtune: actual freq = %s" %  (eng_notation.num_to_str (actual),)
示例#2
0
def main (args):
    nargs = len (args)
    if nargs == 1:
        freq1 = float (args[0]) * 1e6
        freq2 = None
    elif nargs == 2:
        freq1 = float (args[0]) * 1e6
        freq2 = float (args[1]) * 1e6
    else:
        sys.stderr.write ('usage: fm_demod freq1 [freq2]\n')
        sys.exit (1)

    # connect to RF front end
    rf_front_end = gr.microtune_4937_eval_board ()
    if not rf_front_end.board_present_p ():
        raise IOError, 'RF front end not found'

    # set front end gain
    rf_front_end.set_AGC (300)
    IF_freq = rf_front_end.get_output_freq ()
    IF_freq = 5.75e6

    if not freq2:      # one station

        rf_front_end.set_RF_freq (freq1)
        fg = build_graph (IF_freq, None)

    else:              # two stations

        if abs (freq1 - freq2) > 5.5e6:
            raise IOError, 'freqs too far apart'

        target_freq = (freq1 + freq2) / 2
        actual_freq = rf_front_end.set_RF_freq (target_freq)
        #actual_freq = target_freq

        fg = build_graph (IF_freq + freq1 - actual_freq,
                          IF_freq + freq2 - actual_freq)

    fg.start ()        # fork thread(s) and return
    raw_input ('Press Enter to quit: ')
    fg.stop ()
示例#3
0
def main(args):
    nargs = len(args)
    if nargs == 1:
        freq1 = float(args[0]) * 1e6
        freq2 = None
    elif nargs == 2:
        freq1 = float(args[0]) * 1e6
        freq2 = float(args[1]) * 1e6
    else:
        sys.stderr.write('usage: fm_demod freq1 [freq2]\n')
        sys.exit(1)

    # connect to RF front end
    rf_front_end = gr.microtune_4937_eval_board()
    if not rf_front_end.board_present_p():
        raise IOError, 'RF front end not found'

    # set front end gain
    rf_front_end.set_AGC(300)
    IF_freq = rf_front_end.get_output_freq()
    IF_freq = 5.75e6

    if not freq2:      # one station

        rf_front_end.set_RF_freq(freq1)
        fg = build_graph(IF_freq, None)

    else:              # two stations

        if abs(freq1 - freq2) > 5.5e6:
            raise IOError, 'freqs too far apart'

        target_freq = (freq1 + freq2) / 2
        actual_freq = rf_front_end.set_RF_freq(target_freq)
        #actual_freq = target_freq

        fg = build_graph(IF_freq + freq1 - actual_freq,
                         IF_freq + freq2 - actual_freq)

    fg.start()        # fork thread(s) and return
    raw_input('Press Enter to quit: ')
    fg.stop()