?? unit1.cpp
字號:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "winio.h"
#include "Unit2.h"
#include "About.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int nPulseHigh, nPulseLow, nOutput = 0, nInput = 0;
AnsiString sInput;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
InitializeWinIo();
sInput = IntToBin(inportb(0x379));
LabeledEdit4->Text = sInput[29];
LabeledEdit5->Text = sInput[28];
LabeledEdit6->Text = sInput[27];
LabeledEdit7->Text = sInput[26];
LabeledEdit8->Text = sInput[25];
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
outportb(0x378,0x00);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
outportb(0x378,0xFF);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
Application->Terminate();
ShutdownWinIo();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
if(nOutput == 0)
{
nOutput = 1;
GroupBox1->Enabled = false;
Button4->Caption = "停止";
new TOutputThread(true);
}
else
{
nOutput = 0;
GroupBox1->Enabled = true;
Button4->Caption = "輸出脈沖";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1Change(TObject *Sender)
{
Edit1->Text = abs(Edit1->Text.ToIntDef(200));
if(Edit1->Text.ToInt() < 2)
Edit1->Text = 2;
if(Edit1->Text.ToInt() <= Edit2->Text.ToInt())
Edit2->Text = Edit1->Text.ToInt() - 1;
nPulseHigh = Edit2->Text.ToInt();
Label4->Caption = Edit1->Text.ToInt() - Edit2->Text.ToInt();
nPulseLow = Label4->Caption.ToInt();
Label6->Caption = 1000000/Edit1->Text.ToInt();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit2Change(TObject *Sender)
{
Edit2->Text = abs(Edit2->Text.ToIntDef(100));
if(Edit2->Text.ToInt() < 1)
Edit2->Text = 1;
if(Edit1->Text.ToInt() <= Edit2->Text.ToInt())
Edit2->Text = Edit1->Text.ToInt() - 1;
nPulseHigh = Edit2->Text.ToInt();
Label4->Caption = Edit1->Text.ToInt() - Edit2->Text.ToInt();
nPulseLow = Label4->Caption.ToInt();
Label6->Caption = 1000000/Edit1->Text.ToInt();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::About1Click(TObject *Sender)
{
AboutBox->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(nInput == 0)
{
nInput = 1;
GroupBox2->Enabled = false;
Button2->Caption = "停止";
new TInputThread(true);
}
else
{
nInput = 0;
GroupBox2->Enabled = true;
Button2->Caption = "獲取電平";
}
}
//---------------------------------------------------------------------------
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -