📄 eventthread.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "EventThread.h"
#include "PCM3780_DIINTFRM.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall TEventThread::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall TEventThread::TEventThread(bool CreateSuspended)
: TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
void __fastcall TEventThread::Execute()
{
//---- Place thread code here ----
PT_CheckEvent ptCheckEvent;
USHORT usEventType;
DWORD dwErrCde;
USHORT usEventIndex;
float ratio;
char szBuf[10];
ptCheckEvent.EventType = &usEventType;
ptCheckEvent.Milliseconds = INFINITE;
Form1->m_dwStartTime = GetTickCount();
while(true){
dwErrCde = DRV_CheckEvent(Form1->m_lDriverHandle, &ptCheckEvent);
if(dwErrCde != SUCCESS){
Application->MessageBox( "Check Event Error!", "Driver Message", MB_OK );
return;
}
usEventIndex = usEventType - ADS_EVT_INTERRUPT_DI0;
if (usEventIndex < Form1->m_usMaxChanNum && usEventIndex>=0){
Form1->m_dwEventCount[usEventIndex]++;
}
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -