Jerrymc3
08-03-2011, 09:08 PM
Why is it that no matter which direction I turn my encoders the digits always count down.
// 0600-0699 - MCP DISPLAYS & ENCODERS
Var 0000, Value 0
{
V0600 = V0604 // Read temporary value of IAS
V0601 = V0605 // Read temporary value of MACH
V0602 = V0604 // Put in IAS Display
V0604 = 200 // IAS
}
Var 0600, Link FSUIPC_OUT, Offset $5406, Length 2 // IAS
Var 0601, Link FSUIPC_OUT, Offset $540E, Length 2 // MACH
Var 0602, Link IOCARD_DISPLAY, Digit 0, Numbers 3 // IAS/ MACH
{
V0604 = V0602 // Send value to PM
}
Var 0603, Link IOCARD_ENCODER, Input 51, Aceleration 6 // Encoder IAS/ MACH v0303
{
L0 = V0603 * 1
C0 = TESTBIT V0607 ,15 // MACH or IAS MODE?
IF C0 // MACH MODE
{
V0601 = LIMIT 25 ,95 ,L0 // Increment or decrement MACH value
}
ELSE
{
V0600 = LIMIT 0 ,340 ,L0 // Increment or decrement IAS value
}
}
Var 0604, Link FSUIPC_IN, Offset $04E0, Length 2 // IAS
{
CALL V0608 // Display del valor
}
Var 0605, Link FSUIPC_IN, Offset $04E8, Length 2 // MACH
{
CALL V0608 // Display del valor
}
Var 0606, Link IOCARD_OUT, Output 32 // Led . DECIMAL
Var 0607, Link FSUIPC_IN, Offset $04F0, Length 2 // MCP LIGHTS
{
C0 = TESTBIT v0607 ,15 // MACH or IAS Mode?
IF C0 // Mode Matches
{
V0601 = V0605 // Hold Temporary value
V0606 = 1 // Turn on Mach point
CALL V0608 // Put value in display
}
ELSE
{
V0600 = V0604 // Hold Temporary value
V0606 = 0 // Turn off Mach point
CALL V0608 // Put value in display
}
}
Var 0608, Link SUBRUTINE // Change IAS / MAcH
{
C0 = TESTBIT V0607 ,15 // MACH or IAS Mode ?
IF C0 // MACH MODE
{
V0606 = 1 // Turn on decimal point
V0602 = V0605 // Put value of MACH in display
}
ELSE
{
V0606 = 0
V0602 = V0604 // Put value of IAS in display
}
}
Var 0610, Link FSUIPC_OUT, Offset $5408, Length 2 // HDG
Var 0611, Link IOCARD_DISPLAY, Digit 3, Numbers 3 // HEADING
{
V0610 = V0612 // Pass value to PM
}
Var 0612, Link IOCARD_ENCODER, Input 60, Aceleration 6 // Encoder HDG
{
V0611 = ROTATE 0 ,359 ,V0612
}
Var 0620, Link FSUIPC_IN, Offset $04E6, Length 2 // VS input
{
L0 = V620 // Read value in LO
C0 = TESTBIT V620 ,15 // Check if Negative
IF C0
{
V0624 = L0 - 65536 // If it is negative becomes a negative binary d
}
ELSE
{
V0624 = L0 // If is not negative, stays positive
}
CALL V0624 // Put value in display
}
Var 0621, Link FSUIPC_OUT, Offset $540C, Length 2 // V/S output
Var 0622, Link IOCARD_DISPLAY, Digit 6, Numbers 4 // V/S
/
Var 0623, Link IOCARD_ENCODER, Input 60, Aceleration 6 // Encoder V/S
{
L0 = V0623 * 100 // Increases from 100 to next 100
V0624 = ROTATE -9000 ,9000 ,L0 // Add or subtract the time value of V/S
IF V0624 < 0 // If temporary V/S is negative
{
V0621 = V0624 + 65536 // becomes negative binary.
}
ELSE
{
V0621 = V0624 // If no, leave positive passing the value to PM
}
}
Var 0624 // Temporary value of V/S
Var 0625, Link SUBRUTINE // Pinta V/S
{
C0 = TESTBIT V0626 ,0 // Check to see if they should be turned off
C0 = NOT C0
IF C0 // Only in the case of being lit
{
IF V0624 < 0 // If V/S is negative, change to positive
{
L0 = ABS V0624
V0627 = -999998 // Light the minus sign
}
ELSE
{
V0627 = 0 // Turn off the minus sign
L0 = V0624
}
V0622 = L0 // Send the adjusted value of v/S to display
}
}
Var 0626, Link FSUIPC_IN, Offset $051C, Length 2 // MCP Indicators
{
C0 = TESTBIT V0626 ,0 // Checks if V/S display Is off?
IF C0 // If yes, then
{
V0622 = -999999 // Turns off rest of digits
V0627 = -999999 // Minus sign is off
}
ELSE // If not,then
{
CALL V0625 // Put value in V/S display
}
}
Var 0627, Link IOCARD_DISPLAY, Digit 10, Numbers 1 // - Sign V/S display
Var 0630, Link FSUIPC_IN, Offset $04E4, Length 2
Var 0631, Link FSUIPC_OUT, Offset $540A, Length 2 // ALT
{
V0632 = V0631
}
Var 0632, Link IOCARD_DISPLAY, Digit 13, Numbers 3 // ALT
{
V0631 = V0632 // Pasa el valor al PM
}
Var 0633, Link IOCARD_ENCODER, Input 58, Aceleration 1 // Encoder ALT
{
L0 = v0633 * 1
V0632 = LIMIT 0 ,500 ,L0
}
Var 0634 // Temporary value v0305
Var 0635, Link IOCARD_DISPLAY, Digit 11, Numbers 2 // ALT
{
V0635 = 0
}
// 0600-0699 - MCP DISPLAYS & ENCODERS
Var 0000, Value 0
{
V0600 = V0604 // Read temporary value of IAS
V0601 = V0605 // Read temporary value of MACH
V0602 = V0604 // Put in IAS Display
V0604 = 200 // IAS
}
Var 0600, Link FSUIPC_OUT, Offset $5406, Length 2 // IAS
Var 0601, Link FSUIPC_OUT, Offset $540E, Length 2 // MACH
Var 0602, Link IOCARD_DISPLAY, Digit 0, Numbers 3 // IAS/ MACH
{
V0604 = V0602 // Send value to PM
}
Var 0603, Link IOCARD_ENCODER, Input 51, Aceleration 6 // Encoder IAS/ MACH v0303
{
L0 = V0603 * 1
C0 = TESTBIT V0607 ,15 // MACH or IAS MODE?
IF C0 // MACH MODE
{
V0601 = LIMIT 25 ,95 ,L0 // Increment or decrement MACH value
}
ELSE
{
V0600 = LIMIT 0 ,340 ,L0 // Increment or decrement IAS value
}
}
Var 0604, Link FSUIPC_IN, Offset $04E0, Length 2 // IAS
{
CALL V0608 // Display del valor
}
Var 0605, Link FSUIPC_IN, Offset $04E8, Length 2 // MACH
{
CALL V0608 // Display del valor
}
Var 0606, Link IOCARD_OUT, Output 32 // Led . DECIMAL
Var 0607, Link FSUIPC_IN, Offset $04F0, Length 2 // MCP LIGHTS
{
C0 = TESTBIT v0607 ,15 // MACH or IAS Mode?
IF C0 // Mode Matches
{
V0601 = V0605 // Hold Temporary value
V0606 = 1 // Turn on Mach point
CALL V0608 // Put value in display
}
ELSE
{
V0600 = V0604 // Hold Temporary value
V0606 = 0 // Turn off Mach point
CALL V0608 // Put value in display
}
}
Var 0608, Link SUBRUTINE // Change IAS / MAcH
{
C0 = TESTBIT V0607 ,15 // MACH or IAS Mode ?
IF C0 // MACH MODE
{
V0606 = 1 // Turn on decimal point
V0602 = V0605 // Put value of MACH in display
}
ELSE
{
V0606 = 0
V0602 = V0604 // Put value of IAS in display
}
}
Var 0610, Link FSUIPC_OUT, Offset $5408, Length 2 // HDG
Var 0611, Link IOCARD_DISPLAY, Digit 3, Numbers 3 // HEADING
{
V0610 = V0612 // Pass value to PM
}
Var 0612, Link IOCARD_ENCODER, Input 60, Aceleration 6 // Encoder HDG
{
V0611 = ROTATE 0 ,359 ,V0612
}
Var 0620, Link FSUIPC_IN, Offset $04E6, Length 2 // VS input
{
L0 = V620 // Read value in LO
C0 = TESTBIT V620 ,15 // Check if Negative
IF C0
{
V0624 = L0 - 65536 // If it is negative becomes a negative binary d
}
ELSE
{
V0624 = L0 // If is not negative, stays positive
}
CALL V0624 // Put value in display
}
Var 0621, Link FSUIPC_OUT, Offset $540C, Length 2 // V/S output
Var 0622, Link IOCARD_DISPLAY, Digit 6, Numbers 4 // V/S
/
Var 0623, Link IOCARD_ENCODER, Input 60, Aceleration 6 // Encoder V/S
{
L0 = V0623 * 100 // Increases from 100 to next 100
V0624 = ROTATE -9000 ,9000 ,L0 // Add or subtract the time value of V/S
IF V0624 < 0 // If temporary V/S is negative
{
V0621 = V0624 + 65536 // becomes negative binary.
}
ELSE
{
V0621 = V0624 // If no, leave positive passing the value to PM
}
}
Var 0624 // Temporary value of V/S
Var 0625, Link SUBRUTINE // Pinta V/S
{
C0 = TESTBIT V0626 ,0 // Check to see if they should be turned off
C0 = NOT C0
IF C0 // Only in the case of being lit
{
IF V0624 < 0 // If V/S is negative, change to positive
{
L0 = ABS V0624
V0627 = -999998 // Light the minus sign
}
ELSE
{
V0627 = 0 // Turn off the minus sign
L0 = V0624
}
V0622 = L0 // Send the adjusted value of v/S to display
}
}
Var 0626, Link FSUIPC_IN, Offset $051C, Length 2 // MCP Indicators
{
C0 = TESTBIT V0626 ,0 // Checks if V/S display Is off?
IF C0 // If yes, then
{
V0622 = -999999 // Turns off rest of digits
V0627 = -999999 // Minus sign is off
}
ELSE // If not,then
{
CALL V0625 // Put value in V/S display
}
}
Var 0627, Link IOCARD_DISPLAY, Digit 10, Numbers 1 // - Sign V/S display
Var 0630, Link FSUIPC_IN, Offset $04E4, Length 2
Var 0631, Link FSUIPC_OUT, Offset $540A, Length 2 // ALT
{
V0632 = V0631
}
Var 0632, Link IOCARD_DISPLAY, Digit 13, Numbers 3 // ALT
{
V0631 = V0632 // Pasa el valor al PM
}
Var 0633, Link IOCARD_ENCODER, Input 58, Aceleration 1 // Encoder ALT
{
L0 = v0633 * 1
V0632 = LIMIT 0 ,500 ,L0
}
Var 0634 // Temporary value v0305
Var 0635, Link IOCARD_DISPLAY, Digit 11, Numbers 2 // ALT
{
V0635 = 0
}