⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formstat.pas

📁 16 relay output channels and 16 isolated digital input channels LED indicators to show activated
💻 PAS
字号:
unit FormStat;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Buttons;

type
  TfrmStatus = class(TForm)
    Panel9: TPanel;
    chkBitEnable0: TCheckBox;
    chkBitEnable1: TCheckBox;
    chkBitEnable3: TCheckBox;
    chkBitEnable2: TCheckBox;
    chkBitEnable5: TCheckBox;
    chkBitEnable4: TCheckBox;
    chkBitEnable7: TCheckBox;
    chkBitEnable6: TCheckBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    cmdStatusOK: TBitBtn;
    cmdCancel: TBitBtn;
    chkFalling7: TCheckBox;
    chkRising7: TCheckBox;
    chkRising6: TCheckBox;
    chkFalling6: TCheckBox;
    chkRising5: TCheckBox;
    chkFalling5: TCheckBox;
    chkRising4: TCheckBox;
    chkFalling4: TCheckBox;
    chkRising3: TCheckBox;
    chkFalling3: TCheckBox;
    chkRising2: TCheckBox;
    chkFalling2: TCheckBox;
    chkRising1: TCheckBox;
    chkFalling1: TCheckBox;
    chkRising0: TCheckBox;
    chkFalling0: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure chkBitEnable7Click(Sender: TObject);
    procedure chkBitEnable6Click(Sender: TObject);
    procedure chkBitEnable5Click(Sender: TObject);
    procedure chkBitEnable4Click(Sender: TObject);
    procedure chkBitEnable3Click(Sender: TObject);
    procedure chkBitEnable2Click(Sender: TObject);
    procedure chkBitEnable1Click(Sender: TObject);
    procedure chkBitEnable0Click(Sender: TObject);
    procedure cmdStatusOKClick(Sender: TObject);
    procedure cmdCancelClick(Sender: TObject);
    procedure chkRising7Click(Sender: TObject);
    procedure chkRising6Click(Sender: TObject);
    procedure chkRising5Click(Sender: TObject);
    procedure chkRising4Click(Sender: TObject);
    procedure chkRising3Click(Sender: TObject);
    procedure chkRising2Click(Sender: TObject);
    procedure chkRising1Click(Sender: TObject);
    procedure chkRising0Click(Sender: TObject);
    procedure chkFalling7Click(Sender: TObject);
    procedure chkFalling6Click(Sender: TObject);
    procedure chkFalling5Click(Sender: TObject);
    procedure chkFalling4Click(Sender: TObject);
    procedure chkFalling3Click(Sender: TObject);
    procedure chkFalling2Click(Sender: TObject);
    procedure chkFalling1Click(Sender: TObject);
    procedure chkFalling0Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    EnableMask: Integer;
    RisingEdge: Integer;
    FallingEdge: Integer;
	 bCancel: boolean;
  end;

var
  frmStatus: TfrmStatus;

implementation

{$R *.DFM}


procedure TfrmStatus.FormCreate(Sender: TObject);
begin
	EnableMask  := 0;
	RisingEdge  := 0;
	FallingEdge := 0;
	bCancel     := false;
end;               

procedure TfrmStatus.chkBitEnable7Click(Sender: TObject);
begin
	If chkBitEnable7.Checked = True Then
     Begin
   	EnableMask := EnableMask or $80;
		chkRising7.Enabled := True;
        chkFalling7.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $7F;
	RisingEdge := RisingEdge and $7F;
	FallingEdge := FallingEdge and $7F;
	chkRising7.Enabled := False;
        chkFalling7.Enabled := False;
	chkRising7.Checked := False;
        chkFalling7.Checked := False;
     End
end;


procedure TfrmStatus.chkBitEnable6Click(Sender: TObject);
begin
	If chkBitEnable6.Checked = True Then
     Begin
   	EnableMask := EnableMask or $40;
		chkRising6.Enabled := True;
      chkFalling6.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $BF;
	RisingEdge := RisingEdge and $BF;
	FallingEdge := FallingEdge and $BF;
	chkRising6.Enabled := False;
        chkFalling6.Enabled := False;
	chkRising6.Checked := False;
        chkFalling6.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable5Click(Sender: TObject);
begin
	If chkBitEnable5.Checked = True Then
     Begin
   	EnableMask := EnableMask or $20;
		chkRising5.Enabled := True;
      chkFalling5.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $DF;
	RisingEdge := RisingEdge and $DF;
	FallingEdge := FallingEdge and $DF;
	chkRising5.Enabled := False;
        chkFalling5.Enabled := False;
	chkRising5.Checked := False;
        chkFalling5.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable4Click(Sender: TObject);
begin
	If chkBitEnable4.Checked = True Then
     Begin
   	EnableMask := EnableMask or $10;
		chkRising4.Enabled := True;
      chkFalling4.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $EF;
	RisingEdge := RisingEdge and $EF;
	FallingEdge := FallingEdge and $EF;
	chkRising4.Enabled := False;
        chkFalling4.Enabled := False;
	chkRising4.Checked := False;
        chkFalling4.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable3Click(Sender: TObject);
begin
	If chkBitEnable3.Checked = True Then
     Begin
   	EnableMask := EnableMask or $08;
		chkRising3.Enabled := True;
      chkFalling3.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $F7;
	RisingEdge := RisingEdge and $F7;
	FallingEdge := FallingEdge and $F7;
	chkRising3.Enabled := False;
        chkFalling3.Enabled := False;
	chkRising3.Checked := False;
        chkFalling3.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable2Click(Sender: TObject);
