USB experimentation board – part 2

I finaly figured out how to compile and run the library and gui program for the Velleman k8055 board on Ubuntu Linux.

First I downloaded this: libk8055.
But this library contains an error in the header file, it is missing a line, so edit the k8055h file and add the following line:
int ReadAllValues(long int *data1, long int * data2, long int * data3, long int * data4, long int * data5);

To compile and install the library type in the following commands in the command prompt:
make
sudo make install

Next: I downloaded the gui program: k8055gui.
This requires a couple of libraries to be installed on your system first:
sudo apt-get install libwxbase2.8-0 libwxbase2.8-dev libwxgtk2.8-0 libwxgtk2.8-dev libusb-dev

This program also contains an error, to fix this you need to edit the MyFrame.cpp file, and replace (a small remark, thanks to Vincent in the comments below: mind the double quotes!):
#include <k8055.h>

with
extern “C” {
#include <k8055.h>
}

To compile, type in the command window:
make

To start the gui program:
sudo ./k8055gui

I’ll try to find a way so you don’t need to be root to execute the gui program.

Tags: , ,

11 Responses to “USB experimentation board – part 2”

  1. Panic1 says:

    Do note: for one strange reason the counters are swapped… pressing button 1 increases the counter 2 and button 2 will increase the counter 1. The debounce settings do correspond to the correct buttons.
    And the output test is not yet implemented.

  2. Merlin says:

    I checked, the buttons work correctly, but please give notice to download repaired v0.3 of libk8055. This works for me!
    And yes what will we do with root access?

  3. Panic1 says:

    There is a tutorial of how to set up non-root access to the experimentation board on the libk8055 website: http://libk8055.sourceforge.net/

    But I haven’t tried it yet.

  4. Merlin says:

    Have you tried the python files?
    They have promising pictures, but they do not compile. Let’s investigate.

  5. Panic1 says:

    No, I haven’t tried the python library. I have never worked with python before, as far as I know, it is a scripting language that don’t need to be compiled.

  6. Merlin says:

    I can compile it. Unfortunately, it is forgoten thet the Qt is version 3 not 4. Keeping this in mind it should bestraightforward.

  7. Bodhi says:

    I can’t get this to compile ‘make’ after editing the MyFrame.cpp file, i get …

    g++ `wx-config –libs` -o k8055gui MyApp.o MyFrame.o -lusb -lm -lk8055
    MyFrame.o: In function `MyFrame::WriteDigital()’:
    MyFrame.cpp:(.text+0x16fa): undefined reference to `WriteAllDigital(long)’
    MyFrame.o: In function `MyFrame::WriteAnalog()’:
    MyFrame.cpp:(.text+0x1c65): undefined reference to `OutputAllAnalog(long, long)’
    MyFrame.o: In function `MyFrame::WriteDebounce2()’:
    MyFrame.cpp:(.text+0x1ea4): undefined reference to `SetCounterDebounceTime(long, long)’
    MyFrame.o: In function `MyFrame::WriteDebounce1()’:
    MyFrame.cpp:(.text+0x1f7e): undefined reference to `SetCounterDebounceTime(long, long)’
    MyFrame.o: In function `MyFrame::WriteAll()’:
    MyFrame.cpp:(.text+0x20ec): undefined reference to `WriteAllDigital(long)’
    MyFrame.cpp:(.text+0x213a): undefined reference to `OutputAllAnalog(long, long)’
    MyFrame.o: In function `MyFrame::OnIdle(wxIdleEvent&)’:
    MyFrame.cpp:(.text+0×2204): undefined reference to `ReadAllValues(long*, long*, long*, long*, long*)’
    MyFrame.o: In function `MyFrame::OnBnClickedResct2(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0×2459): undefined reference to `ResetCounter(long)’
    MyFrame.o: In function `MyFrame::OnBnClickedResct1(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0x24a9): undefined reference to `ResetCounter(long)’
    MyFrame.o: In function `MyFrame::OnBnClickedConnect(wxCommandEvent&)’:
    MyFrame.cpp:(.text+0×2524): undefined reference to `OpenDevice(long)’
    collect2: ld returned 1 exit status
    make: *** [k8055gui] Error 1

    or unedited MyFrame.cpp file, i get …

    g++ `wx-config –cxxflags` -c MyFrame.cpp -o MyFrame.o
    MyFrame.cpp:22: error: stray ‘\342’ in program
    MyFrame.cpp:22: error: stray ‘\200’ in program
    MyFrame.cpp:22: error: stray ‘\234’ in program
    MyFrame.cpp:22: error: stray ‘\342’ in program
    MyFrame.cpp:22: error: stray ‘\200’ in program
    MyFrame.cpp:22: error: stray ‘\235’ in program
    MyFrame.cpp:22: error: function definition does not declare parameters
    MyFrame.cpp: In member function ‘void MyFrame::OnBnClickedConnect(wxCommandEvent&)’:
    MyFrame.cpp:153: error: ‘OpenDevice’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::OnBnClickedResct1(wxCommandEvent&)’:
    MyFrame.cpp:318: error: ‘ResetCounter’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::OnBnClickedResct2(wxCommandEvent&)’:
    MyFrame.cpp:333: error: ‘ResetCounter’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::OnIdle(wxIdleEvent&)’:
    MyFrame.cpp:354: error: ‘ReadAllValues’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::WriteDigital()’:
    MyFrame.cpp:389: error: ‘WriteAllDigital’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::WriteAnalog()’:
    MyFrame.cpp:400: error: ‘OutputAllAnalog’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::WriteDebounce1()’:
    MyFrame.cpp:418: error: ‘SetCounterDebounceTime’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::WriteDebounce2()’:
    MyFrame.cpp:436: error: ‘SetCounterDebounceTime’ was not declared in this scope
    MyFrame.cpp: In member function ‘void MyFrame::WriteAll()’:
    MyFrame.cpp:447: error: ‘WriteAllDigital’ was not declared in this scope
    MyFrame.cpp:448: error: ‘OutputAllAnalog’ was not declared in this scope
    make: *** [MyFrame.o] Error 1

    or vice versa.

    Any clues? I have G++ usblib etc…..

    Am I missing something here that you have installed?

    Peace.

  8. Panic1 says:

    The compile program can’t find your libk8055.so file. I believe you first need to do “make install” in the libk8055 directory.

  9. Vincent BRACH says:

    Hi there,

    Bodhi, first I’ve the same error like you :
    MyFrame.cpp:22: error: stray ‘\342’ in program
    ….

    In fact it’s because you copy/paste exactly the : extern “C” { … code from this page.
    Change the “ by ” and normaly it’s works directly !

    Very thanks to Panic1 who wrote this page that allow me to compile this software with the K8055 board !!!

    Vincent BRACH

  10. Vincent BRACH says:

    It’s me again…

    Arff the character to replace don’t display well here ( ” ) : it’s the normal double-quote open string character…

    Vincent BRACH

  11. Panic1 says:

    Hehe, the board doesn’t seem to very C-code-friendly :-) I know I haven’t posted anything in a while, but it’s really nice to see people can still find their way to this information :D

Leave a Reply

You must be logged in to post a comment.