//--------------------------------------------------------------------------- #include #pragma hdrstop #include "PACSDK.h" #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::btnWriteDOClick(TObject *Sender) { char strErr[32] ; unsigned long DOValue=StrToInt("$"+etDOValue->Text); //HexToInt bool bRet=pac_WriteDO(0,cmbSlot->ItemIndex +1,StrToInt(etDOTotalChs->Text ),DOValue); if(bRet==false) { pac_GetErrorMessage(pac_GetLastError(), strErr); MessageBox(NULL,strErr,"Write DO error",MB_OK); } } //--------------------------------------------------------------------------- void __fastcall TForm1::btnClearDOClick(TObject *Sender) { char strErr[32] ; bool bRet=pac_WriteDO(0,cmbSlot->ItemIndex +1,StrToInt(etDOTotalChs->Text ),0); if(bRet==false) { pac_GetErrorMessage(pac_GetLastError(), strErr); MessageBox(NULL,strErr,"Clear DO error",MB_OK); } etDOValue->Text ="0"; } //--------------------------------------------------------------------------- void __fastcall TForm1::btnReadDIClick(TObject *Sender) { char strErr[32] ; unsigned long DIValue,DOValue; bool bRet=pac_ReadDIO(0,cmbSlot->ItemIndex +1,StrToInt(etDITotalChs->Text ),StrToInt(etDOTotalChs->Text ), &DIValue,&DOValue ); if(bRet==false) { pac_GetErrorMessage(pac_GetLastError(), strErr); MessageBox(NULL,strErr,"Read DI error",MB_OK); } else etDIValue->Text = IntToHex((int)DIValue,StrToInt(etDITotalChs->Text )/4); } //---------------------------------------------------------------------------