在线情况
楼主
  • 头像
  • 级别
    • 积分2
    • 经验28
    • 文章1
    • 注册2014-07-09
    msp430的段码LCD显示 里那个for小循环是什么意思
    void Disp_Signed_Long(long Value)
    {
      unsigned int i;
      unsigned long Output;
      char fNeg = 0;

      if (Value < 0)                                // Test for negative value
      {
        Value = -Value;                             // Negate value
        fNeg = 1;                                   // Set negative flag
      }

      for (i = 32, Output = 0; i; i--)              // BCD Conversion, 32-Bit
      {
        Output = __bcd_add_long(Output, Output);    //功能:两个 32 位 BCD 格式的数相加,返回和。
       
        if (Value & 0x80000000)
          Output = __bcd_add_long(Output, 1);    
       
        Value <<= 1;
      }

      if (fNeg)                                     // Display neg sign?
        Output |= 0x80000000;                       // Bit 31 indicates neg. number

      Disp_BCD(Output);
    }[P][LINE-HEIGHT=24px][FACE=arial, 宋体, sans-serif, ][COLOR=rgb(51, 51, 51)][SIZE=14px][/FACE][/COLOR][/SIZE][/LINE-HEIGHT][/P][P][FACE=arial, 宋体, sans-serif, ][COLOR=rgb(51, 51, 51)][SIZE=14px][BGCOLOR=rgb][URL=http://zhidao.baidu.com/question/2138209998568275788.html?quesup2&oldq=1#][i][/i][/URL][/FACE][/COLOR][/SIZE][/BGCOLOR][/P][P][/P]
    [ 此贴最后由DC在2014-8-3 0:40:31编辑过 ]
    微控网感谢您的参与
    在线情况
    2
    • 头像
    • 级别
    • 门派
    • 职务总版主
    • 声望+9
    • 财富5
    • 积分3065
    • 经验390701
    • 文章6744
    • 注册2006-03-07
    看了,没看懂作者用意....
    [COLOR=#0000ff]欢迎发贴分享设计心得、开源DIY...[/COLOR]
    Powered by LeadBBS 9.2 .
    Page created in 0.1719 seconds with 5 queries.