I have a discovery 4000 kit with the .55 XGA chip. I'm controlling the DMD through Matlab via the .OCX (ActiveX) file provided. Overall, it's an amazing piece of technology.
Fortunately, there are built-in Matlab functions that allow me to call the .OCX routines to control the DMD without rebuilding any significant portions of the code.
Now the request... Unfortunately, the COM object for the DMD in the .OCX driver doesn't conform to the OLE automation standard. MATLAB only supports COM objects that follow the OLE automation standard. In particular, the array being passed to the DMD is passed using a pointer to an array of SHORT's. While this is a perfectly good way of doing things (particularly for C or C++), this doesn't work well for quickly integrating the DMD control into other software.
When Matlab calls the COM object in the .OCX file, the type short* could have a lot of different meanings. MATLAB interprets it as a short type variable passed by reference in the COM interface. To pass arrays in or out of the COM object, SAFEARRAY rather than short* must to be used according to the OLE interface standards (the standard VB 6.0 conventions).
A VB wrapper should work to fix this. By creating a VB COM object following OLE standard using SAFEARRAYS which can handle transferring the info from the short* array. The COM object would refer to the other ocx and marshal-unmarshal the data by converting the data from SAFEARRAY to short* and vice versa. The simplest way is to do a deep data copying.
However, I was hoping that someone at TI (perhaps the person/team who wrote the .OCX code in the first place) might be able to provide a compiled .OCX file that uses the SAFEARRAY type, particularly as I have very little experience with making .OCX libraries or wrappers for them. This may also benefit other people, and speed up application development overall.
My current workaround is to save a .bmp to RAMDISK, then use the "ddc.LoadImageFileToBuffer('Temp.bmp');" command to read the bitmap from the disk. Unfortunately, even with a RAMDISK this provides a huge overhead, and makes for a ridiculously low refresh rate. I'd like to put patterns on the DMD on the order of 60 images per second, and right now I'm limited to one every second (rough estimate) due to all the type marshalling and ramdisk I/O. Please help!
Many thanks in advance, I love the device and the many new possibilities it opens up in our application,
Francis