我程序中我用SPCOMM控件向串口打印机发送命令,(DLE EOT n)以取得打印机的1字节返回值.
发送的语句:
  comm1.WriteCommData(char(16),1) ;//发送DLE
  comm1.WriteCommData(char(4),1);//发送EOT
  comm1.WriteCommData(char(4),1) ;//发送n=4//查打印机的缺纸状态;
接收的语句:
procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
  BufferLength: Word);
var i:integer;
       b:byte;
begin
                b:=byte(buffer);
                edit1.Text:='';
                for i:=7 downto 0 do
                edit1.Text:=edit1.Text+inttostr(getbit(b,i));//getbit(b:byte,i:integer):byte函数为取得B中第i位的0或1值;
end;
为什么,有纸和无纸的状态都返回相同的值呢?
spcomm的Baudrate信息已经设置正确,并可以打印,就是查打印机状态时查不出来,请高手多多指教。