Greetings chaps,
edit this code attached, to work on D7:
https://github.com/okini3939/Enttec_test
Reading parameters from one of these USB DMX Boxes
:https://www.enttec.com/product/lighting-communication-protocols/dmx512/dmx-usb-pro/
Usual responses go into memo1
devices 1
0
open 4841960
Sending GET_WIDGET_PARAMS packet...
PRO Connected Succesfully 0 0
3
version 1.44
BREAK TIME 196030
MAB TIME 10670
To not mess that up I created a button to test reading the serial number and having the results go to memo2.
All fine, D7 is communicating with the Box and receiving parameters and sending out DMX but I cannot understand this code enough to know why I do not get the serial number.
How should I format the request and values, returned I get "0" and sometimes -1 into memo2.
in the API is stated:
"
12. Get Widget Serial Number Request (Label = 10, no data), This message requests the Widget serial number, which should be the same as that printed on the Widget ( Device)
case.
13. Get Widget Serial Number Reply (Label = 10), The Widget sends this message to the PC in response to the Get Widget Serial Number request.
BCD serial number, with LSB stored at lowest address. On old Widgets, the serial number was not programmed, and the value would be hex 0FFFFFFFF, my device is a new one and other commercial software reads the serial number fine. So all is working except the code.
"
procedure TForm1.Button5Click(Sender: TObject);
var
buf_size: array[0..3] of byte;
res: integer;
buf: array[0..256] of byte;
begin
buf_size[0] := 0;
buf_size[1] := 0;
memo2.Lines.clear;
memo2.Lines.add('TX GET_WIDGET_SN packet');
res := FTDI_SendData(GET_WIDGET_SN, buf_size, 2);
sleep(100);
memo2.Lines.add('RX GET_WIDGET_SN packet');
res := FTDI_ReceiveData(GET_WIDGET_SN, buf_size, 4);
memo2.Lines.add(inttostr(res));
end;