Re: Vellerman K8055 interface
- Posted by alanjohnoxley Jun 16, 2011
- 1650 views
Thanks,
I have got it working. At the moment I am turning on/off the digital outputs.. just LED lights, but with relays that could be anything!
My wife wants me to use it to turn on alarms in the kids rooms to get them up in the morning ;)
Here is some simple code:
include std/dll.e atom dll_address integer K8055_OpenDevice, K8055_CloseDevice integer K8055_SetDigitalChannel, K8055_ClearAllDigital -- procedure load_dll() sequence s1 s1 = "C:\\Program Files\\Vellerman\\K8055\\K8055D.dll" -- 2003 version dll_address = open_dll(s1) if dll_address = 0 then puts(1,"\nCannot load DLL, aborting!") abort(8) end if -- define K8055 functions K8055_OpenDevice = define_c_func(dll_address, "OpenDevice", {C_INT},C_INT) K8055_CloseDevice = define_c_proc(dll_address, "CloseDevice", {C_INT}) K8055_ClearAllDigital = define_c_proc(dll_address, "ClearAllDigital", {C_INT}) K8055_SetDigitalChannel = define_c_func(dll_address, "SetDigitalChannel", {C_INT}) end procedure procedure test() integer i1 i1 = c_func(K8055_OpenDevice{3}) -- device 3 is with both jumpers off c_proc(K8055_ClearAllDigital,{0}) -- turn off all LEDs by default c_proc(K8055_SetDigitalChannel{3}) -- turn on LED 3 c_proc(K8055_SetDigitalChannel{7}) -- turn on LED 7 c_proc(K8055_CloseDevice,{0}) end procedure load_dll() test()