PDA

View Full Version : HDG works but CRS doesn't?



jmig
11-15-2009, 12:58 PM
Once again my ignorance shows. I am scratching my head as to WHY the heading will change but the course won't, within FSX.

Here is the applicable code from my soic.ssi I have also included the results of the IOCP Console file. You will see that the HDG is writing one extra line to the FSUIPC offset that the CRS. However the two routines are exactly the same with different V numbers, V names, and offsets.

SO??? Why isn't the CRS sending the final result to FSX? The code was copied from an example.

IOCP Console
3013=1 - RO_HDG
3011=265 - HDG
3010=48230 - X_HDG
3013=0 - RO_HDG
3010=48242 - X_HDG
3=1 - Battery_Master // I did this to seperate the two so I could compare them easier
2=1 - Battery
3023=1 - RO_CRS
3021=323 - CRS
3020=58786 - X_CRS
3023=0 - RO_CRS


//********************************* Heading ********************************

Var 3010, name X_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2
{
// convert from fsuipc range to degrees:
L0 = DIV &X_HDG, 182

IF &HDG != L0
{
&HDG = L0
}
}

Var 3011, name HDG
{
CALL &OutHDG
}

Var 3012, name OutHDG, Link SUBRUTINE
{
// &D_HDG = &HDG // For use with display

// convert from degrees to fsuipc range:
L0 = &HDG * 182
IF &X_HDG != L0
{
&X_HDG = L0
}
}

Var 3013, name RO_HDG, Link IOCARD_ENCODER, Input 40, Aceleration 4 Type 2
{
L0 = &RO_HDG // * -1 turning right should be plus
&HDG = ROTATE 0, 359, L0
}

// Var 3014, name D_HDG, Link IOCARD_DISPLAY, Digit 0, Numbers 3 //LED display of Heading




//********************************* Course ********************************

Var 3020, name X_CRS, Link FSUIPC_INOUT, Offset $0C4E, Length 2
{
// convert from fsuipc range to degrees:
L0 = DIV &X_CRS, 182

IF &CRS != L0
{
&CRS = L0
}
}

Var 3021, name CRS
{
CALL &OutCRS
}

Var 3022, name OutCRS, Link SUBRUTINE
{
// &D_CRS = &CRS // For use with display

// convert from degrees to fsuipc range:
L0 = &CRS * 182
IF &X_CRS != L0
{
&X_CRS = L0
}
}

Var 3023, name RO_CRS, Link IOCARD_ENCODER, Input 38, Aceleration 4 Type 2
{
L0 = &RO_CRS // * -1 turning right should be plus
&CRS = ROTATE 0, 359, L0
}

// Var 3024, name D_CRS, Link IOCARD_DISPLAY, Digit 0, Numbers 3 //LED display of course

Thanks in advance guys for all your help. Without you I would be grounded.

fordgt40
11-15-2009, 04:03 PM
John

On the basis that your SIOC code is identical for both functions, have you tried swopping the output numbers for the encoders to see if the problem migrates from CRS to HDG? If so, then there would be a h/w issue.

Regards

David

kiek
11-15-2009, 04:25 PM
Hi John,

Your SIOC code for CRS is not correct.
The CRS offset $0C4E in FSUIPC is in degrees (0 - 359), no need to divide by 182...

regards,
Nico

jmig
11-15-2009, 05:17 PM
Hi John,

Your SIOC code for CRS is not correct.
The CRS offset $0C4E in FSUIPC is in degrees (0 - 359), no need to divide by 182...

regards,
Nico

Thanks Nico and David. I will change the code Nico. Mucho Thanks