我用的如同银行的小键盘,我通过spcomm能从键盘上取出数据。现在我要通过电脑把数据发送到小键盘上去,请问如何实现??

解决方案 »

  1.   

    HexToBin()十六进制转换二进制
    BinToHex()二进制转换十六进制
    IntToHex()
    StrToInt()  要求在字符串前面添加$即可!
    把一个整数变成二进制字符串
    function IntToBinaryStr(TheVal: LongInt): string;
    var
      counter: LongInt;
    begin
    {This part is here because we remove leading zeros.  That
    means that a zero value would return an empty string.}  if TheVal = 0 then begin
        result := '0';
        exit;
      end;  result := '';
      counter := $80000000;  {Suppress leading zeros}
      while  ((counter and TheVal) = 0) do begin
        counter := counter shr 1;
        if (counter = 0) then break; {We found our first "1".}
      end;  while counter > 0 do begin
        if (counter and TheVal) = 0 then result := result + '0'
        else  result := result + '1';
        counter := counter shr 1;
      end;
    end;
      

  2.   

    发送数据通过spcomm就可以啊,但是键盘是否接受你的数据,如何显示那就处决于键盘了,你可以跟键盘厂商联系一下,索取相关资料