Velleman K8000 & Linux HOWTO: Introduction

## 2. Introduction

In this chapter I want to discribe the history of this mini-mini-howto.

## 2.1 Target

In 1995 I was searching for an expansion board for my home-PC. It was a PC-AT with 386 CPU and at that time I was programming with clipper. I wanted to read some digital and analog input and I thought that I don't want a board in my PC. I was searching for an external solutions.

I found the velleman K8000 board in an electronic shop. There was a source code for the driver available. I compiled this code with borland-C compiler and linked it together with my Clipper application. This program is running since Summer 1995 an doing some watching of my oil-heating at home.

Today this old machine is the last DOS-based machine at home. All other PCs are running with Linux. I searched through the web a lot of hours and found only the i2c-velleman.c Kernel-driver in the kernel-tree. But I couldn't find any examples, how to connect from a small C-program to the K8000 board. So I decided, to try to hack it by myself. After the program(s) was(were) running I wrote this small HOWTO.

However, if you find I could help you learning howto connect from C to your Velleman K8000 board, feel free to send me a short message. I would be happy to hear from you - I am sure thare there are some other K8000 user out there :-))

In a discussion with hihihi <hihihi@wanadoo.nl> I found out that there also exists a velleman-library called libk8000. This HOWTO does not support this library-solution. Here I discribe the connection via kernel-drivers. At this point I want to thank hihihi <hihihi@wanadoo.nl> for his hints and for testing this HOWTO.

## 2.2 HW-Configuration

When you finished soldering your K8000, you should switch the two DIP-Switches to the off position.

## 2.3 SW-Configuration

You should prepare your system by running the following script (I stored it under the name "velle")

> `

>     #! /bin/bash

>     echo free the Parport ...
>     /sbin/rmmod lp
>     /sbin/rmmod parport_pc
>     /sbin/rmmod vmppuser
>     /sbin/rmmod parport

>     echo i2c Treiber laden ...
>     /sbin/modprobe i2c-velleman
>     /sbin/modprobe i2c-dev

>     echo create the device-handle and free it for all users
>     cd /dev
>     rm velleman

>     # The following part was written by hihihi#wanadoo.nl
>     # Jan 31 2002
>     # A variation on the ./velle script of Heimo Schoen.
>     Filename=/proc/bus/i2c
>     line="not empty yet"
>     echo
>     echo "    Look for I2C devices in /proc/bus/i2c :"
>     echo
>     while [ "$line" != "" ]
>     do
>       read line
>       echo "     " $line
>       if echo "$line" | grep -q "Velleman K8000"
>       then
>         K8000Entry=$line
>       fi
>     done <"$Filename"

>     echo
>     echo "      Found a Velleman K8000 entry:" $K8000Entry
>     echo

>     K8000Nod=${K8000Entry#i2c-}
>     echo $K8000Nod
>     K8000Nod=`expr match "$K8000Nod" '\([0-9]*[0-9]\)'`
>     echo $K8000Nod

>     mknod velleman c 89 $K8000Nod
>     chmod a+rw velleman

>     echo Etwas auf die K8000 jagen ...
>     echo hallo > /dev/velleman

> `

You can download this script here