[amsat-bb] Re: Programming question - frequency units

Anthony Monteiro aa2tx at comcast.net
Wed Dec 16 05:00:01 PST 2009

Hi Phil,

InstantTune used Hertz and DOUBLE for the configuration
info and the frequency calculations. That way there is
effectively no limits to precision or frequency range.
You get 52 bits for the mantissa in a DOUBLE.

For the actual radio drivers, it used LONG internally for
the frequencies in Hertz. This was done to conserve cpu since
it was meant to run as a DOS TSR on 16 MHz '386 class machines
with no floating point processor.

Given today's PCs, why bother with integers? Hertz and DOUBLE
is simple and there is no cpu issue anymore.

In any case, best of luck with your project,

Tony AA2TX


At 02:49 AM 12/16/2009, Phil wrote:
>Thank you for reading this.
>After a five year rest from the satellites I may soon be in a 
>position to once
>again resume one of my favourite hobbies. So, over the past couple of
>months I have been updating my tracking programme. In the process I have
>discovered that I need to make a design change.
>Originally the whole programme used Hertz as the frequency unit until
>AO-40 came along and the numbers became too large for the int variables.
>It wasn't too difficult, at the time, to change to long variables but I found
>the long strings of numbers confusing especially in the 
>configuration file. So
>then I experimented with double variables in Kilohertz. Around the same
>time AO-40 died and a lifestyle change ended my access to all satellites as
>I've rewritten the configuration class and modelled it around Erich
>Eichmann's sqf Doppler file which has made selecting satellites with multiple
>modes neater. This is where the design decision comes in.
>The main class now uses Kilohertz as the frequency unit while the radio
>class still uses Hertz. The main class is responsible for the conversion each
>way but confusion reigns supreme because some variables are in Hertz and
>others in Kilohertz. This is currently causing me a problem where I'm
>modifying the code that takes care of calculating a new uplink frequency
>when the receiver VFO dial is moved.
>It seems to me that the best idea is to rewrite the radio class so that it
>accepts double type Kilohertz parameters. This introduces minor frequency
>errors of a few Hertz due to rounding errors but I don't think that is a
>problem since my FT-847 only has a ten Hertz resolution anyway.
>Alternatively, I could convert the double frequencies in the configuration
>class to longs and use long variables in all other classes. This 
>will now be a
>more difficult and error prone task to undertake.
>To answer my own question, I think working in Kilohertz might be the best
>option but I'd still like to know how others have handled frequency units.
>Sent via AMSAT-BB at amsat.org. Opinions expressed are those of the author.
>Not an AMSAT-NA member? Join now to support the amateur satellite program!
>Subscription settings: http://amsat.org/mailman/listinfo/amsat-bb

More information about the AMSAT-BB mailing list