PDA

View Full Version : need some help



djcevera20
09-11-2009, 09:45 AM
hello i have a desktop aviator rotary encoder laying around and was going to use it to build a multi radio however the desktop hardware does not have any 7 segment display capabilities i also have the opencockpits master and display cards using sioc. question is if i use the desktop aviator hardware to control the rotarys of say the nav one radio how can i get the 7 seg displays to read the change in fs using the opencockpits hardware and sioc..basically if this is possible i really just need the sioc code. thanks and my appologizes if this is vauge.

kiek
09-11-2009, 10:02 AM
////////////////////////////////////////////////////////////////////
//
// generic FS9/X NAV1 (VOR1) Radio
// SIOC 3.4 code for FSUIPC
// using FSUIPC offsets 0x0350 and 0x0C4E
//
// Version 1.0
// Dec 15, 2007
//
// Nico Kaan
// The Netherlands
// www.lekseecon.nl (http://www.lekseecon.nl)
// email: leveld757@gmail.com
//
// INCLUDES:
//
// An implementation of a NAV1 radio, consisting of:
//
// 1 dual rotary encoder controlling the freqeuncy
// 1 single rotary encoder controlling the course
// five 7-segment displays for the frequency
// - software controlled Decimal Point via an Output
// three 7-segment display for the course
//
// CHANGE LOG:
//
// 1.0 First Release

Var 8600 name FI_NAV1Freq Link FSUIPC_IN Offset $0350 Length 2
{
L0 = FROMBCD &FI_NAV1Freq
&NAV1Freq = L0
&NAV1FreqHigh = DIV L0 100
&NAV1FreqLow = MOD L0 100
CALL &OutNAV1Freq // display new freq value
}
Var 8601 name FI_NAV1Crs Link FSUIPC_IN Offset $0C4E Length 2
{
&NAV1Crs = &FI_NAV1Crs
}
Var 8610 name NAV1FreqLow
Var 8611 name NAV1FreqHigh
Var 8612 name NAV1Freq
Var 8613 name CalcNAV1Freq Link SUBRUTINE
{
L0 = &NAV1FreqHigh * 100 // high * 100
&NAV1Freq = L0 + &NAV1FreqLow // + low
&FO_NAV1Freq = TOBCD &NAV1Freq // BCD value to panel
CALL &OutNAV1Freq // display new freq value
}
Var 8614 name NAV1Crs
{
CALL &OutNAV1Crs
}
Var 8620 name OutNAV1Freq Link SUBRUTINE
{
&D_NAV1Freq = &NAV1Freq + 10000 // to display + '1'
&O_NAV1DP = 1
}
Var 8621 name OutNAV1Crs Link SUBRUTINE
{
&D_NAV1Crs = &NAV1Crs
}
Var 8640 name RO_NAV1FL Link IOCARD_ENCODER Input 59 Aceleration 1 Type 2
{
L0 = &RO_NAV1FL * 5
&NAV1FreqLow = ROTATE 0 99 L0
CALL &CalcNAV1Freq
}
Var 8641 name RO_NAV1FH Link IOCARD_ENCODER Input 57 Aceleration 1 Type 2
{
L0 = &RO_NAV1FH
&NAV1FreqHigh = ROTATE 8 35 L0
CALL &CalcNAV1Freq
}
Var 8642 name RO_NAV1CRS Link IOCARD_ENCODER Input 61 Aceleration 4 Type 2
{
L0 = &RO_NAV1CRS
&NAV1Crs = ROTATE 0 359 L0
&FO_NAV1Crs = &NAV1Crs
}
Var 8670 name D_NAV1Freq Link IOCARD_DISPLAY Digit 20 Numbers 5
Var 8671 name D_NAV1Crs Link IOCARD_DISPLAY Digit 25 Numbers 3
Var 8680 name O_NAV1DP Link IOCARD_OUT Output 96
Var 8698 name FO_NAV1Crs Link FSUIPC_OUT Offset $0C4E Length 2
Var 8699 name FO_NAV1Freq Link FSUIPC_OUT Offset $0350 Length 2

djcevera20
09-11-2009, 10:18 AM
nico thank you for the quick response im a little lost in the code sorry...i think all of the added code for the rotary knobs got me....with this setup im trying to do the rotary knobs will be programed thru fsuipc so the only thing i need to link thru sioc will be the displays. out of this code you posted what do i need to input into my sioc? sorry still learning all of this stuff.

kiek
09-11-2009, 12:11 PM
Var 8600 name FI_NAV1Freq Link FSUIPC_IN Offset $0350 Length 2
{
L0 = FROMBCD &FI_NAV1Freq
&D_NAV1Freq = L0 + 10000 // to display + '1'
&O_NAV1DP = 1
}

Var 8601 name FI_NAV1Crs Link FSUIPC_IN Offset $0C4E Length 2
{
&D_NAV1Crs = &FI_NAV1Crs
}

Var 8670 name D_NAV1Freq Link IOCARD_DISPLAY Digit 20 Numbers 5
Var 8671 name D_NAV1Crs Link IOCARD_DISPLAY Digit 25 Numbers 3
Var 8680 name O_NAV1DP Link IOCARD_OUT Output 96

djcevera20
09-11-2009, 02:04 PM
excellent thanks kiek