1. ## XPNDR Code Problem

I built my Transponder with Open Cockpits Displays and 2 rotary encoders. The high digits are working fine but the low digits stay at 00. The encoder works fine in the SIOC Monitor. Display digit numbers are correct. It must be something in my code:

Var 0251, Value 12 // High digits
{
CALL &XPNDRCALC
}

Var 0252, Value 0 // Low digits
{
CALL &XPNDRCALC
}

Var 0253, name INPXPNDRHigh, Link IOCARD_ENCODER, Input 124, Aceleration 1, Type 2 // Input High
{
L0 = &INPXPNDRHigh * 1 // -1 will change direction of rotation
V0251 = V0251 + L0
V0251 = ROTATE 0 ,77 ,L0
}

Var 0254, name INPXPNDRLow, Link IOCARD_ENCODER, Input 118, Aceleration 1, Type 2 // Input Low
{
L0 = &INPXPNDRLow * 1 // -1 will change direction of rotation
V0252 = V0252 + L0
V0252 = ROTATE 0 ,77 ,L0 // numbers will range from 0 to 77 then bac
}

Var 0255, Link IOCARD_SW, Input 63 // VFR button
{
&XPNDRDISP = 1200 // VFR Code CH 7000 USA 1200 Germany 0021
&XPNDRTOFS = TOBCD &XPNDRDISP
}

Var 0256, name XPNDRDISP, Link IOCARD_DISPLAY, Digit 123, Numbers 4 // Display
{
L0 = &XPNDRDISP
}

Var 0257, name XPNDRTOFS, Link FSUIPC_INOUT, Offset \$0354, Length 2 // XPNDR
{
L0 = &XPNDRDISP
}

Var 0258, name XPNDRIN, Value 7000 // XPNDR Input from FS

Var 0259, Link FSUIPC_OUT, Offset \$7B93, Length 4 // IDT button for Squawkbox

Var 0260, Link IOCARD_SW, Input 113 // IDT button
{
V0259 = V0260
}

Var 0261, name XPNDRCALC, Link SUBRUTINE // Code calculation
{
L0 = V0251 * 100
L1 = V0252 + L0
&XPNDRTOFS = TOBCD L0
&XPNDRDISP = L0
}

This is what happens in the IOCPConsole when I rotate the High Digits, then the Low Digits:

HIGH DIGITS

253=1 - INPXPNDRHigh
251=11 - High digits
257=4352 - XPNDRTOFS
256=1100 - XPNDRDISP
251=12 - High digits
257=4608 - XPNDRTOFS
256=1200 - XPNDRDISP
253=0 - INPXPNDRHigh

251=13 - High digits
257=4864 - XPNDRTOFS
256=1300 - XPNDRDISP
251=14 - High digits
257=5120 - XPNDRTOFS
256=1400 - XPNDRDISP
253=0 - INPXPNDRHigh

253=1 - INPXPNDRHigh
251=15 - High digits
257=5376 - XPNDRTOFS
256=1500 - XPNDRDISP
251=16 - High digits
257=5632 - XPNDRTOFS
256=1600 - XPNDRDISP
253=0 - INPXPNDRHigh

253=1 - INPXPNDRHigh
251=17 - High digits
257=5888 - XPNDRTOFS
256=1700 - XPNDRDISP
251=18 - High digits
257=6144 - XPNDRTOFS
256=1800 - XPNDRDISP
253=0 - INPXPNDRHigh
257=4096 - XPNDRTOFS

LOW DIGITS

254=1 - INPXPNDRLow
252=75 - Low digits
252=76 - Low digits
254=0 - INPXPNDRLow

254=1 - INPXPNDRLow
252=77 - Low digits
252=0 - Low digits
254=0 - INPXPNDRLow

254=1 - INPXPNDRLow
252=1 - Low digits
252=2 - Low digits
254=0 - INPXPNDRLow

254=1 - INPXPNDRLow
252=3 - Low digits
252=4 - Low digits
254=0 - INPXPNDRLow

It doesn't seem to be sending the Low Digits to FS. Am I using the wrong code for a two encoder XPNDR?

Jerry

2. ## Re: XPNDR Code Problem

