📄 f2812test.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "F2812TEST.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ioport=new PortDriver;
readport=0x378;
writeport=0x378;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
this->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2edit(TObject *Sender)
{
writeport=StrToInt(Edit2->Text);
// unsigned int data;
//data=ioport->InportWORD(readport);
//Edit1->Text=IntToStr(data);
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
unsigned int wdata,rdata;
wdata=StrToInt(Edit4->Text);
ioport->OutportWORD(writeport,(unsigned char)wdata);
// rdata=ioport->InportBYTE(readport);
//edit1->Text=IntToStr(rdata);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
Timer1->Enabled=CheckBox1->Checked;
if(CheckBox1->Checked==true)
{
unsigned int port1data;
port1data=ioport->InportWORD(writeport);
Edit3->Text=IntToStr((unsigned char)port1data);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
unsigned int port2data;
port2data=ioport->InportWORD(readport);
Edit5->Text=IntToStr((unsigned char)port2data);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
unsigned int port2data;
port2data=ioport->InportWORD(readport);
Edit5->Text=IntToStr((unsigned char)port2data);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -