现有源程序是用Delphi开发的与串口通信的程序。
根据该硬件的通讯协议,需发送当前日期,并将日期转换成BCD码进行
发送。源程序是用FMTBcd.pas中的TBcd记录类型进行转换的。小弟原是学.NET的,因老板吩咐,必须在.NET2005中实现以上源程序的串口通讯功能。
看了两天Delphi语法就开始看源代码。跪请各位高手、大侠给我讲解一下TBcd记录类型,以及TBcd记录类型中三个成员的详细用法。
不然小弟实在无法理解源代码的思路,帮帮忙!帮帮忙!帮帮忙!关系饭碗问题!

解决方案 »

  1.   

    关系饭碗问题分还不多给?
    帮助里说很清楚,我给你加上翻译:
      TBcd  = packed record
        Precision: Byte;
        SignSpecialPlaces: Byte;
        Fraction: packed array [0..31] of Byte;
      end;DescriptionTBcd represents a binary-coded decimal value. It contains the following fields:Field Contents
    Precision The number of digits in the decimal version of the value.
    精度——有效位数
    SignSpecialPlaces The sign bit (0 is positive, any other value negative)
    the special bit (nonzero indicates that the value is blank)
    the number of digits after the decimal (0 to Precision)
    最高位表示这个数是否负数,0则是正数;次高位非0则表示值为空;其余位表示小数点后位数
    Fraction An array of BCD nibbles, 00 to 99 per byte, high nibble first. Only the first Precision nibbles are used.
    值数据,用BCD方式表示,每半位都只是0至9,如 $54 表示五十四。我感觉更重要的还是FMTBcd.pas中的操作函数和类,一般用不着自己操作TBcd类型。多看看帮助吧,或者买本书看,如果它有这方面内容,有一本书是专门讲解VCL中的类和函数的。