我无法获得“Velleman 零件号 VM116”与我的 DMX 灯对话
大家好。
首先,我使用的是 Delphi 7,计算机通过 USB 端口连接到“Velleman 部件号 VM116”,并且我有两个 DMX LED 灯连接到控制器的 DMX 输出。
我已将 K8062d.dll 库放在与可执行文件相同的文件夹中,但我还没有接近让灯响应。困难在于,它应该像馅饼一样简单,考虑到我必须让我的 24 通道照明台来控制我的灯光,这个控制器应该就像将一个形状放到一个表单上一样简单。
无论如何,这是示例代码...
unit chaser_control;
interface
type
rgb=(
c_red,
c_green,
c_blue);
dmx_offset:array[rgb] of integer=(
1,
2,
3);
dmx_class=class(tobject)
constructor create;
destructor demolish;
procedure initialise;
procedure finish;
procedure set_channel(
can_dmx:integer;
channel:rgb;
c:integer);
end;
var
can:dmx_class;
implementation
// these four external procedures are all that is necessary to address and
// write to any of the 512 DMX channels in the chain
procedure StartDevice; stdcall; external 'K8062d.dll';
procedure SetData(Channel: Longint ; Data: Longint); stdcall; external 'K8062d.dll';
procedure SetChannelCount(Count: Longint); stdcall; external 'K8062d.dll';
procedure StopDevice; stdcall; external 'K8062d.dll';
//
// dmx control
//
constructor dmx_class.create;
begin
inherited;
// the dmx controller is started once when this class is instantiated
initialise;
end;
destructor dmx_class.demolish;
begin
// the dmx controller is closed down when this class is destroyed
finish;
inherited;
end;
procedure dmx_class.initialise;
begin
// call the device DLL
StartDevice;
// allocate 5 channels for led can [two channels are not used]
SetChannelCount(5);
// make sure that channel 1 is set to zero [i never use this channel,
// on the lighting desk it is set to zero]
SetData(1,0);
end;
procedure dmx_class.finish;
begin
// this procedure is called once
StopDevice;
end;
//
// can control
//
procedure dmx_class.set_channel(
can_dmx:integer;
channel:rgb;
c:integer);
var
l1,l2:longint;
begin
// l1 and l2 are longint variables as the arguments passed to the
// DLL are longint even though the data is actually 8 bit
l1:=can_dmx+dmx_offset[channel];
l2:=c;
SetData(l1,l2);
end;
begin
// example call to change the green channel on a can with dmx address 1
// simply assume that 'can' is not created automatically at startup
can:=dmx_class.create;
can.set_channel(1,c_green,240);
// and so on
can.free;
end.
当绿色通道设置为 240 时,没有任何反应,灯光很好,因为它们可以从照明台控制,就像我所说的,也可以通过我使用 MIDI show 编写的其他软件进行控制控制。然而,显示控制的问题是它仅限于 7 位,这就是我需要这个新设备才能工作的原因。
蒂亚·
安德鲁
Hello everybody.
First of all, I am using Delphi 7, the computer is connected to a 'Velleman part No. VM116' via a USB port and I have two DMX led lights connected to the DMX output of the controller.
I have placed the K8062d.dll library in the same folder as the executable, but I am not getting close to making the lights respond. The difficulty is that it should be as easy as pie, considering the trouble I had to get my 24 channel lighting desk to control my lights this controller should be just as easy as dropping a shape onto a form.
Anyway, here is the sample code...
unit chaser_control;
interface
type
rgb=(
c_red,
c_green,
c_blue);
dmx_offset:array[rgb] of integer=(
1,
2,
3);
dmx_class=class(tobject)
constructor create;
destructor demolish;
procedure initialise;
procedure finish;
procedure set_channel(
can_dmx:integer;
channel:rgb;
c:integer);
end;
var
can:dmx_class;
implementation
// these four external procedures are all that is necessary to address and
// write to any of the 512 DMX channels in the chain
procedure StartDevice; stdcall; external 'K8062d.dll';
procedure SetData(Channel: Longint ; Data: Longint); stdcall; external 'K8062d.dll';
procedure SetChannelCount(Count: Longint); stdcall; external 'K8062d.dll';
procedure StopDevice; stdcall; external 'K8062d.dll';
//
// dmx control
//
constructor dmx_class.create;
begin
inherited;
// the dmx controller is started once when this class is instantiated
initialise;
end;
destructor dmx_class.demolish;
begin
// the dmx controller is closed down when this class is destroyed
finish;
inherited;
end;
procedure dmx_class.initialise;
begin
// call the device DLL
StartDevice;
// allocate 5 channels for led can [two channels are not used]
SetChannelCount(5);
// make sure that channel 1 is set to zero [i never use this channel,
// on the lighting desk it is set to zero]
SetData(1,0);
end;
procedure dmx_class.finish;
begin
// this procedure is called once
StopDevice;
end;
//
// can control
//
procedure dmx_class.set_channel(
can_dmx:integer;
channel:rgb;
c:integer);
var
l1,l2:longint;
begin
// l1 and l2 are longint variables as the arguments passed to the
// DLL are longint even though the data is actually 8 bit
l1:=can_dmx+dmx_offset[channel];
l2:=c;
SetData(l1,l2);
end;
begin
// example call to change the green channel on a can with dmx address 1
// simply assume that 'can' is not created automatically at startup
can:=dmx_class.create;
can.set_channel(1,c_green,240);
// and so on
can.free;
end.
When the green channel is set to 240, nothing happens, the lights are fine as they can be controlled from the lighting desk and like I said also by other software that I have written using MIDI show control. However the problem with show control is it is limited to 7 bits, which is why I need this new device to work.
TIA
Andrew
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用
Destroy; override;
而不是demolish
(以便能够调用can.Free
)。您是否尝试过使用
cdecl
而不是stdcall
?我怀疑调用
dmx_class.finish = StopDevice
会停止设备 - 因此您需要在退出应用程序之前等待发生一些事情:也许设备关闭得太快以至于您看不到它工作。You should use
Destroy; override;
instead ofdemolish
(to be able to callcan.Free
).Did you try with
cdecl
instead ofstdcall
?I suspect calling
dmx_class.finish = StopDevice
will stop the device - so you need to wait for something to happen before quitting the application: perhaps the device is closed so quickly that you do not see it working.好的,我从 Velleman 得到了答案,您还必须将 K8062e.exe 和 FASTTime32.dll 以及 K8062D.dll 包含在与应用程序相同的文件夹中。安德鲁
OK, I got the answer from Velleman, you also have to include both K8062e.exe and FASTTime32.dll as well as K8062D.dll in the same folder as your application. Andrew