begin
	If chkBitEnable2.Checked = True Then
     Begin
   	EnableMask := EnableMask or $04;
		chkRising2.Enabled := True;
      chkFalling2.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $FB;
	RisingEdge := RisingEdge and $FB;
	FallingEdge := FallingEdge and $FB;
	chkRising2.Enabled := False;
        chkFalling2.Enabled := False;
	chkRising2.Checked := False;
        chkFalling2.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable1Click(Sender: TObject);
begin
	If chkBitEnable1.Checked = True Then
     Begin
   	EnableMask := EnableMask or $02;
		chkRising1.Enabled := True;
      chkFalling1.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $FD;
	RisingEdge := RisingEdge and $FD;
	FallingEdge := FallingEdge and $FD;
	chkRising1.Enabled := False;
        chkFalling1.Enabled := False;
	chkRising1.Checked := False;
        chkFalling1.Checked := False;
     End
end;

procedure TfrmStatus.chkBitEnable0Click(Sender: TObject);
begin
	If chkBitEnable0.Checked = True Then
     Begin
   	EnableMask := EnableMask or $01;
		chkRising0.Enabled := True;
      chkFalling0.Enabled := True;
     End
   Else
     Begin
   	EnableMask := EnableMask and $FE;
	RisingEdge := RisingEdge and $FE;
	FallingEdge := FallingEdge and $FE;
	chkRising0.Enabled := False;
        chkFalling0.Enabled := False;
	chkRising0.Checked := False;
        chkFalling0.Checked := False;
     End
end;

procedure TfrmStatus.cmdStatusOKClick(Sender: TObject);
begin
	bCancel := False;
   Hide;
end;

procedure TfrmStatus.cmdCancelClick(Sender: TObject);
begin
	bCancel := True;
   Hide;
end;

procedure TfrmStatus.chkRising7Click(Sender: TObject);
begin
	If chkRising7.Checked Then
		RisingEdge := RisingEdge or $80
   Else
		RisingEdge := RisingEdge and $7F;
end;

procedure TfrmStatus.chkRising6Click(Sender: TObject);
begin
	If chkRising6.Checked Then
		RisingEdge := RisingEdge or $40
   Else
		RisingEdge := RisingEdge and $BF;
end;

procedure TfrmStatus.chkRising5Click(Sender: TObject);
begin
	If chkRising5.Checked Then
		RisingEdge := RisingEdge or $20
   Else
		RisingEdge := RisingEdge and $DF;
end;

procedure TfrmStatus.chkRising4Click(Sender: TObject);
begin
	If chkRising4.Checked Then
		RisingEdge := RisingEdge or $10
   Else
		RisingEdge := RisingEdge and $EF;
end;

procedure TfrmStatus.chkRising3Click(Sender: TObject);
begin
	If chkRising3.Checked Then
		RisingEdge := RisingEdge or $08
   Else
		RisingEdge := RisingEdge and $F7;
end;

procedure TfrmStatus.chkRising2Click(Sender: TObject);
begin
	If chkRising2.Checked Then
		RisingEdge := RisingEdge or $04
   Else
		RisingEdge := RisingEdge and $FB;
end;

procedure TfrmStatus.chkRising1Click(Sender: TObject);
begin
	If chkRising1.Checked Then
		RisingEdge := RisingEdge or $02
   Else
		RisingEdge := RisingEdge and $FD;
end;

procedure TfrmStatus.chkRising0Click(Sender: TObject);
begin
	If chkRising0.Checked Then
		RisingEdge := RisingEdge or $01
   Else
		RisingEdge := RisingEdge and $FE;
end;

procedure TfrmStatus.chkFalling7Click(Sender: TObject);
begin
	If chkFalling7.Checked Then
		FallingEdge := FallingEdge or $80
   Else
		FallingEdge := FallingEdge and $7F;
end;

procedure TfrmStatus.chkFalling6Click(Sender: TObject);
begin
	If chkFalling6.Checked Then
		FallingEdge := FallingEdge or $40
   Else
		FallingEdge := FallingEdge and $BF;
end;

procedure TfrmStatus.chkFalling5Click(Sender: TObject);
begin
	If chkFalling5.Checked Then
		FallingEdge := FallingEdge or $20
   Else
		FallingEdge := FallingEdge and $DF;
end;

procedure TfrmStatus.chkFalling4Click(Sender: TObject);
begin
	If chkFalling4.Checked Then
		FallingEdge := FallingEdge or $10
   Else
		FallingEdge := FallingEdge and $EF;
end;

procedure TfrmStatus.chkFalling3Click(Sender: TObject);
begin
	If chkFalling3.Checked Then
		FallingEdge := FallingEdge or $08
   Else
		FallingEdge := FallingEdge and $F7;
end;

procedure TfrmStatus.chkFalling2Click(Sender: TObject);
begin
	If chkFalling2.Checked Then
		FallingEdge := FallingEdge or $04
   Else
		FallingEdge := FallingEdge and $FB;
end;

procedure TfrmStatus.chkFalling1Click(Sender: TObject);
begin
	If chkFalling1.Checked Then
		FallingEdge := FallingEdge or $02
   Else
		FallingEdge := FallingEdge and $FD;
end;

procedure TfrmStatus.chkFalling0Click(Sender: TObject);
begin
	If chkFalling0.Checked Then
		FallingEdge := FallingEdge or $01
   Else
		FallingEdge := FallingEdge and $FE;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -