Sign in to follow this  
Guest pscarratt

COM/NAV Frequencies

Recommended Posts

Hi,I am a bit confused re this frequency conversion business.I read in the XML FAQ Arne's entry where he explains a conversion process but he lost me when he says 'decimal 2345 leads to hex 0x2345 which equals 9029 decimal'?!2345 decimal = 929 in hex? and isn't BCD Binary coded decimal I.e. using memory bytes to record a decimal number so 10 decimal would be stored as 00000001 00000000 rather than 00001010If someone could explain to me what it is I am trying to achieve it would be much appreciated! At the moment I am lost!!Many thanks,PaulPS Panelshttp://www.pspanels.co.uk

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Paul,Yes, it is a bit criptic, isn't it ?? :-)I guess every starter has a problem with that..The example:Decimal frequency 2345 is written in BCD/binary as:0010 0011 0100 0101 (2 3 4 5)Which is 9029 decimal ..See ??Other example:ADF frequency 200.5 is written in BCD/binary as:0010 0000 0000 0101 (2 0 0 5, the decimal point is implicit for FS)Which gives decimal value 8197 to be written.Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites

Hi Rob I think i'm starting to twig! Just one more question -So to set 2345 into com1 for example, I would have to use 9029 (>K:COM_RADIO_SET)Hence all the mutliplication etc that Arne showed in the original article - Is that correct?Thanks,Paul.PS Panelshttp://www.pspanels.co.uk

Share this post


Link to post
Share on other sites

Yes.What Arne's calculation does:Target COM freq. = 123.45- Drop the 100dreds; 23.45- Multiply by 100: 2345- 2345 = (0010 0011 0100 0101) BCD = 9029 decimalso: 9029 (>K:COM_RADIO_SET) sets COM1 to 123.45The arithmatic (in this case using the stack) is exactly what the Windows Calculator does when convertion binary to decimal :-)Of course you only need the calculation in XML if the frequency you want to enter is a variable itself (ie. a variable with value 123.45)If you just want to set a fixed (known) frequency you can do the calculation manually (like with WIndows Calculator, like I just did).An example for the ADF:Suppose you want to set the ADF to 1236.4 Khz1. 50020 (>K:ADF_LOWRANGE_SET)Binary: 1100 0011 0110 0100 equals 50020 Decimal.(note that the "12" is one BCD digit).2. But since that wouldn't allow values > 1599.9, so for ADF freq. > 1000.0 it's better to use:9060 (>K:ADF_HIGHRANGE_SET)- Remove 1000s, so target becomes 236.4Binary: 0010 0011 0110 0100 equals 9060 Decimal.3. But the simplest way:305545216 (>K:ADF_COMPLETE_SET)- Multiply the target by 10000, so target becomes 12364000Binary: 0001 0010 0011 0110 0100 0000 0000 0000 equals 305545216 Decimal.Don't ask me why MS made it so complicated :-)Cheers, Rob

Share this post


Link to post
Share on other sites

You're welcome, PaulCheers, RobPS: just peeked at your website.Some great-looking panels you're working on !!!

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