几个函数可能对你有用。Procedure SwapEx1(var Inp:Smallint );var Buf:smallint;begin Buf:=inp; Inp:=Swap(Buf);end;Procedure SwapEx2(Var Inp:word );var Buf:Word;begin Buf:=inp; Inp:=Swap(Buf);end;Procedure SwapEx3(var Inp:integer);var Buf:Longword; bufH,bufL:word; BufDH:Longword;begin Buf:=Longword(inp); BufH:=Word((Buf shr 16) and $0000ffff); BufL:=Word(Buf and $0000ffff); SwapEx2(BufH); SwapEx2(BufL); BufDH:=((BufL and $0000ffff) shl 16); Inp:=BufDH or BufH;end;Procedure SwapEx4(var Inp:Longword);var Buf:Longword; bufH,bufL:word; BufDH:Longword;begin Buf:=inp; BufH:=word((Buf shr 16) and $0000ffff); BufL:=word(Buf and $0000ffff); SwapEx2(BufH); SwapEx2(BufL); BufDH:=((BufL and $0000ffff) shl 16); Inp:=BufDH or BufH;end;如果收到的数据位 Val:=$1220Swapex1(val);val 内为已经转换好的 整形数。