Hi Jerry,
I am also using the OC transponder with Prosim and have it working perfectly. I know very little of SIOC but my mate Ken programmed it for me. The left encoder changes the first two digits and the right encoder changes the second pair. Also the TA/RA rotary switch is working correctly. I will get my .ini file text and post it here tomorrow or Wednesday. You might be able to extract the relevant code!

Cheers Gwyn

3. ## Re: XPNDR Code Problem

Jerry

If you step through your code and the monitor log, you will see that the XPNDRCALC sub routine does not include the value of the low digits before calling the &XPNDRDISP function,

You need to add the low digits value within the
XPNDRCALC sub routine.

Change the line
&XPNDRDISP = L0 to &XPNDRDISP = L1

There may be other errors as I have not exhaustively checked the code

David

4. ## Re: XPNDR Code Problem

Hi guys, hope your quick fix works Dave!

Here is the code that has all my OC radios working great with Prosim...

// ****************
// Date: 19/03/2012
// ****************

// *****************
// Start Transponder
// *****************

Var 7100, name fs_atc, Link FSUIPC_OUT Offset \$0354 Length 2 // SetATC

Var 7101 name XPDRFreqLow Value 00
Var 7102 name XPDRFreqHigh value 12
Var 7103 name XPDRFreq Value 1200

Var 7104, Value 0 // INIT
{
&atc_dsp = 1200
&fs_atc = 4608
&ATC_DIS_ATC = 1
if &I_XPNDR = 0
{
&ATC_DIS_1 = 1
&ATC_DIS_2 = 0
}
}

Var 7105, name ATC_E_RIGHT, Link IOCARD_ENCODER, device 10, Input 10, Aceleration 1, Type 2
{
L0 = &ATC_E_RIGHT * -1
&XPDRFreqLow = ROTATE 0 77 L0
CALL &CalcXPDRFreqL L0
}

Var 7106, name ATC_E_LEFT, Link IOCARD_ENCODER, device 10, Input 5, Aceleration 1, Type 2
{
L0 = &ATC_E_LEFT * -1
&XPDRFreqHigh = ROTATE 0 77 L0
CALL &CalcXPDRFreqH L0
}

Var 7107 name OutXPDRFreq Link SUBRUTINE
{
L0 = TOBCD &XPDRFreq
// &fs_atc = L0
&atc_dsp = &XPDRFreq
}

Var 7108 name CalcXPDRFreqL Link SUBRUTINE
{
L0 = &XPDRFreqLow
L2 = DIV L0 10
L1 = MOD L0 10
IF L1 = 8
{
IF &CalcXpdrFreqL > 0
{
L2 = L2 + 1
L1 = 0
}
ELSE
{
L1 = 6
}
}
ELSE
{
IF L1 = 9
{
IF &CalcXpdrFreqL > 0
{
L2 = L2 + 1
L1 = 1
}
ELSE
{
L1 = 7
}
}
}
L0 = L2 * 10
&XPDRFreqLow = L0 + L1

L2 = &XPDRFreqHigh * 100
L1 = &XPDRFreqLow
&XPDRFreq = L1 + L2
CALL &OutXPDRFreq
}

Var 7109 name CalcXPDRFreqH Link SUBRUTINE
{
L0 = &XPDRFreqHigh
L2 = DIV L0 10
L1 = MOD L0 10
IF L1 = 8
{
IF &CalcXpdrFreqH > 0
{
L2 = L2 + 1
L1 = 0
}
ELSE
{
L1 = 6
}
}
ELSE
{
IF L1 = 9
{
IF &CalcXpdrFreqH > 0
{
L2 = L2 + 1
L1 = 1
}
ELSE
{
L1 = 7
}
}
}
L0 = L2 * 10
&XPDRFreqHigh = L0 + L1

L2 = &XPDRFreqHigh * 100
L1 = &XPDRFreqLow
&XPDRFreq = L1 + L2
CALL &OutXPDRFreq
}

var 7110, name atc_act
{
if &atc_act <> &atc_dsp
{
&atc_dsp = &atc_act
}
}

