uses IdGlobal 十进制转换成BCD码函数 function TForm1 . inttobcd(x: Integer ): string ; var s,s1: string ; i,j,x1: Integer ; begin s:=IntToStr(x); i:=Length(s); result:= '' ; for j:= 1 to i do begin x1:=StrToInt(s[j]); s1:=inttobin(x1); s1:=Copy(s1,Length(s1)- 3 , 4 ); result:=result+s1; end ; end ;