Jump to content
Sign in to follow this  
n4gix

25 KHz Tunable

Recommended Posts

Guest Patrick_Waugh

A MODULE_VAR like COM_FREQUENCY normally returns a BCD value for the frequency, less the most significant digit.For example, if the COM1 frequency is currently 118.25, then MODULE_VAR com_frequency = { COM_FREQUENCY }; lookup_var(&com_frequency); UINT32 bcd = com_frequency.var_value.d;would set bcd == 0x1825. Now, what if you enable 25 KHz tuning, by setting COM_RADIO_25_KHZ_TUNABLE true?Does this just mean the final digit can now be '2' or '7' in addition to '0' or '5', and you interpret that to me .025 MHz or .075 MHz?

Share this post


Link to post
Share on other sites

Yep.... That's precisely what you do. For my fully-featured Collins RTU (Radio Tuning Unit) I developed string-based BCD2DEC() and DEC2BCD() functions to handle this situation.As it turns out, it's actually a lot faster than using the typical bit-shifing conversion function... ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Oh? Did you profile it or eyeball that measurement? :D

Share this post


Link to post
Share on other sites

>Oh? Did you profile it or eyeball that measurement? :DI reasoned it out using logical thinking... fewer operations equals faster execution... ;)If both methods are 'translated' to assembly equivalents, the string method requires less than one-third of the operations as the bit-shifing method.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...