THE USB-DMX512 CONVERTER
→ Using the converter ←
Significance of the leds:
The interface is equipped with three leds:
a green one,
an orange one,
a red one.
These three leds indicate various operating modes of the ocnverter:
all leds turned off:
The USB-DMX converter is not conncected to the PC or the PC is switched off.
only the green led is on:
The converter is connected to the PC and ready to beused. No data exits from the converter.
the green & orange leds are on:
The converter is under operation. The data are transmitted to the lighting equipments.
the green & orange leds are on and the red ledis blinking:
The converter is under operation. The data are transmitted to the lighting equipments and the DMX_IN function is activated.
the three leds are on:
The converter is in program mode. To exit from this state, please refer to the "Programmation" article or contact me.
Using the USB-DMX converter and its DLLs :
Introduction:
In order to control interface USB, a DLL written under Visual C++ exists. This one is available on the following link and must be copied in the folder of the application which uses it (version of October 6th, 2006):
The DLL entry points:
The entry points represent the whole of the functions available in the DLL. Those are three:
Opening the communication with the converter: int OpenUSB (void);
Sending some datas to the converter: int SendUSB (unsigned char* Data);
Closing the communication with the converter: int CloseUSB (void);
All of these functions return a value different from zero in case of error during execution.
The size ofthe “Data” table must be at least equal to the number of managed DMX channels.
Using the DLL with Visual C++:
This example describes the use of the DLL in a program written with Visual C++. See the details bellow:
DECLARATION OF FUNCTIONS AND DATAS:
#define USB_DLL "USB_DLL.DLL"
#define USB_OPEN_ENTRY "OpenUSB"
#define USB_SEND_ENTRY "SendUSB"
#define USB_CLOSE_ENTRY "CloseUSB"
typedef int (*LPFN_OPEN_USB)(void);
typedef int (*LPFN_SEND_USB)(unsigned char *data);
typedef int (*LPFN_CLOSE_USB)(void);
LPFN_OPEN_USB OpenUSB;
LPFN_SEND_USB SendUSB;
LPFN_CLOSE_USB CloseUSB;
HINSTANCE hDLL ;
unsigned char DmxOut[256];
INITIALIZING THE DLL:
// Initilization of the DMX datas.
memset (DmxOut, 0, sizeof (DmxOut));
// Loading the DLL.
hDLL = LoadLibrary( USB_DLL ) ;
if (hDLL != NULL)
{ OpenUSB = (LPFN_OPEN_USB)GetProcAddress(hDLL, USB_OPEN_ENTRY);
if (!OpenUSB)
{ FreeLibrary(hDLL);
hDLL = NULL;
return; }
SendUSB = (LPFN_SEND_USB)GetProcAddress(hDLL, USB_SEND_ENTRY);
if (!SendUSB)
{ FreeLibrary(hDLL);
hDLL = NULL;
return; }
CloseUSB = (LPFN_CLOSE_USB)GetProcAddress(hDLL, USB_CLOSE_ENTRY);
if (!CloseUSB)
{ FreeLibrary(hDLL);
hDLL = NULL;
return; }
// Ouverture de l'interface.
if (OpenUSB())
AfxMessageBox("USB-DMX converter not found !!!", MB_ICONSTOP);
else
{ CString Texte;
Texte.Format("The '%s' DLL was not found.\nThe USB-DMX converter will not be usable.", USB_DLL);
AfxMessageBox(Texte, MB_ICONSTOP); }
return;
SENDING DATAS TO THE CONVERTER:
// Sending datas.
if (SendUSB(DataOut))
AfxMessageBox("Error in transmitting the datas to the converter");
return;
CLOSING THE CONVERTER COMMUNICATION:
// Closing the converter.
CloseUSB();
// DLL releasing.
FreeLibrary(hDLL);
return;
Using the DLL with Visual Basic :
This example describes the use of the DLL in a program written with Visual Basic. See the details bellow:
DECLARATION OF FUNCTIONS AND DATAS:
Public Declare Function OpenUSB Lib "usb_dll.dll" () As Integer
Public Declare Function CloseUSB Lib "usb_dll.dll" () As Integer
Public Declare Function SendUSB Lib "usb_dll.dll" (ByVar data As String) As Integer
Then, you just have to call the OpenUSB, SendUSB et CloseUSB functions when you want.
All of these functions return 0 in the case of success of its execution or -1 in the contrary case.
SENDING DATAS TO THE CONVERTER:
Dim DMXout(512) As Byte
Dim DMXoutStr As String
Private Sub Send_Data()
' Opening the converter.
OpenUSB
' Initializing the datas.
Dim i As Integer
For i = 0 To 255
DMXout(i) = i
Next i
' Conversion of the datas before sending them to the DLL.
DMXoutStr = StrConv(DMXout, vbUnicode)
' Sending the datas.
SendUSB (DMXoutStr)
End Sub
For any complementary question, feel free to contact me by email...
Written by :
(Last update : 26 March 2007)
Previous page : Installation
|