Jump to content

ADF Radio Help


DoyleChris80

Recommended Posts

I am working with Simconnect and Websimconnect to create a webpage to enter in the the Radio Frequency, but i have ran into a little snag.

To enter the radios in FSX the MSDN says you need to enter them as BCD hz and for XPDR just BCD. Now to display from simmconnect though Websimconnect I just tell it to display in BCD16 for the COM and BCD32 for ADF, now you can tell websimconnect to show Hz KHz MHz.

But to enter it you need the BCD hz format, I have read that it uses the BCD32 format so 1000.0 is 1000.0000. And convert it to HEX so it becomes 0x10000000.

It dosent matter what i throw at FSX though Websimconnect and simconnect it dosent set the radio right.

 

MSDN Event IDS

KEY_ADF_SET ADF_SET Sets ADF frequency (BCD Hz)

 

MSDN Simulation Variables

ADF ACTIVE FREQUENCY:index ADF frequency. Index of 1 or 2. Frequency ADF BCD32

 

Using a converter and what Websimconnect shows me for BCD32 0100.0 = 16777216 BCD32 = 1000000 HEX.

Link to comment
Share on other sites

Example

ADF in FSX 1234.5

BCD = 0001 0010 0011 0100 0101 0000 0000 0000

HEX = 0x12345000

 

Websimconnect->Simconnect->FSX

Entered # = FSX Displays in Radio

1234.5000 = 532.5

12345000 = 3300.2 changes first digit each time Button is pressed.

0x12345000 = Same as Above

BCD Format = Same as Above

Link to comment
Share on other sites

Chris, this should have been posted in the "Panel & Gauge Design" forum...

https://www.flightsim.com/vbfs/forumdisplay.php?24-Panel-amp-Gauge-Design

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Moved! ...Don

HAF 932 Adv, PC P&C 950w, ASUS R4E,i7-3820 5.0GHz(MCR320-XP 6 fans wet), GTX 970 FTW

16GB DDR3-2400, 128GB SAMSUNG 830(Win 7 Ult x64), 512GB SAMSUNG 840 Pro(FSX P3D FS9)

WD 1TB Black(FS98, CFS2&3, ROF, etc.), WD 2TB Black-(Storage/Backup)

Active Sky Next, Rex4 TD/Soft Clouds

Link to comment
Share on other sites

Thanks Don. I'm so used to my "Global Moderator" abilities at AVSIM where I can do pretty much anything that's required, that I sometimes feel like I'm wearing a straight-jacket here... ;)

 

In any case, While I don't have the exact answer to the C equivalent, here is a snippet of XML script that shows how the ADF frequency may be converted from decimal to BCD format:

 

[size=2][color=#0000ff][size=2][color=#0000ff]  [/color][/size][/color][/size][size=2][color=#0000ff][size=2][color=#0000ff]
[/color][/size][/color][/size][size=2]    10000 * s0 10 %
   s2 l0 10 / flr 10 % 16 * l2 +
   s2 l0 100 / flr 10 % 256 * l2 + 
   s2 l0 1000 / flr 10 % 4096 * l2 +    
   s2 l0 10000 / flr 10 % 65536 * l2 +
   s2 l0 100000 / flr 10 % 1048576 * l2 +
   s2 l0 1000000 / flr 10 % 16777216 * l2 +
   s2 l0 10000000 / flr 10 % 268435456 * l2 +
   s2
[/size][size=2][color=#0000ff][size=2][color=#0000ff]  
[/color][/size][/color][/size] 
[size=2][color=#0000ff][size=2][color=#008000][size=2][color=#008000]    [/color][/size][/color][/size]
[size=2]    281.0 @ADF (>K:ADF_COMPLETE_SET)
[/size][/color][/size]

Note that the decimal value of the ADF frequency is being 'passed' to the @Macro

 

The first thing the @Macro does is to multiply the decimal value by 10,000 then store the result in s0 (register 0), then modulo 10 on the result, which is then stored in s2 (register 2).

 

The rest of the operations simply takes the modulo 10 for each successive digit stored in s0 and calculates the hex equivalent, and increments the s2 register with the cummulative results.

 

The last @Macro operation returns the final result stored the s2 register from the called 'function', which in turn passes it to the command (>K:ADF_COMPLETE_SET)

 

While @Macros aren't really "functions", for purposes of simplicity, we can treat them as though they were.

 

 

 

 

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...