Beispiel #1
0
#!/bin/env python

import sys
import argparse
from valon_synth import Synthesizer, SYNTH_A, SYNTH_B

parser = argparse.ArgumentParser(
    description='Get Frequency of Valon Synthesizer')
parser.add_argument('dev',
                    help='The device file of Valon, usally /dev/ttyUSBn')
opts = parser.parse_args()

syn = Synthesizer(opts.dev)
print('A: %f %d' % (syn.get_frequency(SYNTH_A), syn.get_rf_level(SYNTH_A)))
print('B: %f %d' % (syn.get_frequency(SYNTH_B), syn.get_rf_level(SYNTH_B)))
Beispiel #2
0
        else:
            print "Setting Synth B to " + str(options.freq) + " MHz"
            sync.set_frequency(SYNTH_B, int(options.freq))

    if options.reference == "external":
        sync.set_ref_select(EXT_REF)
    else:
        sync.set_ref_select(INT_REF)

    fa = sync.get_frequency(SYNTH_A)
    time.sleep(0.3)
    fb = sync.get_frequency(SYNTH_B)
    time.sleep(0.3)
    fref = sync.get_ref_select()
    time.sleep(0.3)
    la = sync.get_rf_level(SYNTH_A)
    time.sleep(0.3)
    lb = sync.get_rf_level(SYNTH_B)
    time.sleep(0.3)

    print "Channel A Output Frequency:", fa, "MHz with level", la, "dBm"
    print "Channel B Output Frequency:", fb, "MHz with level", lb, "dBm"
    if fref == 0:
        print "\nReference Input Signal set to INTERNAL\n"
    else:
        print "\nReference Input Signal set to EXTERNAL\n"

    if options.save:
        saved = sync.flash()
        if saved:
            print "\nConfiguration correctly saved!"
Beispiel #3
0
                    type=int,
                    choices=[-4, -1, 2, 5],
                    help='RF output level in dBm')
parser.add_argument('-s', '--store', action='store_true')
opts = parser.parse_args()

if _VERBOSE:
    print('Device:    ' + opts.dev)
    print('Port:      ' + opts.port)
    print('Frequency: %dMHz' % opts.freq)
    print('Out level: %ddBm' % opts.level)

if opts.port == 'A':
    synth = SYNTH_A
else:
    synth = SYNTH_B

syn = Synthesizer(opts.dev)
syn.set_frequency(synth, opts.freq)

print(syn.get_frequency(synth))

if opts.level != None:
    syn.set_rf_level(synth, opts.level)
print(syn.get_rf_level(synth))

if opts.store:
    print('Storing into flash memory ... '),
    syn.flash()
    print('Done.')