Var 7111, name atc_dsp, Link IOCARD_DISPLAY, device 10, Digit 0, Numbers 4
Var 7112, name ATC_D_FAIL, Link IOCARD_DISPLAY, device 10, Digit 4, Numbers 1
Var 7113, name ATC_DIS_ATC, Link IOCARD_OUT, device 10, Output 20
Var 7114, name ATC_DIS_1, Link IOCARD_OUT, device 10, Output 21
Var 7115, name ATC_DIS_2, Link IOCARD_OUT, device 10, Output 22
Var 7116, name ATC_LED_FAIL, Link IOCARD_OUT, device 10, Output 23

Var 7117, name I_XPNDR, Link IOCARD_SW, device 10, Input 7
{
if &I_XPNDR = 0
{
&ATC_DIS_1 = 1
&ATC_DIS_2 = 0
}
ELSE
{
&ATC_DIS_1 = 0
&ATC_DIS_2 = 1
}
}

Var 7118, name I_ALTSRC, Link IOCARD_SW, device 10, Input 9
{
if &I_ALTSRC = 1
{
&atc_dsp = 8888
&ATC_D_FAIL = -999997
&ATC_LED_FAIL = 1
&ATC_DIS_ATC = 1
&ATC_DIS_1 = 1
&ATC_DIS_2 = 1
}
ELSE
{
&atc_dsp = &atc_act
&ATC_D_FAIL = -999999
&ATC_LED_FAIL = 0
&ATC_DIS_ATC = 1
if &I_XPNDR = 0
{
&ATC_DIS_1 = 1
&ATC_DIS_2 = 0
}
else
{
&ATC_DIS_1 = 0
&ATC_DIS_2 = 1
}
CALL &OutXPDRFreq
}
}

Var 7119, name I_R_STB, Link IOCARD_SW, device 10, Input 0
Var 7120, name I_R_ALT, Link IOCARD_SW, device 10, Input 1
Var 7121, name I_R_XPN, Link IOCARD_SW, device 10, Input 2
Var 7122, name I_R_TAO, Link IOCARD_SW, device 10, Input 3
Var 7123, name I_R_TAR, Link IOCARD_SW, device 10, Input 4

Var 7124, name I_IDENT, Link IOCARD_SW, device 10, Input 12
{
if &I_IDENT = 1
{
&sb3_ident = 1
}
else
{
&sb3_ident = 0
}
}

Var 7125, name sb3_ident, LINK FSUIPC_INOUT, Offset \$7b93, Length 1 // Squawkbox Ident push
{
if &sb3_ident = 1
{
&ATC_LED_FAIL = 1
}
else
{
&ATC_LED_FAIL = 0
}
}

Var 7126, name sb_connect, LINK FSUIPC_INOUT, Offset \$7b81, Length 1 // Squawkbox connected
{
if &sb_connect = 1
{
&ATC_DIS_2 = 1
}
ELSE
{
&ATC_DIS_2 = 0
}
}

// ***************
// End Transponder
// ***************

// **********
// Start NAV1
// **********

var 7200,value 0
{
&nav1_ent = 108
&nav1_dec = 0
&nav1_act = 10800
}

var 7201, name nav1_ent

var 7202, name nav1_dec

var 7203, name nav1_dec_enc, link IOCARD_ENCODER, input 4, type 2, aceleration 1, device 7
{
l0 = &nav1_dec_enc * 50
l1 = &nav1_dec + l0
if l1 < 0
{
l1 = 950
}
if l1 > 950
{
l1 = 0
}
&nav1_dec = l1
call &sub_d_nav1
}

var 7204, name nav1_ent_enc, link IOCARD_ENCODER, input 0, type 2, aceleration 1, device 7
{
l0 = &nav1_ent_enc * -1
&nav1_ent = rotate 108,117,l0
call &sub_d_nav1
}

var 7205, name nav1_id,link IOCARD_DISPLAY, digit 5, numbers 5, device 7

var 7206, name sub_d_nav1, link SUBRUTINE
{
l0 = &nav1_ent * 100
l1 = div &nav1_dec 10
&nav1_id = l0 + l1
}

var 7207, name nav1_act_pt, link IOCARD_OUT, output 20, device 7
var 7208, name nav1_stb_pt, link IOCARD_OUT, output 21, device 7

