//------------------------------------------------------------------------------
void Disp_Signed_3_5(int Value)
{
unsigned int i;
unsigned int Output;
char fNeg = 0;
if (Value >= 2000) // Higher/equ w/ 2000?
{
Disp_BCD_3_5(0x0a1f); // Display 'HI'
return;
}
if (Value < -1999) // Less than -1999?
{
Disp_BCD_3_5(0x0b0f); // Display 'LO'
return;
}
if (Value < 0) // Test for new negative value
{
Value = -Value; // Negate value
fNeg = 1; // Set negative flag
}
for (i = 16, Output = 0; i; i--) // BCD Conversion, 16-Bit
{
Output = __bcd_add_short(Output, Output);
if (Value & 0x8000)
Output = __bcd_add_short(Output, 1);
Value <<= 1;
}
if (fNeg)
Output |= 0x2000;
Disp_BCD_3_5(Output);
}