Vm110n

To programm my VM110N I like to know what language you can advice. As mechanical designer I have experience with the old “basic” programming. Where can I download the files? With kind regards Roddeman NL

You can I download the files from this page: velleman.eu/support/download … 110n&type=
Download and extracted the “VM110N software pack”.
In the examples subfolder there are example projects written in many programming languages.

For more info see the “K8055N & VM110N Getting Started.pdf”.

In the Exampes subfolder there are example projects written in following languages:
• Microsoft Visual Basic 2008 Express Edition
• Microsoft Visual C++ 2008 Express Edition
• Microsoft Visual C# 2008 Express Edition
• Microsoft Visual Basic 6.0
• Microsoft Excel VBA
• Borland Delphi 5
• Borland C++Builder 6
• Bloodshed Dev-C++

In 32-bit operating system, copy the DLL from the package’s folder \DLL_v5.0.0.0 to the \Windows\System32 folder .
In 64-bit operating system, copy the DLL to \Windows\SysWOW64 folder.

The program K8055N_Demo.exe is in the folder \Demo.
The source code is in the folder \Examples\K8055NDemoDelphi.

Thank you for your answer. I like have downloaded the files. The device is working well with hand control.

The problem remaining is that I do no have one of the languages you mention on your list. I like to learn to know the most simple one. Which one can you advice and were can I get the language and the tutorial.

With kind regards

May be it is good to explane what I like to do:

To make a program for a model train, to controle stop and go and return with two relais, based on micro-switches on the rail. This works already with mouse-clicks on the example screen. The switch indication is present.

When a micro switch is activated, the direction should be reversed automaticly with some time to stop. The stop time could be shozen random.

In which language can I work and are there example programs?

[quote]Which one can you advice and were can I get the language and the tutorial.[/quote]The free alternatives are Microsoft Visual (Basic, C++ and C#) Express Editions and Bloodshed Dev-C++.
The free Visual Basic 2010 Express is available to download here: https://www.visualstudio.com/downloads/download-visual-studio-vs

And here you’ll find the “Visual Basic Language Reference”: https://msdn.microsoft.com/en-us/library/sh9ywfdk(v=vs.100).aspx
And here are the “Getting Started Tutorials” etc: https://msdn.microsoft.com/en-us/library/dd642420(v=vs.100).aspx

I tried to follow your instructions, but the things that follow are too complicated for me. What can I do? with kind regards.

I think the easiest for you is to

Download the VM110 software package
velleman.eu/downloads/files/ … ev1206.zip

Open the K8055NDemoVB_2008 example in Visual Studio

Change the example to whatever you want

I have loaded the file as a project in Visual studio and get the controle screen. How can I change it?
I like to make a program that from a micro switch action a relais is activated automaticly, not by mouse click control.
kind regards

You can modify the timer event handler subroutine.
In the code editor locate the line “Private Sub Timer1_Tick…”
There after the line “Timer1.Enabled = False” add the following code: If ReadDigitalChannel(1) = True Then SetDigitalChannel(1) End If If ReadDigitalChannel(2) = True Then SetDigitalChannel(2) End If If ReadDigitalChannel(3) = True Then ClearDigitalChannel(1) ClearDigitalChannel(2) End If

Then start debugging by pressing F5.
On the VM110N user interface click Connect button as usually.
Now your program should do following actions:
Pressing button SW1 turns digital output 1 on.
Pressing button SW2 turns digital output 2 on.
Pressing button SW3 turns digital outputs 1 and 2 off.

SW1 and SW2 act now as the micro switches and outputs 1 and 2 the relays.

You can modify the code as you wish.

Here is the complete modified timer event handler code:[code] Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i As Integer
Dim Data1 As Integer
Dim Data2 As Integer
Timer1.Enabled = False

    If ReadDigitalChannel(1) = True Then
        SetDigitalChannel(1)
    End If
    If ReadDigitalChannel(2) = True Then
        SetDigitalChannel(2)
    End If
    If ReadDigitalChannel(3) = True Then
        ClearDigitalChannel(1)
        ClearDigitalChannel(2)
    End If

    i = ReadAllDigital
    CheckBox4.Checked = i And 1
    CheckBox5.Checked = (i >> 1) And 1
    CheckBox6.Checked = (i >> 2) And 1
    CheckBox7.Checked = (i >> 3) And 1
    CheckBox8.Checked = (i >> 4) And 1
    ReadAllAnalog(Data1, Data2)
    VScrollBar3.Value = 255 - Data1
    VScrollBar4.Value = 255 - Data2
    Label6.Text = CStr(Data1)
    Label7.Text = CStr(Data2)
    TextBox1.Text = CStr(ReadCounter(1))
    TextBox2.Text = CStr(ReadCounter(2))
    Timer1.Enabled = True
End Sub[/code]

Thank you for your answer.

Where can I find the code and the editor? In Form1.Designer.vb?

I managed to add things in the help and now I understand some operations.

Is it possible to add time delay in the actions? For instance the train is running by relay 1 and than stops by switch 1, returns by relay 2 but still holds and after some time runs by relay 1?

with kind regards.

[quote]Is it possible to add time delay in the actions? For instance the train is running by relay 1 and than stops by switch 1, returns by relay 2 but still holds and after some time runs by relay 1?[/quote]Yes, it is. The timer interval in the demo is 50ms. You can get digital output 3 to turn on and off every 500ms by this code added to the timer subroutine: n = n + 1 If n = 10 Then SetDigitalChannel(3) End If If n = 20 Then ClearDigitalChannel(3) n = 0 End If

Thank you for the timer. In the library in town I found a book in Dutch to learn VB 2010. Now I can write a simple program and try to understand yours. With kind regards.

No problem. Glad to be of assistance :slight_smile:

The programm and the card is working, inclusive a given waiting time. Thank you for your support.

When I trie to give the waiting time from a textbox, which is working in other, not published programms I get a failure :
aantalr = 10 * CInt(TextBox4.Text)

A first chance exception of type ‘System.InvalidCastException’ occurred in Microsoft.VisualBasic.dll

How can I repair it? With kind regards

You should enter only integer values to the TextBox4 (no commas or dots).