var 7209, name nav1_tfr_sw, link IOCARD_SW, input 6, device 7
{
if &nav1_tfr_sw = 1
{
l0 = &nav1_ent * 100
l1 = div &nav1_dec 10
l0 = l0 + l1
l1 = div &nav1_act 100
l2 = mod &nav1_act 100
&nav1_act = l0
&nav1_ent = l1
l0 = mod l2 10
l2 = l2 * 10
if l0 > 0
{
l2 = l2 + 5
}
&nav1_dec = l2
call &sub_d_nav1
&nav1_id2 = &nav1_act
}
}

var 7210, name nav1_test_sw, link IOCARD_SW, input 2, device 7
{
if &nav1_test_sw = 1
{
&nav1_id = 88888
&nav1_id2 = 88888
}
else
{
CALL &sub_d_nav1
&nav1_id2 = &nav1_act_pro
}
}

var 7211, name nav1_act

var 7212, name nav1_id2,link IOCARD_DISPLAY, digit 0, numbers 5, device 7
{
if &nav1_id2 > 0
{
&xp_nav1 = &nav1_id2
}
}

var 7213, name xp_nav1, value 10800
{
l0 = &xp_nav1 - 10000
&fnav1 = tobcd l0
}

var 7214, name nav1_act_pro
{
if &nav1_id <> &nav1_act_pro
{
&nav1_id2 = &nav1_act_pro
&nav1_act = &nav1_act_pro
}
}

Var 7215, Link FSUIPC_OUT, name fnav1, Offset \$0350, Length 2 // NAV1 Active

// ********
// End NAV1
// ********

// **********
// Start NAV2
// **********

var 7300,value 0
{
&nav2_ent = 108
&nav2_dec = 0
&nav2_act = 10800
}

var 7301, name nav2_ent

var 7302, name nav2_dec

var 7303, name nav2_dec_enc, link IOCARD_ENCODER, input 4, type 2, aceleration 1, device 8
{
l0 = &nav2_dec_enc * 50
l1 = &nav2_dec + l0
if l1 < 0
{
l1 = 950
}
if l1 > 950
{
l1 = 0
}
&nav2_dec = l1
call &sub_d_nav2
}

var 7304, name nav2_ent_enc, link IOCARD_ENCODER, input 0, type 2, aceleration 1, device 8
{
l0 = &nav2_ent_enc * -1
&nav2_ent = rotate 108,117,l0
call &sub_d_nav2
}

var 7305, name nav2_id,link IOCARD_DISPLAY, digit 5, numbers 5, device 8

var 7306, name sub_d_nav2, link SUBRUTINE
{
l0 = &nav2_ent * 100
l1 = div &nav2_dec 10
&nav2_id = l0 + l1
}

var 7307, name nav2_act_pt, link IOCARD_OUT, output 20, device 8
var 7308, name nav2_stb_pt, link IOCARD_OUT, output 21, device 8

var 7309, name nav2_tfr_sw, link IOCARD_SW, input 6, device 8
{
if &nav2_tfr_sw = 1
{
l0 = &nav2_ent * 100
l1 = div &nav2_dec 10
l0 = l0 + l1
l1 = div &nav2_act 100
l2 = mod &nav2_act 100
&nav2_act = l0
&nav2_ent = l1
l0 = mod l2 10
l2 = l2 * 10
if l0 > 0
{
l2 = l2 + 5
}
&nav2_dec = l2
call &sub_d_nav2
&nav2_id2 = &nav2_act
}
}

var 7310, name nav2_test_sw, link IOCARD_SW, input 2, device 8
{
if &nav2_test_sw = 1
{
&nav2_id = 88888
&nav2_id2 = 88888
}
else
{
CALL &sub_d_nav2
&nav2_id2 = &nav2_act_pro
}
}

var 7311, name nav2_act

var 7312, name nav2_id2,link IOCARD_DISPLAY, digit 0, numbers 5, device 8
{
if &nav2_id2 > 0
{
&xp_nav2 = &nav2_id2
}
}

var 7313, name xp_nav2, value 10800
{
l0 = &xp_nav2 - 10000
&fnav2 = tobcd l0
}

var 7314, name nav2_act_pro
{
if &nav2_id <> &nav2_act_pro
{
&nav2_id2 = &nav2_act_pro
&nav2_act = &nav2_act_pro
}
}

Var 7315, Link FSUIPC_OUT, name fnav2, Offset \$0352, Length 2 // NAV1 Active

