Pedestal

Leave a comment

10. May 2013 by Peter

COM1 and NAV1

COM1 and NAV1

I know this is not the first time that I have said that the pedestal is somewhat finished. But this time it is almost true. 🙂

I just need a few adjustments and then I can close “Phase 1”. (Phase 1 was getting the essential radios to work)

Right now all I need is to connect the last radio-mudules to my display-card. Just have not had the time yet.

I have used single controllers (CTS288 encoders) for my radios. This caused a bit of frustration because I could only be able to change the integer or the decimal with the encoder. So either I should have two encoders or buy new double-encoders or code a way out of it.

I got some help from Gert in Belgium and now I can change the integer when I turn the encoder and change the decimal when I push-and-turn the encoder. Works like a charm! You can find the SIOC code below the video. I works with ProSim but the basic idea should work for other “systems” as well. The main idea is simple the “IF ELSE” command at the beginning of the script (around the 3rd and 4th variable). If “1” (=pushed) then the decimal-function is used. ELSE the integer-function is used.

Oh! And the video now also has a small intro-logo 🙂

 

SIOC CODE for single controller.
Var 7203 and 7204 are where the magic happens! 🙂

// **********
// 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_encoders, link IOCARD_SW, input 18, device 1

var 7204, name nav1_enc, link IOCARD_ENCODER, input 19, type 2, aceleration 1, device 1
{
IF &nav1_encoders = 1
{
l0 = &nav1_enc * -50
l1 = &nav1_dec + l0
if l1 < 0
{
l1 = 950
}
if l1 > 950
{
l1 = 0
}
&nav1_dec = l1
call &sub_d_nav1
}
ELSE
{
l0 = &nav1_enc * -1
&nav1_ent = rotate 108,117,l0
call &sub_d_nav1
}
}
var 7205, name nav1_id,link IOCARD_DISPLAY, digit 11, numbers 5, device 1

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 21, device 1
{
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 22, device 1
{
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 6, numbers 5, device 1
{
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
// ********

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: