This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1100驱动程序的问题,下面程序中for小循环是什么意思,请大神解释一下吧



//------------------------------------------------------------------------------
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);
}