// ********
// End NAV2
// ********

// **********
// Start COM1
// **********

Var 7400,value 0
{
&ent_com1 = 118
&dec_com1 = 0
&act_com1 = 118000
&enc_com1 = 1

}

Var 7401, name enc_com1
{
if &enc_com1 = 1
{
&io_pt_com1 = 1
&io_pt2_com1 = 1
call &sub_d_com1
&id2_com1 = &act_com1
}
else
{
&io_pt_com1 = 0
&io_pt2_com1 = 0
&id_com1 = -999999
&id2_com1 = -999999
}
}

Var 7402, name ent_com1

Var 7403, name dec_com1

Var 7404, name ie_dec_com1, link IOCARD_ENCODER, input 4, type 2, aceleration 1, device 9
{
if &enc_com1 = 1
{
l0 = &ie_dec_com1 * 25
l1 = &dec_com1 + l0
if l1 < 0
{
l1 = 975
}
if l1 > 975
{
l1 = 0
}
&dec_com1 = l1
call &sub_d_com1
}
}

Var 7405, name ie_ent_com1, link IOCARD_ENCODER, input 0, type 2, aceleration 1, device 9
{
if &enc_com1 = 1
{
l0 = &ie_ent_com1 * -1
&ent_com1 = rotate 118,136,l0
call &sub_d_com1
}
}

Var 7406, name id_com21,link IOCARD_DISPLAY, digit 6, numbers 6, device 9
{
&stb = div &id_com1 10
}

Var 7407, name sub_d_com1, link SUBRUTINE
{
l0 = &ent_com1 * 1000
&id_com1 = l0 + &dec_com1
}

Var 7408, name io_pt_com1, link IOCARD_OUT, output 20, device 9

Var 7409, name ii_sw_com1, link IOCARD_SW, input 6, device 9
{
if &ii_sw_com1 = 1
{
if &enc_com1 = 1
{
l0 = &ent_com1 * 1000
l0 = l0 + &dec_com1
l1 = div &act_com1 1000
l2 = mod &act_com1 1000
&act_com1 = l0
&ent_com1 = l1
&dec_com1 = l2
call &sub_d_com1
&id2_com1 = &act_com1
}
}
}

Var 7410, name act_com1

Var 7411, name id2_com21,link IOCARD_DISPLAY, digit 0, numbers 6, device 9
{
if &id2_com1 > 0
{
&xp_com1 = div &id2_com1 10
}
}

Var 7412, name io_pt2_com1, link IOCARD_OUT, output 21, device 9

Var 7413, name xp_com1, value 11800

Var 7414, name stb

Var 7415, name id_com1
{
&id_com21 = &id_com1
}

Var 7416, name id2_com1
{
&id2_com21 = &id2_com1
}

Var 7417, name ii_sw_tfr, link IOCARD_SW, input 2, device 9
{
if &ii_sw_tfr = 1
{
&id_com21 = 888888
&id2_com21 = 888888
}
else
{
&id_com21 = &id_com1
&id2_com21 = &id2_com1
}
}

// ********
// End COM1
// ********

// **********
// Start COM2
// **********

Var 7500,value 0
{
&ent_com2 = 118
&dec_com2 = 0
&act_com2 = 118000
&enc_com2 = 1
}

Var 7501, name enc_com2
{
if &enc_com2 = 1
{
&io_pt_com2 = 1
&io_pt2_com2 = 1
call &sub_d_com2
&id2_com2 = &act_com2
}
else
{
&io_pt_com2 = 0
&io_pt2_com2 = 0
&id_com2 = -999999
&id2_com2 = -999999
}
}

Var 7502, name ent_com2

Var 7503, name dec_com2

Var 7504, name ie_dec_com2, link IOCARD_ENCODER, input 4, type 2, aceleration 1, device 12
{
if &enc_com2 = 1
{
l0 = &ie_dec_com2 * 25
l1 = &dec_com2 + l0
if l1 < 0
{
l1 = 975
}
if l1 > 975
{
l1 = 0
}
&dec_com2 = l1
call &sub_d_com2
}
}

Var 7505, name ie_ent_com2, link IOCARD_ENCODER, input 0, type 2, aceleration 1, device 12
{
if &enc_com2 = 1
{
l0 = &ie_ent_com2 * -1
&ent_com2 = rotate 118,136,l0
call &sub_d_com2
}
}

