K8055 Test (C# .Net 2.0)
All software provided with no guarantee of fitness for purpose.
Use at your own risk.
If you have reached this page I assume you know what the Velleman
is (if not click the link for manufacturer info). This page contains a
C# version of the demo/test program supplied with the K8055 (also
downloadable from Velleman's site). I have added a few extras to give
your board and any attached equipment a thorough test without having to
write any code. See notes below for usage. If you have any
problems with this code or questions then email me
(excuse the anti-spam measures): doconnel(you-know-what)gmail(spot)com
and include "k8055" in the title, no attachments, otherwise it goes in
the spam folder and won't be read. Enjoy!
Future plans: replace PIC16C with PIC16F and my own code for
independent operation as a Programmable Logic Controller (possibly with
link for chaining several devices). Email me to keep informed of any
Update 2006-05-08: Updated C# code and renamed Visual Studio project.
C# Code: I
wrote this fairly
quickly and it's not the best design. I intend to do a much more
thorough job so that managing several devices is easier and more
transparent, eg, coalescing several devices into one super-device so
user code just deals with I/O and not with any specific board.
Interface: This is the revised interface, hopefully a bit more compact and more
useful to you:
On start-up a
search is performed for devices and the first device (numerically) is
selected. Only options for located devices are enabled. If you plug a device in after starting
the program then just click "Search".
Address: Same as original program but resets to current device if a device with the specified address cannot be connected.
Sets the freq/ interval
of the timer used to generate some test signals. One timer (only) is
used for reading the K8055's inputs and for driving the
analogue/digital test signals. Multiple timers were tried but gave
a sometime erratic result, even on fast machine. The timer is enabled using the checkbox. See below for more info.
Simply displays Vellemans message box (from the dll itself).
Displays both analogue channels as per original program.
This is the area
most improved. The sliders allow manual control
while the arrows allow each channel to be set to min/max with a single
click. The vertical set of clickable icons (actually flat image-based
buttons) allow for various test signals as
detailed below. NOTE: the manufactures info quotes "General conversion
time: 20mS per command" - which I suspect means that things are limited
by the time taken to send a command via usb and/or for the PIC to put
the command into effect . Whatever, basically it's very slow!
Effectively you get 256 * 20mS = 5.12 sec/cycle or 0.195 Hz (wow!).
Ramps from 0 to 255 then back to 0 (or
"triangle" wave if you prefer).
Sawtooth type wave, 0 to 255 then immediately
back to zero.
Sine wave centered around 127.
analogue input # 1 either exact/ inverted.
analogue input # 2 either exact/ inverted.
Digital In and Counters:
As per original program
added some more options for test signals. "Cycle" switches each output
on in turn while "Up" and "Dn" outputs the result of binary counter
0..255 / 255..0 resp. The latter effectively creates pulses of
successively half the freq of output # 1. Note again that the highest
freq you can probably get is 50Hz (probably lower) and that it can be
erratic, especially when the sig gen freq is changed from say 50Hz to
100Hz. I think several usb frames get queued and then rapid fired to
the device resulting in short bursts of a higher frequency. Still, when
left on one freq setting it's fairly consistent. I'll probably replace
this soon with a drop-down list with more options.