Velleman K8000 - [K8000 From Excel]
K8000 From Excel
Sometimes, people ask me if it possible to control the K8000 from
Microsoft Excel. The answer is: YES. I made a little
example to demonstrate this.
The image above shows a screenshot of the Excel file I created. It has
three different tables on it: one with the values of the A/D channels, one with
the state of the I/O channels and one to control I/O outputs 9 - 16.
- The AD (Analog Digital) table shows you the information from the
analog I/O channels. I wrote a used defined Excel function for this:
=ReadAD(channelnr). For channelnr you have to specify a
number between 1 and 4 as there are 4 analog inputs. One important thing to
realize yourself is these values aren't changing in real time. In order to
get new readings from the card you have to refresh your Excel sheet.
- The I/O input table shows you the state of all the 16 I/O channels: 1
means 'on' and 0 means 'off'. My user defined Excel function is:
=readio(channelnr). channelnr is the number of the
I/O channel you want to read. It can be any integer number between 1 and 16.
The values aren't changing in real time: you have to refresh the sheet yourself.
- With the third table you can change the state of I/O channels 9 to 16.
Try it out: type "1" or "0" in one of these cells. The corresponding channel
will change immediately and the requested state will be shown. My user defined
Excel function is: =setio(channelnr,state). Here channelnr is
the number of the I/O channel to change while state represents the desired state
(1 or 0).
These Excel functions are created in VBA (Visual Basic for Applications),
the underlying programming environment in MS Office. When trying my sample
file Excel will demand if you allow the execution of macro's inside the file.
Here you need to click yes.
As with any other K8000 application you need the DriverLinx PortIO driver
to be installed. The driver is used to maintain the connections between the
K8000 hardware and the software.