aboutsummaryrefslogtreecommitdiffstats
path: root/freqplan.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-12-12 16:10:12 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-12-12 16:10:12 +0100
commit789b0ad2d10a5274af798c3a1c45f8ee5a27eedc (patch)
tree64ab0043bbaef968c5974f715c1d376b88ed934d /freqplan.py
parent341400d0d35efe01f5e0b8737e23cbec6b973986 (diff)
downloadpicardy-789b0ad2d10a5274af798c3a1c45f8ee5a27eedc.tar.gz
picardy-789b0ad2d10a5274af798c3a1c45f8ee5a27eedc.tar.bz2
picardy-789b0ad2d10a5274af798c3a1c45f8ee5a27eedc.zip
Move to 6MHz IF
Diffstat (limited to 'freqplan.py')
-rw-r--r--freqplan.py26
1 files changed, 12 insertions, 14 deletions
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