XML: Set ADF Frequency

From FSDeveloper Wiki
Jump to: navigation, search

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))