Jerrymc3
11-10-2012, 09:17 PM
Can someone take a look at my script and tell me why I can't swap the NAV1 ACTIVE and STANDBY frequencies?
Jerry
Var 0213, name NAV1Freq, Link FSUIPC_IN, Offset $0350, Length 2
{
L0 = FROMBCD &NAV1Freq
&NAV1 = L0
&NAV1_High = DIV L0 ,100
&NAV1_Low = MOD L0 ,100
CALL &OutNAV1Freq // display new freq value
}
Var 0214, name FI_NAV1Crs, Link FSUIPC_IN, Offset $0C4E, Length 2
{
&NAV1Crs = &FI_NAV1Crs
}
Var 0215, name NAV1_Low
Var 0216, name NAV1_High
Var 0217, name NAV1
Var 0218, name CalcNAV1Freq, Link SUBRUTINE
{
L0 = &NAV1_High * 100 // high * 100
&NAV1 = L0 + &NAV1_Low // + low
&FO_NAV1 = TOBCD &NAV1 // BCD value to panel
CALL &OutNAV1Freq // display new freq value
}
Var 0219, name NAV1Crs
{
CALL &OutNAV1Crs
}
Var 0220, name OutNAV1Freq, Link SUBRUTINE
{
&NAV1_STBY = &NAV1 + 10000 // to display + '1'
&O_NAV1DP = 1
}
Var 0221, name OutNAV1Crs, Link SUBRUTINE
{
&D_NAV1Crs = &NAV1Crs
}
Var 0222, name RO_NAV1FL, Link IOCARD_ENCODER, Input 187, Aceleration 1, Type 2
{
L0 = &RO_NAV1FL * 5
&NAV1_Low = ROTATE 0 ,99 ,L0
CALL &CalcNAV1Freq
}
Var 0223, name RO_NAV1FH, Link IOCARD_ENCODER, Input 180, Aceleration 1, Type 2
{
L0 = &RO_NAV1FH
&NAV1_High = ROTATE 8 ,17 ,L0
CALL &CalcNAV1Freq
}
Var 0224, name RO_NAV1CRS, Link IOCARD_ENCODER, Input 140, Aceleration 4, Type 2
{
L0 = &RO_NAV1CRS
&NAV1Crs = ROTATE 0 ,359 ,L0
&FO_NAV1Crs = &NAV1Crs
}
Var 0225, name NAV1_STBY, Link IOCARD_DISPLAY, Digit 80, Numbers 5
Var 0226, name NAV1_ACTIVE, Link IOCARD_DISPLAY, Digit 74, Numbers 5
Var 0227, name D_NAV1Crs, Link IOCARD_DISPLAY, Digit 96, Numbers 3
Var 0228, name O_NAV1DP, Link IOCARD_OUT, Output 96
Var 0229, name FO_NAV1Crs, Link FSUIPC_OUT, Offset $0C4E, Length 2
Var 0230, name FO_NAV1, Link FSUIPC_OUT, Offset $0350, Length 2
Var 0231, Link IOCARD_SW, Input 143, Type P // SWAP Active/Standby
{
L0 = &NAV1_Low * 100 // Value of 2 high digits
L0 = L0 + &NAV1_High // + value of low digits
L1 = FROMBCD &FO_NAV1 // Salvo la frecuencia actual pasando a dec
&FO_NAV1 = TOBCD L0 // Y le paso la frecuencia de Standbye
L0 = L1 / 100 // Saco los 2 digitos altos
&NAV1_Low = TRUNC L0 // Se los paso a la variable
L2 = &NAV1_Low * 100
&NAV1_High = L1 - L2 // Paso los 2 digitos bajos
}
Jerry
Var 0213, name NAV1Freq, Link FSUIPC_IN, Offset $0350, Length 2
{
L0 = FROMBCD &NAV1Freq
&NAV1 = L0
&NAV1_High = DIV L0 ,100
&NAV1_Low = MOD L0 ,100
CALL &OutNAV1Freq // display new freq value
}
Var 0214, name FI_NAV1Crs, Link FSUIPC_IN, Offset $0C4E, Length 2
{
&NAV1Crs = &FI_NAV1Crs
}
Var 0215, name NAV1_Low
Var 0216, name NAV1_High
Var 0217, name NAV1
Var 0218, name CalcNAV1Freq, Link SUBRUTINE
{
L0 = &NAV1_High * 100 // high * 100
&NAV1 = L0 + &NAV1_Low // + low
&FO_NAV1 = TOBCD &NAV1 // BCD value to panel
CALL &OutNAV1Freq // display new freq value
}
Var 0219, name NAV1Crs
{
CALL &OutNAV1Crs
}
Var 0220, name OutNAV1Freq, Link SUBRUTINE
{
&NAV1_STBY = &NAV1 + 10000 // to display + '1'
&O_NAV1DP = 1
}
Var 0221, name OutNAV1Crs, Link SUBRUTINE
{
&D_NAV1Crs = &NAV1Crs
}
Var 0222, name RO_NAV1FL, Link IOCARD_ENCODER, Input 187, Aceleration 1, Type 2
{
L0 = &RO_NAV1FL * 5
&NAV1_Low = ROTATE 0 ,99 ,L0
CALL &CalcNAV1Freq
}
Var 0223, name RO_NAV1FH, Link IOCARD_ENCODER, Input 180, Aceleration 1, Type 2
{
L0 = &RO_NAV1FH
&NAV1_High = ROTATE 8 ,17 ,L0
CALL &CalcNAV1Freq
}
Var 0224, name RO_NAV1CRS, Link IOCARD_ENCODER, Input 140, Aceleration 4, Type 2
{
L0 = &RO_NAV1CRS
&NAV1Crs = ROTATE 0 ,359 ,L0
&FO_NAV1Crs = &NAV1Crs
}
Var 0225, name NAV1_STBY, Link IOCARD_DISPLAY, Digit 80, Numbers 5
Var 0226, name NAV1_ACTIVE, Link IOCARD_DISPLAY, Digit 74, Numbers 5
Var 0227, name D_NAV1Crs, Link IOCARD_DISPLAY, Digit 96, Numbers 3
Var 0228, name O_NAV1DP, Link IOCARD_OUT, Output 96
Var 0229, name FO_NAV1Crs, Link FSUIPC_OUT, Offset $0C4E, Length 2
Var 0230, name FO_NAV1, Link FSUIPC_OUT, Offset $0350, Length 2
Var 0231, Link IOCARD_SW, Input 143, Type P // SWAP Active/Standby
{
L0 = &NAV1_Low * 100 // Value of 2 high digits
L0 = L0 + &NAV1_High // + value of low digits
L1 = FROMBCD &FO_NAV1 // Salvo la frecuencia actual pasando a dec
&FO_NAV1 = TOBCD L0 // Y le paso la frecuencia de Standbye
L0 = L1 / 100 // Saco los 2 digitos altos
&NAV1_Low = TRUNC L0 // Se los paso a la variable
L2 = &NAV1_Low * 100
&NAV1_High = L1 - L2 // Paso los 2 digitos bajos
}