Velleman K8055 Usb Board

Blitz3D Forums/Blitz3D Userlibs/Velleman K8055 Usb Board

Dannyk(Posted 2012) [#1]
Just been working on using a pair of K8055's for home automation with a 3d interface all done in blitz3d. Here is the decl file, you will also need the K8055D.DLL from here.

Will post up some examples when i have chance, still stuck on ReadAllAnalog(data1,data2) Should return 2 32bit integers but at the mo it falls over, probably something obvious no doubt...
Anyway here is the decl:


;Velleman K8055 USB Dev board for blitz
.lib "K8055D.dll"

;General functions
OpenDevice%(CardAddress%)
CloseDevice%()
SearchDevices%()
SetCurrentDevice%(lngCardAddress%)
Version%()

;Analog to Digital converter functions
ReadAnalogChannel%(Channel%)
ReadAllAnalog%(Data1%, Data2%)

; Digital to Analog conversion functions
OutputAnalogChannel%(Channel%, Data%)
OutputAllAnalog%(Data1%, Data2%)
ClearAnalogChannel%(Channel%)
ClearAllAnalog%()
SetAnalogChannel%(Channel%)
SetAllAnalog%()

; Digital Output functions
WriteAllDigital%(Data%)
ClearDigitalChannel%(Channel%)
ClearAllDigital%()
SetDigitalChannel%()
SetAllDigital%()

; Digital Input functions
ReadDigitalChannel%(Channel%)
ReadAllDigital%()

; Counter functions
ResetCounter%(CounterNr%)
ReadCounter%(CounterNr%)
SetCounterDebounceTime%(CounterNr, DebounceTime)


Charrua(Posted 2012) [#2]
nice board, thank's

(mine is home made:
http://blitzbasic.com/Community/posts.php?topic=97142#1127010
)

Juan


Dannyk(Posted 2012) [#3]
Wow, Thats is very impresive! Just out of curiosity do you have the pcb layout and schematics availible? I expect its cheaper to build one than to buy. I would like a board with more outputs but i am trying to do it all on the cheap!

Cheers!
Dan


Charrua(Posted 2012) [#4]
as many home made things, something yes, something no. The most important part is the PIC16F876, do you have a way to program one?

i'm not at home and probably i kept some paper and pencil drafs somewhere.

regards

juan


Dannyk(Posted 2012) [#5]
Yep, I work in a school which is quite handy as our tech department are pretty good and have lots of nice kit, like PIC programmers and some very fancy CNC kit (plasma cutters, Routers, 3d printers, laser cutters etc...), Will check if we have one that can do this chip, I expect we will have.
Gonna post up a simple k8055 demo when i finish work too.
Cheers!
Dan


Charrua(Posted 2012) [#6]
the schematich isnt very much complex, an usual MAX232 (with it's capacitors) and the PIC. The rest depend on wich types of input/output you need.

ok, e-mail me, i supose that i could modify the pic code to meet your needs (in case your needs wont be much :)

Juan


Dannyk(Posted 2012) [#7]
Cheers! Here is what i have done so far with the velleman, not much yet but made a start.


and here is the demo and source:
Blitz_K8055.zip


Charrua(Posted 2012) [#8]
i run the demo and i suggest that you may use:
shift+Mouse to look and Mouse only to interact with the board.

it's hard to try to reach an output moving the board... but not impossible.

the idea of overlap blitz objects over the board is very good.

Juan


Dannyk(Posted 2012) [#9]
I agree, i think i will change it to shift+mouse cause like you say it can be a bit tricky, I also need to put in some sort of timer on the readalldigital() as it slows things down a fair bit calling it every cycle.
Few tweaks to make i think but i'm pretty chuffed with it so far.
Cheers
Dan


Charrua(Posted 2012) [#10]
try with something like:

Local Counter=0
const WhenToRead=10


While ....

    If Counter = WhenToRead then
        ;Read signals or whatever
        Counter = 0
    End If

WEnd


and of course, nothing more exciting than make a click on the screen and see some action outside the PC, even if it's only a led turning on/off.

Juan


Dannyk(Posted 2012) [#11]
That works a charm thanks! Just sorted it out and posted an update (same link)
Now to actually get it to run something, thinking of using RF remote plug sockets, just gonna open up the remote and tie it in to the K8055's outputs. Will post some picks when they arrive.
Cheers!
Dans