//--------------------------------------------------------------------------- #include #pragma hdrstop #include #include "iirou.h" #include "ACCES32.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; TPCI_COMMON_CONFIG buf[64]; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::UpdateDriverRegistry(void) { } //--------------------------------------------------------------------------- void __fastcall TForm1::ExitButtonClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::BeginSampleClick(TObject *Sender) { if (!RunFlag) sscanf(IsaEdit->Text.c_str(), "%x", &Address); if (RunTimer->Enabled) { RunTimer->Enabled = false; BeginSample->Caption = "Perform I/O"; } else { RunTimer->Enabled = true; BeginSample->Caption = "Stop I/O"; } } //--------------------------------------------------------------------------- void __fastcall TForm1::RunTimerTimer(TObject *Sender) { static int value[3] = {0,0,0}, i = 0; int j; unsigned y; char msg[9] = "00000000\0"; value[0] = 1 << i; OutPortB(Address, value[0]); y = GetTickCount() + 10; while (GetTickCount() < y) { Application->ProcessMessages(); }; value[1] = InPortB(Address+3); value[2] = InPortB(Address+1); i++; i %= 8; for (j=0; j < 8; j++) msg[7-j] = (((value[0] & (1 << j))>0) + 0x30); RelayOut->Caption = msg; for (j=0; j < 8; j++) msg[7-j] = (((value[1] & (1 << j))>0) + 0x30); RelayRead->Caption = msg; for (j=0; j < 8; j++) msg[7-j] = (((value[2] & (1 << j))>0) + 0x30); OptoIn->Caption = msg; } //--------------------------------------------------------------------------- void __fastcall TForm1::FormActivate(TObject *Sender) { if (!RunFlag) FocusControl(IsaEdit); } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { if (InPortB(0x61) == 0xAA55) { Application->MessageBox("ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.", "Warning", IDOK); } } //---------------------------------------------------------------------------