From 789b0ad2d10a5274af798c3a1c45f8ee5a27eedc Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 12 Dec 2020 16:10:12 +0100 Subject: Move to 6MHz IF --- freqplan.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'freqplan.py') diff --git a/freqplan.py b/freqplan.py index 9272c41..e01e6e5 100644 --- a/freqplan.py +++ b/freqplan.py @@ -1,39 +1,37 @@ #!/usr/bin/env python3 # -# OUTDATED -# This document is outdated because the VHF LO is not generated -# externally from fractions import Fraction from math import floor xtal = 25 +PLLa_mult = 35 print() -print("# 116MHz and 4.915 MHz on PLLa") +print("# 6000.694 - 2.200 kHz on PLLa") -PLLa = xtal * 32 -print(f"PLLa = xtal * 32 = {PLLa} MHz") +PLLa = xtal * PLLa_mult +print(f"PLLa = xtal * {PLLa_mult} = {PLLa} MHz") + +if PLLa < 600 or PLLa > 900: + print(f"Error PLL {PLLA} out of bounds") # x/y = a + b/y # a = floor(x/y) # b = x - (a * y) -f1 = 116 -a = floor(PLLa / f1) -b = PLLa - (a * f1) -div1 = Fraction(b, f1) -print(f"CLK1: f1 = PLLa / ({a} + {div1.numerator} / {div1.denominator}) = {f1}") - -f2 = 4.91521 +f2 = (6000.694 - 2.200) / 1000 a = floor(PLLa / f2) b = PLLa - (a * f2) div1 = Fraction(round(b * 10000), round(f2 * 10000)) print(f"CLK2: f2 = PLLa / ({a} + {div1.numerator} / {div1.denominator}) = {f2}") +VHF_LO = 114.285 # Fixed XTAL +BAND_EDGE_LOW = 144 - VHF_LO +BAND_EDGE_HIGH = 145 - VHF_LO print() -print("# VFO between 23 and 25 MHz on PLLb") +print(f"# VFO between {BAND_EDGE_LOW:6.6} and {BAND_EDGE_HIGH:6.6} MHz on PLLb") def calculate(frequency): divider = floor(900000000 / frequency) # Calculate the division ratio. 900,000,000 is the maximum internal -- cgit v1.2.3