XML: Set ADF Frequency: Difference between revisions
From FSDeveloper Wiki
Jump to navigationJump to search
mNo edit summary |
No edit summary |
||
| Line 31: | Line 31: | ||
Usage: | Usage: | ||
@SetADF((L:ADF1 Frequency,Khz)) | @SetADF((L:ADF1 Frequency,Khz)) | ||
'''Alternatively, simply 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) | |||
will do the trick. | |||
[[category:Aircraft Design]] | [[category:Aircraft Design]] | ||
[[category:Panel and Gauge Design]] | [[category:Panel and Gauge Design]] | ||
Revision as of 00:42, 19 June 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))
Alternatively, simply 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)
will do the trick.