Problem with VM110

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) {
		 }

Your code doesn’t seem to call OpenDevice(). It should do that in Form1_Load().

Regards,
Jan

Helo Jan,

no, thats wasn’t the mistake.

Best wishes

Please see the
velleman.eu/support/download … 055n&type=
“K8055N software pack”
There is a working demo program written in Visual C++ 2008 in the folder:
\Examples\K8055NDemoVC_2008\K8055Demo

[quote=“Nutnic”]Helo Jan,

no, thats wasn’t the mistake.

Best wishes[/quote]
There may be multiple mistakes in that program. Not calling OpenDevice is certainly one of them.

Regards,
Jan