Make your own software with DASHARD.DLL, USBDMXVB.DLL
and our Intelligent USBDMX1 / USBDMX2 Interface

The DASHARD.DLL is a 32 bit Windows DLL (Dynamic Link Library). The library works with Windows 98, ME, 2000 and XP. It has been tested on Visual C++, Visual Basic, C++ Builder, and Delphi.


The DASHARD.DLL contains only one function :

         C++ style

         int DasHardCommand(  int command,   int param,   unsigned char *bloc );

         Visual Basic style

         Declare Function DasHardCommand Lib "USBDMXVB.DLL" Alias "_DasHardCommand@12"
                 (ByVal Command As Integer, ByVal Param As Integer, ByRef dmxdata As Byte) As Long

The first parameter <command> defines the thing to do :

int command explanation works with int param unsigned char *bloc return value (int)
DHC_OPEN allow to open the communication with the interface ALL INTERFACES Enter 0 to open any interface.

Enter 3 to open USBDMX1
Enter 11  to open USBDMX2
not used Positive value if the function succeeds.
  return  3 with USBDMX1
  return 11 with USBDMX2
  return a specific value with
Negative value if the function fails.
DHC_CLOSE allow to close the communication with the interface ALL INTERFACES not used not used DHE_OK  If the function succeeds.
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_ERROR_COMMAND  If the function fails.
DHC_DMXOUTOFF allow to clean the DMX ouput (force all levels to 0) USBDMX1     USBDMX2 not used not used DHE_OK  If the function succeeds
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_DMXOUT_PACKWRITE  If the communication fails.
DHC_DMXOUT allow to send a DMX block to the interface USBDMX1     USBDMX2 Specifies the size, in bytes, of the DMX block of memory to send Pointer to the DMX block of memory to send DHE_OK  If the function succeeds
DHE_NOTHINGTODO If the DMX levels are the same as before.
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_DMXOUT_PACKWRITE  If the communication fails.
DHC_PORTCONFIG allow to set the input/output mode and the state of the 8 ports USBDMX1 Set an integer from 0 to 65535 (16bits).
The low byte specifies the input/output mode of the 8 ports. (0=input, 1=output)
The high byte specifies the state of the 8 ports. (0=off, 1=on)
not used DHE_OK  If the function succeeds.
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_ERROR_COMMAND  If the function fails.
DHC_PORTREAD allow to read the state of the 8 ports and the Next/Previous buttons USBDMX1 not used not used DHE_ERROR_NOTOPEN  If the interface is not open.
If the function succeeds, the return value is from 0 to 1023 (10bits), Bit0=NEXT, Bit1=PREVIOUS, Bit2-9=State of 8ports
DHC_VERSION return the firmware version USBDMX1  not used not used Return 10 with firmware dated 4-may 2000
Return 11 with firmware dated 31-jan 2001
With USBDMX2 and return DHE_NOTHINGTODO 
DHC_DEBUG_OPEN open the debug mode and create a file named "debug.txt" ALL INTERFACES not used not used return DHE_OK always
DHC_DEBUG_CLOSE close the debug mode
ALL INTERFACES not used not used return DHE_OK always
DHC_WRITEMEMORY allow to write the stand alone memory. USBDMX1  Specifies the size, in bytes, of the block of memory to write. Pointer to the block of memory DHE_OK  If the function succeeds.
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_ERROR_COMMAND  If the function fails.
DHC_READMEMORY allow to read the stand alone memory. USBDMX1  Specifies the size, in bytes, of the block of memory to read. Pointer to the block of memory DHE_OK  If the function succeeds.
DHE_ERROR_NOTOPEN  If the interface is not open.
DHE_ERROR_COMMAND  If the function fails.
DHC_SIZEMEMORY allow to know the size of the stand alone memory. USBDMX1  not used not used DHE_ERROR_NOTOPEN  If the interface is not open.
return the size, in bytes, of the stand alone memory.

