DasUsbCommand - DHC_DMXOUT speed ?

SLESA-U6 - SL512BC - developer kit

Moderators: simonB, nick, florent, dylan, Ben

MattStevens
Posts: 2
Joined: Tue Jul 06, 2010 7:27 pm

DasUsbCommand - DHC_DMXOUT speed ?

Post by MattStevens »

Hello,
I bought a DMX controller SIUID 6C and I use the Developper SDK to use it in my software. It works pretty well, except for the fact that the call to DHC_DMXOUT sometimes takes a pretty long time. It varies around 37-38 milliseconds per call, but sometimes it goes as low as 2ms. I'm wondering if it is the normal speed, or if there's something wrong with my software. The documentation mentions something about a "stand alone mode" but I'm not sure what that means, or how do I "wake" up the DMX controller if this happens.

I did a small code snippet that reproduces the problem. I compiled it as a Windows console application with Visual Studio 2008. The driver I use is the one found on the CD that came with the DMX controller. (The one in the folder "Driver\siudi_stick_ 32_64_bit" of the CD)

Code: Select all

#include <conio.h>
#include <iostream>
#include <windows.h>
#include "_DasHard.h"

HMODULE				mDLLHandle;

typedef int (__cdecl *PFDASUSBCOMMAND) (int, int, unsigned char *);
PFDASUSBCOMMAND DasUsbCommand;
__int64 sFrequency;

int main()
{
	QueryPerformanceFrequency (reinterpret_cast<LARGE_INTEGER *>(&sFrequency));

	mDLLHandle = LoadLibrary("DasHard2006.dll");
	if(mDLLHandle)
	{
		DasUsbCommand = (PFDASUSBCOMMAND) GetProcAddress(mDLLHandle, "DasUsbCommand");
		if(DasUsbCommand != NULL)
		{
			DasUsbCommand(DHC_INIT, 0, NULL);
			int interfaceOpened = (DasUsbCommand(DHC_OPEN, 0, NULL) > 0);
			DasUsbCommand(DHC_DMXOUTOFF, 0, NULL);

			if(interfaceOpened > 0)
			{
				unsigned char buffer[512];
				int i = 0;
				while(true)
				{
					__int64 time1, time2;

					//rand() % 256
					memset(buffer, (i % 2 == 0 ? 255:0), 512);
					int port = DasUsbCommand(DHC_PORTREAD, 0, NULL);

					QueryPerformanceCounter (reinterpret_cast<LARGE_INTEGER *>(&time1));
					DasUsbCommand(DHC_DMXOUT, 512, buffer);
					QueryPerformanceCounter (reinterpret_cast<LARGE_INTEGER *>(&time2));

					__int64 firstCall = time2 - time1;

					char time[20];
					itoa(static_cast<int>(firstCall), time, 10);

					//std::string timeString(time);
					printf(time);
					printf(" - ");
					itoa(static_cast<int>((firstCall * static_cast<__int64>(1000)) / sFrequency), time, 10);
					printf(time);
					printf("\n");

					i++;

					if(kbhit() > 0)
						break;
				}

				DasUsbCommand(DHC_DMXOUTOFF, 0, NULL);
				DasUsbCommand(DHC_CLOSE, 0, NULL);
			}
			DasUsbCommand(DHC_EXIT, 0, NULL);
		}
	}

	getch();
	return 0;
}
Thanks for your help,
- Matt
florent
Posts: 3
Joined: Thu Apr 01, 2010 7:46 am

Re: DasUsbCommand - DHC_DMXOUT speed ?

Post by florent »

Siudi6C support DMX output frequency only at 25Hz.

You should use a timer to call "DasUsbCommand(DHC_DMXOUT, 512, buffer);" every 40ms.
MattStevens
Posts: 2
Joined: Tue Jul 06, 2010 7:27 pm

Re: DasUsbCommand - DHC_DMXOUT speed ?

Post by MattStevens »

Thanks a lot, it fixed my problem.

- Matt
Locked