K8090 alternative software build

Hi,

I have a K8090 which I have been using in an automated test rig for some time. This requires the K8090 to be up and running for weeks if not months at a time. I started out using the Velleman supplied DLL based around a virtual serial COM port but I found that the comms seemed to be unstable and would occasionally crash for no apparent reason. I also found I had to build delays into my program when I wanted to send multiple commands to the K8090.

In the end, and partly just for the fun of it, I wrote my own firmware for the K8090 in assembler using Microchip’s free MPLAB development environment - I already had the USB comms stack available from other projects. I have been using this pretty much continuously for over a year now and I have had no problems with it at all - though I should point out that I am mainly only using the commands to switch the relays on and off.

Would you like a copy? I’m happy to provide the assembler source as well as the binary, plus an example calling program written in Borland Turbo C++. I’ve used the Microchip mpusbapi.dll for the comms functions to send and receive byte packets. It should be possible to port this over to MSVC++, but it might also be best to then use the winusb.dll instead of mpusbapi.dll.

I used a VID/PID from the Microchip range which I added to the mchpusb.inf file. This should probably be swapped out for a Velleman VID/PID and I am happy to make the necessary change in the assembler source code. You may wish to create your own .inf file with the Velleman VID/PID.

The communication packets don’t include STX and ETX bytes. Otherwise the packet structure is the same as in the original Velleman code except for the response to a Query Timer Delay command - see below.

When given a command to switch a relay on (from switches or via USB) if that relay is already on with a timer running the timer is disabled.

If a relay is switched on with a timer delay of zero it will be switched on and will remain on for up to 4 ms.

When querying relay timer delay the mask and param1 bytes are ignored. Instead a 42 byte packet is returned consisting of a single 44h command byte, followed by 8 x 5 = 40 data bytes, and finally a single checksum byte. The data bytes consist of 5 bytes per relay starting with relay 1 and continuing in sequence for all 8 relays. Each set of 5 bytes contain the standard (total) delay time in seconds (2 bytes, high then low); the remaining delay time in seconds (2 bytes, high then low; zero if timer not running); and the remaining sub-second count in 4 ms units (1 byte).

I have implemented the full set of commands listed in the K8090 Protocol Manual dated February 8, 2010. I have also added command 17h to query button status (There is no ‘listener’ function - the comms are effectively working at a slightly lower level than this).

One limitation of this approach is that to use multiple K8090’s connected to the same PC would (I think) require each to be given its own VID/PID.

If you would like a copy please let me know how best to get it to you.

PS: Great kit - I’ve had a lot of fun with it!

Thank you for your interest in this kit.
Unfortunately, we do not have the means to distribute your code, unless you supply a link to it, which we can put on our site.