Logo Banner

VELLEMAN K8055 - [K8055 in Excel]

Control K8055 from Excel

Introduction

People sometimes ask me if they can control the K8055 card from Excel. This sure is possible. Excel has a good support to implement your own User Defined Functions (UDF's). This is done with the help of an integrating programming environment: Visual Basic For Applications or simply VBA.

The Excel sample

I created a sample Excel file that demonstrates all I/O possibilities of the Velleman K8055 card. You can see a screenshot at the left.

I added a separate table for each type of I/O: digital outputs, digital inputs, analog outputs and analog inputs. The output tables are interactive: you can set the desired values for the K8055 card. Once changed, the values are immediately sent to the K8055 card.

The input tables are updated automatically once per second (in my old K8000 excel sample this had to be done by hand).

Architecture

Building this application was easy: it took less than an hour to build it from scratch. I wrote a software function for each I/O type. These functions are called directly from the Excel worksheet.

Further I used the auto_open() macro. This macro is automatically called when the Excel Workbook is opened. This sub contains the short initialization code for the K8055. By default it always uses card address 3 (the two jumpers are open).

The auto_open() also launches a timer that is executed once per second. It forces a refresh of all formulas in the Workbooks.

Using the Excel File

The Excel file I designed is an Excel 2007 file, with an .XLSM extension. Usually Excel files have the .XLS extension. The extra M indicates the file has macros.

By default Excel is setup to give a security warning when you try to open such file. The macro codes are disabled until you enable them by clicking the Options button.

The Excel file uses the K8055D.DLL file. You need to place this file in your Windows System directory:

Once last thing: You can view/edit the Visual Basic program code by going to the Developer tab on the Office Ribbon. By default this tab is not activated. Find out how to activate the tab [External].

Download

Here you can download a ZIP containing the both Excel and K8055D.DLL files.

Copyright ©1998-2017 Vanderhaegen Bart - last modified: August 24, 2013