Problem mit USB Board



  • Hallo,

    Habe mir ein USB Board von Conrad gekauft, das K8055. Bisher gab es auch keine Probleme, ich kann mit dem Demo- Programm auf das Board zugreifen und es funktioniert alles. Ich will aber ein C++ Programm für das Board schreiben, dazu hab ich auch ein Beispiel- Programm, aber wenn ich dieses in C++ Builder ausführe dann öffnet sich ein Fenster "Package Import nicht gefunden: dss.bpi "
    Eine solche Datei habe ich nicht und ich weiß leider nicht wo das Problem liegt.

    Bitte um Hilfe

    K8055_Demo.cpp

    //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #pragma hdrstop
    //---------------------------------------------------------------------------
    USEFORM("Unit1.cpp", Form1);
    //---------------------------------------------------------------------------
    WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
            try
            {
                     Application->Initialize();
                     Application->CreateForm(__classid(TForm1), &Form1);
         Application->Run();
            }
            catch (Exception &exception)
            {
                     Application->ShowException(&exception);
            }
            catch (...)
            {
                     try
                     {
                             throw Exception("");
                     }
                     catch (Exception &exception)
                     {
                             Application->ShowException(&exception);
                     }
            }
            return 0;
    }
    

    Unit1.cpp

    //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #pragma hdrstop
    
    #include "Unit1.h"
    #include "K8055D_C.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
      bool DisableOtherFunctionCall = false;
      int n=8;
    //---------------------------------------------------------------------------
    
    __fastcall TForm1::TForm1(TComponent* Owner)
            : TForm(Owner)
    {
    
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::Connect1Click(TObject *Sender)
    {
      int CardAddr = 3 - (int(CheckBox1->Checked) + int(CheckBox2->Checked) * 2);
      int h = OpenDevice(CardAddr);
      switch (h) {
        case  0:
        case  1:
        case  2:
        case  3: 
          Label1->Caption = "Card " + IntToStr(h) + " connected";
          Timer1->Enabled = true;
          break;
        case  -1 :
          Label1->Caption = "Card " + IntToStr(CardAddr) + " not found";
      }
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
    {
      CloseDevice();
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::FormCreate(TObject *Sender)
    {
        for (int i=0;i<8;i++)    // Create Output Check Boxes
        {
            op[i] = new TCheckBox(GroupBox7);
            op[i]->Name = "Outbox" + IntToStr(i+1);
            op[i]->Caption = IntToStr(i+1);
            op[i]->Width = 30;
            op[i]->Left = 28 * i + 12;
            op[i]->Top = 20;
            op[i]->Parent = GroupBox7;
            op[i]->OnClick = OutBoxClick;
        }
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::SetAllDigital1Click(TObject *Sender)
    {
      SetAllDigital();
      DisableOtherFunctionCall = true;
      for (int i=0;i<8;i++)
      {
        op[i]->Checked = true;
      }
      DisableOtherFunctionCall = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::OutBoxClick(TObject *Sender)
    {
        int k = 0;
        int n = 1;
        for (int i=0;i<8;i++)
        {
          if (op[i]->Checked == true)
          {
            k = k + n;
          }
          n = n * 2;
        }
        if (DisableOtherFunctionCall == false)
          WriteAllDigital(k);
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::ClearAllDigital1Click(TObject *Sender)
    {
      ClearAllDigital();
      DisableOtherFunctionCall = true;
      for (int i=0;i<8;i++)
      {
        op[i]->Checked = false;
      }
      DisableOtherFunctionCall = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::SetAllAnalog1Click(TObject *Sender)
    {
      SetAllAnalog();
      DisableOtherFunctionCall = true;
      DAC1->Position = 0;
      DAC2->Position = 0;
      DisableOtherFunctionCall = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::ClearAllAnalog1Click(TObject *Sender)
    {
      ClearAllAnalog();
      DisableOtherFunctionCall = true;
      DAC1->Position = 255;
      DAC2->Position = 255;
      DisableOtherFunctionCall = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::DAC1Change(TObject *Sender)
    {
      if (DisableOtherFunctionCall == false)
        OutputAnalogChannel(1, 255-DAC1->Position);
      Label2->Caption = 255 - DAC1->Position;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::DAC2Change(TObject *Sender)
    {
      if (DisableOtherFunctionCall == false)
        OutputAnalogChannel(2, 255-DAC2->Position);
      Label3->Caption = 255 - DAC2->Position;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::Timer1Timer(TObject *Sender)
    {
      Timer1->Enabled = false;
      long Data1;
      long Data2;
      long i;
      ReadAllAnalog(&Data1, &Data2);
      AD1->Position = Data1;
      AD2->Position = Data2;
      Label4->Caption = IntToStr(Data1);
      Label5->Caption = IntToStr(Data2);
      Counter1->Text = IntToStr(ReadCounter(1));
      Counter2->Text = IntToStr(ReadCounter(2));
      i = ReadAllDigital();
      CheckBox3->Checked = (i & 1)>0;
      CheckBox4->Checked = (i & 2)>0;
      CheckBox5->Checked = (i & 4)>0;
      CheckBox6->Checked = (i & 8)>0;
      CheckBox7->Checked = (i & 16)>0;
      Timer1->Enabled = true;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::ResetCounter1Click(TObject *Sender)
    {
      ResetCounter(1);
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::ResetCounter2Click(TObject *Sender)
    {
      ResetCounter(2);
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::DebounceTime1Click(TObject *Sender)
    {
      long t1;
       switch (DebounceTime1->ItemIndex) {
        case  0 : t1 = 0;
          break;
        case  1 : t1 = 2;
          break;
        case  2 : t1 = 10;
          break;
        case  3 : t1 = 1000;
       }
      SetCounterDebounceTime(1,t1);
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::DebounceTime2Click(TObject *Sender)
    {
      long t2;
       switch (DebounceTime2->ItemIndex) {
        case  0 : t2 = 0;
          break;
        case  1 : t2 = 2;
          break;
        case  2 : t2 = 10;
          break;
        case  3 : t2 = 1000;
       }
      SetCounterDebounceTime(2,t2);
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::OutputTest1Click(TObject *Sender)
    {
        Timer2->Enabled = OutputTest1->Down;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::Timer2Timer(TObject *Sender)
    {
      ClearDigitalChannel(n);
      op[n-1]->Checked = false;
      n = n +1;
      if (n == 9)
        n = 1;
      SetDigitalChannel(n);
      op[n-1]->Checked = true;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      int intDevices;
      bool bChecked;
      bChecked = false;
      intDevices = SearchDevices();          // Find devices command
      if (intDevices) {                      // If any device was found
       GroupBox1->Enabled = false;           // Disable buttons
       Connect1->Enabled = false;
       GroupBox10->Enabled = true;
       Timer1->Enabled = true;
      }
      if (intDevices & 1) {      // Device 0 = connected
        RadioButton1->Enabled = true;         // Enable the radio button
        if (!bChecked) {
    			RadioButton1->Checked = true;       // Set radio button check
          SetCurrentDevice (0);               // Set the current device command
          bChecked = true;
        }
      } else RadioButton1->Enabled = false;  // Disable radio button
    
        if (intDevices & 2) {      // Device 1 = connected
        RadioButton2->Enabled = true;         // Enable the radio button
        if (!bChecked) {
    			RadioButton2->Checked = true;       // Set radio button check
          SetCurrentDevice (1);               // Set the current device command
          bChecked = true;
        }
      } else RadioButton2->Enabled = false;  // Disable radio button
    
      if (intDevices & 4) {      // Device 2 = connected
        RadioButton3->Enabled = true;         // Enable the radio button
        if (!bChecked) {
    			RadioButton3->Checked = true;       // Set radio button check
          SetCurrentDevice (2);               // Set the current device command
          bChecked = true;
        }
      } else RadioButton3->Enabled = false;  // Disable radio button
    
        if (intDevices & 8) {      // Device 3 = connected
        RadioButton4->Enabled = true;         // Enable the radio button
        if (!bChecked) {
    			RadioButton4->Checked = true;       // Set radio button check
          SetCurrentDevice (3);               // Set the current device command
          bChecked = true;
        }
      } else RadioButton4->Enabled = false;  // Disable radio button
    
      if (bChecked) Button1->Enabled = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::RadioButton1Click(TObject *Sender)
    {
      SetCurrentDevice (0);               // Set the current device command
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::RadioButton2Click(TObject *Sender)
    {
      SetCurrentDevice (1);               // Set the current device command
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::RadioButton3Click(TObject *Sender)
    {
      SetCurrentDevice (2);               // Set the current device command  
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::RadioButton4Click(TObject *Sender)
    {
      SetCurrentDevice (3);               // Set the current device command  
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
      Version();  
    }
    //---------------------------------------------------------------------------
    

    Unit1.h

    //---------------------------------------------------------------------------
    
    #ifndef Unit1H
    #define Unit1H
    //---------------------------------------------------------------------------
    #include <Classes.hpp>
    #include <Controls.hpp>
    #include <StdCtrls.hpp>
    #include <Forms.hpp>
    #include <ComCtrls.hpp>
    #include <Buttons.hpp>
    #include <ExtCtrls.hpp>
    //---------------------------------------------------------------------------
    class TForm1 : public TForm
    {
    __published:	// IDE-managed Components
            TGroupBox *GroupBox1;
            TCheckBox *CheckBox1;
            TCheckBox *CheckBox2;
      TButton *Connect1;
            TLabel *Label1;
            TGroupBox *GroupBox2;
            TLabel *Label2;
      TTrackBar *DAC1;
            TGroupBox *GroupBox3;
            TLabel *Label3;
      TTrackBar *DAC2;
            TGroupBox *GroupBox4;
            TLabel *Label4;
      TProgressBar *AD1;
      TSpeedButton *OutputTest1;
      TButton *SetAllDigital1;
      TButton *ClearAllDigital1;
      TButton *SetAllAnalog1;
            TButton *ClearAllAnalog1;
            TGroupBox *GroupBox5;
            TLabel *Label5;
      TProgressBar *AD2;
            TGroupBox *GroupBox6;
            TGroupBox *GroupBox7;
            TGroupBox *GroupBox8;
      TEdit *Counter1;
      TButton *ResetCounter1;
      TRadioGroup *DebounceTime1;
            TGroupBox *GroupBox9;
      TEdit *Counter2;
      TButton *ResetCounter2;
      TRadioGroup *DebounceTime2;
            TTimer *Timer1;
            TTimer *Timer2;
      TCheckBox *CheckBox3;
      TCheckBox *CheckBox4;
      TCheckBox *CheckBox5;
      TCheckBox *CheckBox6;
      TCheckBox *CheckBox7;
      TGroupBox *GroupBox10;
      TRadioButton *RadioButton1;
      TRadioButton *RadioButton2;
      TRadioButton *RadioButton3;
      TRadioButton *RadioButton4;
      TLabel *Label6;
      TButton *Button1;
      TButton *Button2;
            void __fastcall Connect1Click(TObject *Sender);
      void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
      void __fastcall SetAllDigital1Click(TObject *Sender);
      void __fastcall OutBoxClick(TObject *Sender);
      void __fastcall ClearAllDigital1Click(TObject *Sender);
      void __fastcall SetAllAnalog1Click(TObject *Sender);
      void __fastcall DAC1Change(TObject *Sender);
      void __fastcall DAC2Change(TObject *Sender);
      void __fastcall ClearAllAnalog1Click(TObject *Sender);
      void __fastcall FormCreate(TObject *Sender);
      void __fastcall Timer1Timer(TObject *Sender);
      void __fastcall ResetCounter1Click(TObject *Sender);
      void __fastcall ResetCounter2Click(TObject *Sender);
      void __fastcall DebounceTime1Click(TObject *Sender);
      void __fastcall DebounceTime2Click(TObject *Sender);
      void __fastcall OutputTest1Click(TObject *Sender);
      void __fastcall Timer2Timer(TObject *Sender);
      void __fastcall Button1Click(TObject *Sender);
      void __fastcall RadioButton1Click(TObject *Sender);
      void __fastcall RadioButton2Click(TObject *Sender);
      void __fastcall RadioButton3Click(TObject *Sender);
      void __fastcall RadioButton4Click(TObject *Sender);
      void __fastcall Button2Click(TObject *Sender);
    private:	// User declarations
      TCheckBox* op[8];
      TCheckBox* ip[5];
    public:		// User declarations
            __fastcall TForm1(TComponent* Owner);
    };
    //---------------------------------------------------------------------------
    extern PACKAGE TForm1 *Form1;
    //---------------------------------------------------------------------------
    #endif
    

    So sieht das Projekt in Borland aus:
    [IMG]http://www.bilder-space.de/show_img.php?img=13773d-1295782102.jpg&size=thumb[/IMG]

    Mfg. pHL


Anmelden zum Antworten