Uses Crt, RS232int;

Var
 DELAY1, DELAY2, DELAY3 : Word;

Procedure SendOn;
Begin
 Port[$3FC]:= 0; {включение передачи: DTR=0}
End;

Procedure SendOff;
Begin
 Port[$3FC]:= 1; {выключение передачи: DTR=1}
End;

Begin
 DELAY1:= 10; DELAY2:= 10; DELAY3:= 10;

 InitRS232(1, nil, 9600, 3); {инициализируем порт}
 SendOff;

 While (True) do begin
  SendOn;
  Delay(DELAY1);
  OutByteToRS232($55);
  OutByteToRS232($55);
  OutByteToRS232($55);
  OutByteToRS232($55);
  Delay(DELAY2);
  SendOff;
  Delay(DELAY3);

  If (KeyPressed) then begin
   Case ReadKey of
    {Клавиша ESC - выход}
    #27: Break;
    {изменение величины DELAY1}
    '1': DELAY1:= DELAY1 + 10;
    '2': DELAY1:= DELAY1 - 10;
    {изменение величины DELAY2}
    '3': DELAY2:= DELAY1 + 10;
    '4': DELAY2:= DELAY1 - 10;
    {изменение величины DELAY3}
    '5': DELAY1:= DELAY1 + 10;
    '6': DELAY1:= DELAY1 - 10;
   End;
   WriteLn('DELAY1=', DELAY1);
   WriteLn('DELAY2=', DELAY2);
   WriteLn('DELAY3=', DELAY3);
  End;

 End;

 While KeyPressed do ReadKey;

 CloseRS232;
End.
