Table of Content
HAL Forum
function Integer OpenComPort (
integer port,string portname,LongInt baudrate,Integer parity,Integer datalength,
Integer stopbits,Integer flowcontrol)
Description:
Open COM (LPT, USB) port for input/output
Parameters:
port internal number of port
portname name of port in OS
baudrate rate in bauds
parity parity control (0 - no, 1 - yes)
datalength word lenght in bits
stopbits stop bits
flowcontrol flow control
global
procedure OpenCashDrawer()
begin
  String 20 CashBox;
  Integer Error;
  record SerPrintBlock SPb;

  BlockLoad(SPb);
  switch (SPb.Printer) begin
    case 1:
      CashBox = chr(27) & chr(112) & chr(0);
      Error = OpenComPort(1,"LPT1",9600,0,8,0,kFlowControlDefault);
      Error = OutComPort(1,CashBox);
      Error = CloseComPort(1);
    case 2:
      CashBox = chr(27) & chr(112) & chr(0) & chr(25) & chr(250);//ESC p       
      Error = OpenComPort(0,SPb.Port,SPb.BaudRate,SPb.Parity,SPb.ByteSize,SPb.StopBits,kFlowControlDefault);
      Error = OutComPort(0,CashBox);     
      Error = CloseComPort(0);
  end;
  return;
end;
Related topics:
««