PDA

View Full Version : SIOC code for ADF1 (any aircraft)



kiek
10-27-2007, 08:23 AM
Hi,
Here an updated version of my SIOC script for ADF1, based on generic FSUIPC offsets. I think that most aircraft will support this.

ADF2 source and a script supporting ADF1 and ADF2 based on one hardware ADF radio, are available for download at my site www.nicokaan.nl (http://www.nicokaan.nl)

Cheers,
Nico

//////////////////////////////////////////////////////////////////
// ADF1
//
// SIOC 3.4 code for generic FSUIPC offsets
//
// Version 1.0
// Oct 27 2007
//
// Nico Kaan
// The Netherlands
// www.nicokaan.nl
// email: flightsim@nicokaan.nl (flightsim@nicokaan.nl)
//
// IMPLEMENTS:
// * a 4 digit freq display with decimal point control (xyz.d)
// * a single rotary controlling the higher two digits
// * a single rotary controlling the lower two digits
// (or one dual rotary for both)
//
// CHANGE LOG:
//
// 1.0 First Release


Var 8700 name X_ADF1High Link FSUIPC_INOUT Offset $034C Length 2
{
L0 = FROMBCD &X_ADF1High
IF &ADF1High <> L0 // block values coming from rotary
{
&ADF1High = L0
&ADF1HighR = DIV &ADF1High 10
CALL &CalcADF1LowR
CALL &CalcADF1Freq
}
}

Var 8701 name X_ADF1Low Link FSUIPC_INOUT Offset $0356 Length 2
{
IF &X_ADF1Low <> &ADF1Low // block values coming from rotary
{
&ADF1Low = &X_ADF1Low
CALL &CalcADF1LowR
CALL &CalcADF1Freq
}
}

Var 8710 name ADF1High // FSUIPC ADF value high: 3 digits
Var 8711 name ADF1Low // FSUIPC ADF value: 1 digit
var 8712 name ADF1Freq // total (needed for display): 4 digits

var 8713 name CalcADF1Freq Link Subrutine
{
L0 = &ADF1High * 10 // high * 10
&ADF1Freq = L0 + &ADF1Low // + decimal
CALL &OutADF1
}

Var 8720 name OutADF1 Link SUBRUTINE
{
&D_ADF1 = &ADF1Freq
&O_ADF1DP = 1
}

Var 8740 name ADF1HighR // higher TWO digits controlled by rotarie
Var 8741 name ADF1LowR // lower TWO digits controlled by rotarie

var 8742 name CalcADF1LowR Link Subrutine
{
L0 = MOD &ADF1High 10
L0 = L0 * 10
&ADF1LowR = L0 + &ADF1Low
}

var 8743 name CalcADF1High Link Subrutine
{
L0 = DIV &ADF1LowR 10
L1 = &ADF1HighR * 10
&ADF1High = L0 + L1
}

Var 8744 name RO_ADF1High Link IOCARD_ENCODER Device 1 Input 68 Aceleration 4 Type 2
{
// controls the higher TWO digits

L0 = &RO_ADF1High * -1 // change direction
&ADF1HighR = ROTATE 20 99 L0

CALL &CalcADF1High
CALL &CalcADF1Freq

&X_ADF1High = TOBCD &ADF1High // higher 3 Digits in bcd to fsuipc
}

Var 8745 name RO_ADF1Low Link IOCARD_ENCODER Device 1 Input 70 Aceleration 4 Type 2
{
// controls the lower TWO digits

L0 = &RO_ADF1Low * 5 // in steps of 5
&ADF1LowR = ROTATE 0 99 L0

&ADF1Low = MOD &ADF1LowR 10
CALL &CalcADF1High
CALL &CalcADF1Freq

&X_ADF1Low = &ADF1Low // decimal digit to fsuipc
&X_ADF1High = TOBCD &ADF1High // higher 3 Digits in bcd to fsuipc
}

Var 8770 name D_ADF1 Link IOCARD_DISPLAY Device 1 Digit 16 Numbers 4
Var 8780 name O_ADF1DP Link IOCARD_OUT Device 1 Output 95