Var 7506, name id_com22,link IOCARD_DISPLAY, digit 6, numbers 6, device 12
{
&stb2 = div &id_com2 10
}

Var 7507, name sub_d_com2, link SUBRUTINE
{
l0 = &ent_com2 * 1000
&id_com2 = l0 + &dec_com2
}

Var 7508, name io_pt_com2, link IOCARD_OUT, output 20, device 12

Var 7509, name ii_sw_com2, link IOCARD_SW, input 6, device 12
{
if &ii_sw_com2 = 1
{
if &enc_com2 = 1
{
l0 = &ent_com2 * 1000
l0 = l0 + &dec_com2
l1 = div &act_com2 1000
l2 = mod &act_com2 1000
&act_com2 = l0
&ent_com2 = l1
&dec_com2 = l2
call &sub_d_com2
&id2_com2 = &act_com2
}
}
}

Var 7510, name act_com2

Var 7511, name id2_com22,link IOCARD_DISPLAY, digit 0, numbers 6, device 12
{
if &id2_com2 > 0
{
&xp_com2 = div &id2_com2 10
}
}

Var 7512, name io_pt2_com2, link IOCARD_OUT, output 21, device 12

Var 7513, name xp_com2, value 11800

Var 7514, name stb2

Var 7515, name id_com2
{
&id_com22 = &id_com2
}

Var 7516, name id2_com2
{
&id2_com22 = &id2_com2
}

Var 7517, name ii_sw_tfr2, link IOCARD_SW, input 2, device 12
{
if &ii_sw_tfr2 = 1
{
&id_com22 = 888888
&id2_com22 = 888888
}
else
{
&id_com22 = &id_com2
&id2_com22 = &id2_com2
}
}
// ********
// End COM2
// ********

// ****
// ****

Var 7600 Value 0
{
&A1StbLow = 5
&A1StbHigh = 385
CALL &CaA1StbFreq
}

Var 7601 name X_A1ActHigh Link FSUIPC_INOUT Offset \$034C Length 2
{
L0 = FROMBCD &X_A1ActHigh
&A1ActHigh = L0
CALL &CaA1ActFreq
}

Var 7602 name X_A1ActLow Link FSUIPC_INOUT Offset \$0356 Length 2
{
&A1ActLow = &X_A1ActLow
CALL &CaA1ActFreq
}

Var 7603 name A1ActHigh // FSUIPC active ADF1 value high: 3 digits
Var 7604 name A1ActLow // FSUIPC active ADF1 value: 1 digit
Var 7605 name A1ActFreq // total (needed for display): 4 digits

Var 7606 name A1StbHigh // FSUIPC standby ADF1 value high: 3 digits
Var 7607 name A1StbLow // FSUIPC standby ADF1 value: 1 digit
Var 7608 name A1StbFreq // total (needed for display): 4 digits

Var 7609 name CaA1ActFreq Link Subrutine
{
L0 = &A1ActHigh * 10 // high * 10
&A1ActFreq = L0 + &A1ActLow // + decimal
CALL &OutA1Act
}

Var 7610 name CaA1StbFreq Link Subrutine
{
L0 = &A1StbHigh * 10 // high * 10
&A1StbFreq = L0 + &A1StbLow // + decimal
CALL &OutA1Stb
}

Var 7611 name OutA1Act Link SUBRUTINE
{
&D_A1Act = &A1ActFreq
&O_A1ActDp = 1
}

Var 7612 name OutA1Stb Link SUBRUTINE
{
&D_A1Stb = &A1StbFreq
&O_A1StbDp = 1
}

Var 7613 name RO_A1StbHigh, Link IOCARD_ENCODER, device 11, Input 0, Aceleration 4, Type 2
{
L0 = &RO_A1StbHigh * -1 // change direction (turning right should be plus)
&A1StbHigh = ROTATE 100 999 L0
CALL &CaA1StbFreq
}

Var 7614 name RO_A1StbLow, Link IOCARD_ENCODER, device 11, Input 4, Aceleration 1, Type 2
{
L0 = &RO_A1StbLow * 1 // in steps of 5
&A1StbLow = ROTATE 0 9 L0
CALL &CaA1StbFreq
}

Var 7615 name FreqSwap1, Link IOCARD_SW, device 11, Input 6, Type P
{
L0 = &A1ActHigh
L1 = &A1ActLow

&X_A1ActLow = &A1StbLow // decimal digit to fsuipc
&X_A1ActHigh = TOBCD &A1StbHigh // higher 3 Digits in bcd to fsuipc

&A1StbHigh = L0
&A1StbLow = L1

CALL &CaA1StbFreq
}

Var 7616 name D_A1Act, Link IOCARD_DISPLAY, device 11, Digit 0, Numbers 5
Var 7617 name O_A1ActDp, Link IOCARD_OUT, device 11, Output 20

Var 7618 name D_A1Stb, Link IOCARD_DISPLAY, device 11, Digit 5, Numbers 5
Var 7619 name O_A1StbDp, Link IOCARD_OUT, device 11, Output 21

// ********
// ********

// **********
// **********

Var 7700 Value 0
{
&A2StbLow = 5
&A2StbHigh = 385
CALL &CaA2StbFreq
}

Var 7701 name X_A2ActHigh Link FSUIPC_INOUT Offset \$02D4 Length 2
{
L0 = FROMBCD &X_A2ActHigh
&A2ActHigh = L0
CALL &CaA2ActFreq
}

Var 7702 name X_A2ActLow Link FSUIPC_INOUT Offset \$02D6 Length 2
{
&A2ActLow = &X_A2ActLow
CALL &CaA2ActFreq
}

Var 7703 name A2ActHigh // FSUIPC active ADF2 value high: 3 digits
Var 7704 name A2ActLow // FSUIPC active ADF2 value: 1 digit
var 7705 name A2ActFreq // total (needed for display): 4 digits

Var 7706 name A2StbHigh // FSUIPC standby ADF2 value high: 3 digits
Var 7707 name A2StbLow // FSUIPC standby ADF2 value: 1 digit
var 7708 name A2StbFreq // total (needed for display): 4 digits

var 7709 name CaA2ActFreq Link Subrutine
{
L0 = &A2ActHigh * 10 // high * 10
&A2ActFreq = L0 + &A2ActLow // + decimal
CALL &OutA2Act
}

var 7710 name CaA2StbFreq Link Subrutine
{
L0 = &A2StbHigh * 10 // high * 10
&A2StbFreq = L0 + &A2StbLow // + decimal
CALL &OutA2Stb
}

Var 7711 name OutA2Act Link SUBRUTINE
{
&D_A2Act = &A2ActFreq
&O_A2ActDp = 1
}

Var 7712 name OutA2Stb Link SUBRUTINE
{
&D_A2Stb = &A2StbFreq
&O_A2StbDp = 1
}

Var 7713 name RO_A2StbHigh, Link IOCARD_ENCODER, Device 13, Input 0, Aceleration 4, Type 2
{
L0 = &RO_A2StbHigh * -1 // change direction (turning right should be plus)
&A2StbHigh = ROTATE 100 999 L0
CALL &CaA2StbFreq
}

Var 7714 name RO_A2StbLow, Link IOCARD_ENCODER, Device 13, Input 4, Aceleration 1, Type 2
{
L0 = &RO_A2StbLow * 1 // in steps of 5
&A2StbLow = ROTATE 0 9 L0
CALL &CaA2StbFreq
}

var 7715 name FreqSwap2, Link IOCARD_SW, Device 13, Input 6, Type P
{
L0 = &A2ActHigh
L1 = &A2ActLow

&X_A2ActLow = &A2StbLow // decimal digit to fsuipc
&X_A2ActHigh = TOBCD &A2StbHigh // higher 3 Digits in bcd to fsuipc

&A2StbHigh = L0
&A2StbLow = L1

CALL &CaA2StbFreq
}

Var 7716 name D_A2Act, Link IOCARD_DISPLAY, Device 13, Digit 0, Numbers 5
Var 7717 name O_A2ActDp, Link IOCARD_OUT, Device 13, Output 20

Var 7718 name D_A2Stb, Link IOCARD_DISPLAY, Device 13, Digit 5, Numbers 5
Var 7719 name O_A2StbDp, Link IOCARD_OUT, Device 13, Output 21

