Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
unit Blikac;
2
 
3
interface
4
 
5
uses PortInc,Windows, Messages, SysUtils, Classes,
6
  Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
7
 
8
type
9
  TForm1 = class(TForm)
10
    ScrollBar1: TScrollBar; Edit1: TEdit;
11
    Timer1: TTimer;
12
    ScrollBar2: TScrollBar;
13
    Edit2: TEdit;
14
    StaticText1: TStaticText;
15
    StaticText2: TStaticText;
16
    CheckBox1: TCheckBox;
17
    procedure ScrollBar1Change(Sender: TObject);
18
    procedure FormCreate(Sender: TObject);
19
    procedure Timer1Timer(Sender: TObject);
20
    procedure ScrollBar2Change(Sender: TObject);
21
    procedure CheckBox1Click(Sender: TObject);
22
  end;
23
 
24
var
25
  Form1: TForm1;
26
 
27
implementation
28
{$R *.DFM}
29
var Vystup: Integer;
30
 
31
procedure TForm1.ScrollBar1Change(Sender: TObject);
32
begin
33
  Edit1.Text := floattostr(Scrollbar1.Position)+ ' us';
34
end;
35
 
36
procedure TForm1.ScrollBar2Change(Sender: TObject);
37
begin
38
  Edit2.Text := floattostr(Scrollbar2.Position)+ ' us';
39
end;
40
 
41
procedure TForm1.FormCreate(Sender: TObject);
42
begin
43
  OpenCom (Pchar('COM1:9600,N,8,1'));
44
//!!!!
45
  Timer1.Enabled := true;
46
  Vystup := 0;
47
  Timer1.Interval := 1000;
48
end;
49
 
50
procedure TForm1.Timer1Timer(Sender: TObject);
51
var n: integer;
52
begin
53
  for n:=1 to 5000000 div(Scrollbar1.Position+Scrollbar2.Position) do
54
  begin
55
    DTR (1);
56
//    RTS (1);
57
//    delayus(Scrollbar1.Position);
58
    DTR (0);
59
//    RTS (0);
60
//    delayus(Scrollbar2.Position);
61
  end;
62
    DTR (0);
63
    RTS (0);
64
end;
65
 
66
procedure TForm1.CheckBox1Click(Sender: TObject);
67
begin
68
 if CheckBox1.Checked then DTR (1) else DTR(0);
69
end;
70
 
71
end.