看一协议及对应的程序代码:
  字段名         类型                    字节数
 version       Unsigned Integer           1
 Msg_Length    Unsigned Integer           1程序赋值:
version:=$20   
Msg_Length:=140;
为何上面都是占一个字节?

解决方案 »

  1.   

    程序里面对version,Msg_Length怎么定义的?这里类型和字节数定义错误,也可能unsigned integer是协议定义的类型,其实可能是一个Byte,就是一个字节的内容。
      

  2.   

    Delphi中对数字常量的描述如下:Numeric constantsNumeric constants must be integers, and their values must be between -2,147,483,648 and 4,294,967,295.By default, numeric constants use decimal notation, but the built-in assembler also supports binary, octal, and hexadecimal. Binary notation is selected by writing a B after the number, octal notation by writing an O after the number, and hexadecimal notation by writing an H after the number or a $ before the number.Numeric constants must start with one of the digits 0 through 9 or the $ character. When you write a hexadecimal constant using the H suffix, an extra zero is required in front of the number if the first significant digit is one of the digits A through F. For example, 0BAD4H and $BAD4 are hexadecimal constants, but BAD4H is an identifier because it starts with a letter.
      

  3.   

    程序中是这样定义的:
    Version: Byte;
    Msg_Length: Byte;
      

  4.   

    对呀,是Byte类型,所以是一个字节,Byte的值最大为$FF。unsigned integer只是你的协议表达的一个意义,可能是协议里定义的,就是Byte类型。
    如果协议里没定义,那就是这份协议不是很完整。
    你就认为是byte类型处理。
      

  5.   

    没有超过256或$FF,当然可以使一个byte了