Hallo,
hier ein Beispiel aus dem OpenCockpits Forum von Nico
http://home.planet.nl/~nwkaan/:
------------------------------
// VOR with 1 Rotary and Pushbutton to change MHz and kHz
// Forum: SIOC Examples
// Title display card II
// Date: 21.9.2006
// Luis,
// Here is an example of controlling a VOR frequency with one rotary with push button:
Var 1, Link IOCARD_SW, Input 35, Type P
{
&VORLH = CHANGEBITN 0, &VORLH // Toggle
}
Var 2, name VORLH
Var 3, name RO_VORFRQ, Link IOCARD_ENCODER, Input 31, Aceleration 1, Type 2
{
IF &VORLH = 1
{
L0 = &RO_VORFRQ
&VORFreqHigh = ROTATE 8, 35, L0
}
ELSE
{
L0 = &RO_VORFRQ * 5
&VORFreqLow = ROTATE 0, 99, L0
}
}
Var 4, name VORFreqLow
{
CALL &OutVORFreq
}
Var 5, name VORFreqHigh
{
CALL &OutVORFreq
}
Var 6, name OutVORFreq, Link SUBRUTINE
{
L0 = &VORFreqHigh * 100 // high
L0 = L0 + &VORFreqLow // + low
L1 = TOBCD L0
&D_VORFreq = L0 + 10000 // to display + fixed '1'
}
Var 7, name D_VORFreq, Link IOCARD_DISPLAY, Digit 0, Numbers 5
// Have fun!
// Nico