Hello,
i have a mistake with VM110.
Can you help me ?
#pragma once
namespace VM110_5 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices;
/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufügen.
//
}
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Timer^ timer1;
private: System::Windows::Forms::Label^ label1;
protected:
private: System::ComponentModel::IContainer^ components;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
#pragma region Windows Form Designer generated code
///
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
///
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->label1 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// timer1
//
this->timer1->Enabled = true;
this->timer1->Interval = 50;
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(109, 81);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(35, 13);
this->label1->TabIndex = 0;
this->label1->Text = L"label1";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
[DllImport ("k8055d.dll", CharSet=CharSet::Ansi)]
void ClearAllDigital();
[DllImport ("k8055d.dll", CharSet=CharSet::Ansi)]
int ReadAnalogChannel (int Channel);
[DllImport ("k8055d.dll", CharSet=CharSet::Ansi)]
void WriteAllDigital (int Data);
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
int wert;
double analog;
ClearAllDigital();
wert = ReadAnalogChannel (1);
analog = double (wert)/ 255 * 5;
label1 -> Text = analog.ToString () + " V";
WriteAllDigital (wert);
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}