Remarks:
- All the constants  DHC_OPEN,  DHC_CLOSE,  DHE_OK ....     are defined in the "_DasHard.h" include file.

DHC_OPEN 1 // COMMAND
DHC_CLOSE 2 // COMMAND
DHC_DMXOUTOFF 3 // COMMAND
DHC_DMXOUT 4 // COMMAND
DHC_PORTREAD 5 // COMMAND
DHC_PORTCONFIG 6 // COMMAND
DHC_VERSION 7 // COMMAND
DHC_RESET 11 // COMMAND
DHC_DEBUG_OPEN 12 // COMMAND
DHC_DEBUG_CLOSE 13 // COMMAND
DHC_WRITEMEMORY 21 // COMMAND
DHC_READMEMORY 22 // COMMAND
DHC_SIZEMEMORY 23 // COMMAND
DHC_TRANSPORT 30 // COMMAND
DHP_TRANSPORT_MODEALW 1 // PARAM
DHP_TRANSPORT_MODEALW32 2 // PARAM
DHP_TRANSPORT_MODEOPT 3 // PARAM (DEFAULT)
DHP_TRANSPORT_MODEOPT32 4 // PARAM
DHC_SERIALNREAD 47 // COMMAND
DHC_SERIALNWRITE 48 // COMMAND
DHE_OK 1 // RETURN NO ERROR
DHE_NOTHINGTODO 2 // RETURN NO ERROR
DHE_ERROR_COMMAND -1 // RETURN ERROR
DHE_ERROR_NOTOPEN -2 // RETURN ERROR
DHE_DMXOUT_PACKWRITE -1000 // RETURN ERROR
-1005 // ERROR_ACCESS_DENIED
-1023 // ERROR_CRC
DHE_DMXOUT_PACKREAD -1100 // RETURN ERROR

You can use up to 10 USB interfaces at the same time.
To do this, just add a value in the <command> parameter :
- add 100 (DHC_USBDMX11) if you want to use the interface #2
- add 200 (DHC_USBDMX12) if you want to use the interface #3 ...
Example:       DasHardCommand( DHC_USBDMX11+DHC_OPEN  ,   0  ,  0 )   open the
the interface #2


Example of code using our DLL  -  C++ style


Open the interface when your application start :

     int interface_open;                     // global
     unsigned char dmxblock[512];          
// global

     interface_open = HardDllCommand(DHC_OPEN,0,0);
     if (interface_open>0) {
          for(int i=0;i<512;i++)
               dmxblock[i] = 0;
          int v = HardDllCommand(DHC_DMXOUTOFF,0,0);
     }
Note :
- When you open the interface, you don't know the state of the DMX output levels into the interface. It's why it's better to clean all DMX levels to be sure.


Send the DMX and read the PORT everytime :

     int v,ports;
     if (interface_open>0) {
          ports = HardDllCommand(DHC_PORTREAD,0,0);
          v = HardDllCommand(DHC_DMXOUT, 512, dmxblock);
          if (v<0) {
              v = HardDllCommand(DHC_CLOSE,0,0);
              v = HardDllCommand(DHC_OPEN,0,0);
          }
     }
Note :
- When you use the DHC_DMXOUT command, the DLL analyses your DMX block. If there is no changes on the DMX levels, the function returns DHE_NOTHINGTODO and the DLL don't make a USB communication to save the CPU time of your computer.
- After 6 seconds without USB communication, the USBDMX1 and interfaces go in stand alone mode (it's a nice feature, if the computer fails). It's why we propose to read the state of the port everytime to force a USB communication, with this, the interface do not go in stand alone mode.
- If the DHC_DMXOUT command  fails (for example, if the user unplug the USB interface !), you need to close and try to open again the interface.


Close the interface when your application finish :

     int v;
     if (interface_open>0)
          v = HardDllCommand(DHC_CLOSE,0,0);


Copyright (c) Digital Art System, 1998-2002