unit2.cpp

来自「并口测试程序」· C++ 代码 · 共 45 行

CPP
45
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit2.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 TOutputThread::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------
        void __fastcall outportb(WORD port, BYTE value);
        extern int nPulseHigh, nPulseLow, nOutput;
__fastcall TOutputThread::TOutputThread(bool CreateSuspended)
        : TThread(CreateSuspended)
{
        Priority = tpNormal;
        FreeOnTerminate = true;
        Resume();
}
//---------------------------------------------------------------------------
void __fastcall TOutputThread::Execute()
{
        while(!Terminated)
        {
                outportb(0x378,0xFF);
                MySleep(nPulseHigh);
                outportb(0x378,0x00);
                MySleep(nPulseLow);   
                if(!nOutput)
                        Terminate();

        }
}

⌨️ 快捷键说明

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