XML: Set ADF Frequency: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 37: 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 (379000 Hz), then:
Suppose you want to tune the ADF to 379 kHz, then:


  379000 (>L:ADF_Freq, hz)
  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)