getevent.pas

来自「16 relay output channels and 16 isolated」· PAS 代码 · 共 56 行

PAS
56
字号
unit GetEvent;

interface

uses
  Classes, Windows, SysUtils, Driver, Event;

type
  TGetEvent = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;

implementation
uses Unit1;

{ Important: Methods and properties of objects in VCL or CLX can only be used
  in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure GetEvent.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ GetEvent }
procedure TGetEvent.Execute;
var
        ptCheckEvent: PT_CheckEvent;
        usEventType: SHORT;
        dwEventCount: Longint;
begin
        dwEventCount := 0;
        ptCheckEvent.EventType := @usEventType;
        ptCheckEvent.Milliseconds := 1000;

        while ( m_bContinue) do
        begin
                if (DRV_CheckEvent(m_DriverHandle, ptCheckEvent) = SUCCESS) then
                begin
                        if (usEventType = ADS_EVT_INTERRUPT_TIMER4) then
                        begin
                                dwEventCount := dwEventCount + 1;
                                Unit1.Form1.editEventCount.Text := IntToStr(dwEventCount);
                        end;
                end;
        end;
end;

end.

⌨️ 快捷键说明

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