// ********
// ********

// ***************
// ***************

Var 9999 // Configure this variable in ProSim Configuration-Numerical-Volt BattBus field
{
IF V9999 = 0
{
&nav1_id = -999999
&nav1_id2 = -999999
&nav1_act_pt = 0
&nav1_stb_pt = 0
&nav2_id = -999999
&nav2_id2 = -999999
&nav2_act_pt = 0
&nav2_stb_pt = 0
&id_com21 = -999999
&id2_com21 = -999999
&io_pt_com1 = 0
&io_pt2_com1 = 0
&id_com22 = -999999
&id2_com22 = -999999
&io_pt_com2 = 0
&io_pt2_com2 = 0
&D_A1Act = -999999
&D_A1Stb = -999999
&O_A1ActDp = 0
&O_A1StbDp = 0
&D_A2Act = -999999
&D_A2Stb = -999999
&O_A2ActDp = 0
&O_A2StbDp = 0
&atc_dsp = -999999
&ATC_DIS_ATC = 0
&ATC_DIS_1 = 0
&ATC_DIS_2 = 0
}
ELSE
{
CALL &sub_d_nav1
&nav1_id2 = &nav1_act_pro
&nav1_act_pt = 1
&nav1_stb_pt = 1
CALL &sub_d_nav2
&nav2_id2 = &nav2_act_pro
&nav2_act_pt = 1
&nav2_stb_pt = 1
&id_com21 = &id_com1
&id2_com21 = &id2_com1
&io_pt_com1 = 1
&io_pt2_com1 = 1
&id_com22 = &id_com2
&id2_com22 = &id2_com2
&io_pt_com2 = 1
&io_pt2_com2 = 1
CALL V7611
CALL V7612
CALL V7711
CALL V7712
&atc_dsp = &atc_act
&ATC_DIS_ATC = 1
if &I_XPNDR = 0
{
&ATC_DIS_1 = 1
&ATC_DIS_2 = 0
}
else
{
&ATC_DIS_1 = 0
&ATC_DIS_2 = 1
}
}
}

Cheers Gwyn

5. ## Re: XPNDR Code Problem

Thanks for the input guys. It's going to be a few days before I get time to work on it again but I will let you know if I get it working right.

6. ## Re: XPNDR Code Problem

Gwyn

Copied your transponder code and inserted my inputs/outputs. Seems to be working fine but I haven't actually tried it in FSX yet. I was sick part of the weekend and didn't have enough time. Thanks for your help.

Jerry

7. ## Re: XPNDR Code Problem

Originally Posted by Jerrymc3
Gwyn

Copied your transponder code and inserted my inputs/outputs. Seems to be working fine but I haven't actually tried it in FSX yet. I was sick part of the weekend and didn't have enough time. Thanks for your help.

Jerry
I hope it goes well for you!

Cheers Gwyn

8. ## Re: XPNDR Code Problem

Never hurts to go back and try again. I tried your transponder code almost four months ago inserting my inputs but it still wouldn't show up on the FSX XPNDR so I gave up for a while. Tonight I decided to try again and I found this little problem with your code:

Var 7107 name OutXPDRFreq Link SUBRUTINE
{
L0 = TOBCD &XPDRFreq
// &fs_atc = L0
&atc_dsp = &XPDRFreqp
}

Removed the // and now it works in FS and my PM FMC. Please accept a belated Thank you Gwyn

Jerry

9. ## Re: XPNDR Code Problem

Originally Posted by Westozy
I hope it goes well for you!

Cheers Gwyn
Gwyn

You wouldn't happen to have a properly working EFIS BARO code would you? My code increases/decreases the QNH in increments of .03 rather than .01.
Often I have to press B to get the correct Barometric pressure. Kind of spoils the realism.

Jerry

10. ## Re: XPNDR Code Problem

Originally Posted by Jerrymc3
Gwyn

You wouldn't happen to have a properly working EFIS BARO code would you? My code increases/decreases the QNH in increments of .03 rather than .01.
Often I have to press B to get the correct Barometric pressure. Kind of spoils the realism.

Jerry
Hi Jerry, I have CPFlight MCP and EFIS units so no OC code sorry!

Cheers Gwyn

Page 1 of 2 12 Last