XML: Set ADF Frequency: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox-Applicable-FSVersion
{{Infobox-Applicable-FSVersion
| P3D2 = true
| P3D = true
| FSXI = false
| FSXI = false
| FSXA = true
| FSXA = true
Line 7: Line 9:
| FS2000 = unknown
| FS2000 = unknown
| FS98 = unknown
| FS98 = unknown
| XP10 = unknown
| XP9 = unknown
}}
}}


Line 33: Line 37:




'''Alternatively, simply let FS handle the Units conversion:'''
'''An alternative is to let FS handle the Units conversion:'''


Suppose you want to tune the ADF to 379 kHz, then:
Suppose you want to tune the ADF to 379 kHz, then:
Line 39: Line 43:
  379 (>L:ADF_Freq, khz)
  379 (>L:ADF_Freq, khz)
  (L:ADF_Freq, Frequency ADF BCD32) (>K:ADF_COMPLETE_SET)
  (L:ADF_Freq, Frequency ADF BCD32) (>K:ADF_COMPLETE_SET)
will do the trick.


[[category:Aircraft Design]]
[[category:Aircraft Design]]
[[category:Panel and Gauge Design]]
[[category:Panel and Gauge Design]]

Latest revision as of 05:36, 22 August 2014

XML: Set ADF Frequency

We need to convert the desired ADF Frequency (KHz) to BCD format. This simple @Macro will do the job painlessly for us.

Note the use of lower case L in l0 and l2, this is not a number 1:

e.g., s2 l0 10 / flr 10 % 16 * l2 +

<Macro Name="SetADF">
       (* UPDATE ADF FREQUENCY *)
       @1 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 (>K:ADF_COMPLETE_SET)
</Macro>

Usage:

@SetADF((L:ADF1 Frequency,Khz))


An alternative is to let FS handle the Units conversion:

Suppose you want to tune the ADF to 379 kHz, then:

379 (>L:ADF_Freq, khz)
(L:ADF_Freq, Frequency ADF BCD32) (>K:ADF_COMPLETE_SET)